Some error handling and ensure we are an admin to delete requests.

Also started on the approval of everything
This commit is contained in:
tidusjar 2016-03-08 14:26:26 +00:00
commit 0942bfcbcc
18 changed files with 436 additions and 58 deletions

View file

@ -30,6 +30,10 @@ using System.Linq;
using Dapper.Contrib.Extensions;
using NLog;
using PlexRequests.Helpers;
namespace PlexRequests.Store
{
public class GenericRepository<T> : IRepository<T> where T : Entity
@ -39,6 +43,8 @@ namespace PlexRequests.Store
Config = config;
}
private static Logger Log = LogManager.GetCurrentClassLogger();
private ISqliteConfiguration Config { get; set; }
public long Insert(T entity)
{
@ -84,6 +90,8 @@ namespace PlexRequests.Store
public bool Update(T entity)
{
Log.Trace("Updating entity");
Log.Trace(entity.DumpJson());
using (var db = Config.DbConnection())
{
db.Open();
@ -93,7 +101,9 @@ namespace PlexRequests.Store
public bool UpdateAll(IEnumerable<T> entity)
{
Log.Trace("Updating all entities");
var result = new HashSet<bool>();
using (var db = Config.DbConnection())
{
db.Open();

View file

@ -1,4 +1,5 @@
using System;
using System.Security.Cryptography;
using Dapper.Contrib.Extensions;
@ -20,7 +21,8 @@ namespace PlexRequests.Store
public string RequestedBy { get; set; }
public DateTime RequestedDate { get; set; }
public bool Available { get; set; }
public IssueState Issues { get; set; }
public string OtherMessage { get; set; }
}
public enum RequestType
@ -28,4 +30,13 @@ namespace PlexRequests.Store
Movie,
TvShow
}
public enum IssueState
{
WrongAudio,
NoSubtitles,
WrongContent,
PlaybackIssues,
Other
}
}

View file

@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS Requested
Type INTEGER NOT NULL,
ProviderId INTEGER NOT NULL,
ImdbId varchar(50),
Overview varchar(50) NOT NULL,
Overview varchar(50),
Title varchar(50) NOT NULL,
PosterPath varchar(50) NOT NULL,
ReleaseDate varchar(50) NOT NULL,
@ -30,7 +30,9 @@ CREATE TABLE IF NOT EXISTS Requested
Approved INTEGER NOT NULL,
RequestedBy varchar(50),
RequestedDate varchar(50) NOT NULL,
Available INTEGER(50)
Available INTEGER(50),
Issues INTEGER,
OtherMessage varchar(50)
);