only show requested by users to admins + start maintaining a list of users with each request

This commit is contained in:
Drewster727 2016-03-29 13:41:39 -05:00
commit b8a01b62b9
8 changed files with 54 additions and 20 deletions

View file

@ -2,6 +2,8 @@
using System.Security.Cryptography;
using Dapper.Contrib.Extensions;
using System.Collections.Generic;
using System.Linq;
namespace PlexRequests.Store
{
@ -18,7 +20,10 @@ namespace PlexRequests.Store
public RequestType Type { get; set; }
public string Status { get; set; }
public bool Approved { get; set; }
[Obsolete("Use RequestedUsers")]
public string RequestedBy { get; set; }
public DateTime RequestedDate { get; set; }
public bool Available { get; set; }
public IssueState Issues { get; set; }
@ -27,6 +32,17 @@ namespace PlexRequests.Store
public int[] SeasonList { get; set; }
public int SeasonCount { get; set; }
public string SeasonsRequested { get; set; }
public List<string> RequestedUsers { get; set; }
public bool UserHasRequested(string username)
{
bool alreadyRequested = !string.IsNullOrEmpty(RequestedBy) && RequestedBy.Equals(username, StringComparison.OrdinalIgnoreCase);
if (!alreadyRequested && RequestedUsers != null && RequestedUsers.Count > 0)
{
alreadyRequested = RequestedUsers.Any(x => x.Equals(username, StringComparison.OrdinalIgnoreCase));
}
return alreadyRequested;
}
}
public enum RequestType