The move!

This commit is contained in:
Jamie.Rees 2017-05-16 08:31:44 +01:00
commit 25526cc4d9
1147 changed files with 85 additions and 8524 deletions

View file

@ -0,0 +1,126 @@
#region Copyright
// ***********************************************************************
// Copyright (c) 2016 Jamie Rees
// File: DbConfiguration.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#endregion
using System;
using System.Data;
using System.IO;
using System.Windows.Forms;
using Mono.Data.Sqlite;
using NLog;
namespace Ombi.Store
{
public class DbConfiguration : ISqliteConfiguration
{
private static Logger Log = LogManager.GetCurrentClassLogger();
public DbConfiguration(SqliteFactory provider)
{
Factory = provider;
}
private SqliteFactory Factory { get; }
private string _currentPath;
public string CurrentPath
{
get
{
if (!string.IsNullOrEmpty(_currentPath))
{
return _currentPath;
}
if (File.Exists(OldPath))
{
_currentPath = OldPath;
return _currentPath;
}
_currentPath = NewCurrentPath;
return _currentPath;
}
}
public string NewCurrentPath => Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? string.Empty, DbFile);
public string OldPath => Path.Combine(Path.GetDirectoryName(Application.ExecutablePath) ?? string.Empty, OldDbFile);
public virtual bool CheckDb()
{
Log.Trace("Checking DB");
Console.WriteLine("Location of the database: {0}",CurrentPath);
if (File.Exists(CurrentPath))
{
return false;
}
Log.Trace("DB doesn't exist, creating a new one");
CreateDatabase();
return true;
}
public const string OldDbFile = "PlexRequests.sqlite";
public const string DbFile = "Ombi.sqlite";
/// <summary>
/// Gets the database connection.
/// </summary>
/// <returns><see cref="IDbConnection"/></returns>
/// <exception cref="System.Exception">Factory returned null</exception>
public virtual IDbConnection DbConnection()
{
var fact = Factory.CreateConnection();
if (fact == null)
{
throw new SqliteException("Factory returned null");
}
fact.ConnectionString = "Data Source=" + CurrentPath;
return fact;
}
/// <summary>
/// Create the database file.
/// </summary>
public virtual void CreateDatabase()
{
try
{
using (File.Create(CurrentPath))
{
}
}
catch (Exception e)
{
Log.Error(e);
}
}
}
}

37
Old/Ombi.Store/Entity.cs Normal file
View file

@ -0,0 +1,37 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: Entity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store
{
public class Entity
{
[Key]
public int Id { get; set; }
}
}

View file

@ -0,0 +1,14 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Ombi.Store.Models.Plex;
namespace Ombi.Store
{
public interface IPlexDatabase
{
IEnumerable<MetadataItems> GetMetadata();
string DbLocation { get; set; }
Task<IEnumerable<MetadataItems>> GetMetadataAsync();
IEnumerable<MetadataItems> QueryMetadataItems(string query, object param);
}
}

View file

@ -0,0 +1,54 @@
#region Copyright
// ***********************************************************************
// Copyright (c) 2016 Jamie Rees
// File: ISqliteConfiguration.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#endregion
using System.Data;
namespace Ombi.Store
{
public interface ISqliteConfiguration
{
/// <summary>
/// Checks the database.
/// </summary>
bool CheckDb();
/// <summary>
/// Returns the database connection.
/// </summary>
/// <returns></returns>
IDbConnection DbConnection();
/// <summary>
/// Creates the database.
/// </summary>
void CreateDatabase();
string CurrentPath { get; }
}
}

View file

@ -0,0 +1,16 @@
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("Audit")]
public class Audit : Entity
{
public string Username{get;set;}
public DateTime Date {get;set;}
public string ChangeType {get;set;}
public string OldValue {get;set;}
public string NewValue{get;set;}
}
}

View file

@ -0,0 +1,44 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2017 Jamie Rees
// File: Emby.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
using Ombi.Store.Models.Plex;
namespace Ombi.Store.Models.Emby
{
[Table(nameof(EmbyContent))]
public class EmbyContent : Entity
{
public string Title { get; set; }
public string EmbyId { get; set; }
public DateTime PremierDate { get; set; }
public string ProviderId { get; set; }
public EmbyMediaType Type { get; set; }
public DateTime AddedAt { get; set; }
}
}

View file

@ -0,0 +1,45 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2017 Jamie Rees
// File: EmbyEpisodes.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models.Emby
{
[Table(nameof(EmbyEpisodes))]
public class EmbyEpisodes : Entity
{
public string EpisodeTitle { get; set; }
public string ShowTitle { get; set; }
public string EmbyId { get; set; }
public int EpisodeNumber { get; set; }
public int SeasonNumber { get; set; }
public string ParentId { get; set; }
public string ProviderId { get; set; }
public DateTime AddedAt { get; set; }
}
}

View file

@ -0,0 +1,35 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexMediaType .cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
namespace Ombi.Store.Models.Plex
{
public enum EmbyMediaType
{
Movie = 0,
Series = 1,
Music = 2
}
}

View file

@ -0,0 +1,43 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexUsers.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models.Emby
{
[Table(nameof(EmbyUsers))]
public class EmbyUsers : Entity
{
public string EmbyUserId { get; set; }
public string UserAlias { get; set; }
public int Permissions { get; set; }
public int Features { get; set; }
public string Username { get; set; }
public string EmailAddress { get; set; }
public string LoginId { get; set; }
}
}

View file

@ -0,0 +1,40 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: GlobalSettings.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("GlobalSettings")]
public class GlobalSettings : Entity
{
public string Content { get; set; }
public string SettingsName { get; set; }
}
}

View file

@ -0,0 +1,39 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: RequestBlobs.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("IssueBlobs")]
public class IssueBlobs : Entity
{
public int RequestId { get; set; }
public byte[] Content { get; set; }
public RequestType Type { get; set; }
}
}

View file

@ -0,0 +1,47 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: LogEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
using Newtonsoft.Json;
namespace Ombi.Store.Models
{
[Table("Logs")]
public class LogEntity : Entity
{
public DateTime Date { get; set; }
public string Level { get; set; }
public string Logger { get; set; }
public string Message { get; set; }
public string Callsite { get; set; }
public string Exception { get; set; }
[JsonIgnore]
public string DateString { get; set; }
}
}

View file

@ -0,0 +1,67 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: MetadataItems.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models.Plex
{
[Table("metadata_items")]
public class MetadataItems
{
[Key]
public int id { get; set; }
public int library_section_id { get; set; }
public int parent_id { get; set; }
public int metadata_type { get; set; }
public string guid { get; set; }
public int media_item_count { get; set; }
public string title { get; set; }
public string title_sort { get; set; }
public string original_title { get; set; }
public string studio { get; set; }
public float rating { get; set; }
public int rating_count { get; set; }
public string tagline { get; set; }
public string summary { get; set; }
public string trivia { get; set; }
public string quotes { get; set; }
public string content_rating { get; set; }
public int content_rating_age { get; set; }
public int Index { get; set; }
public string tags_genre { get; set; }
// SKIP Until Date Times
public DateTime originally_available_at { get; set; }
public DateTime available_at { get; set; }
public DateTime expires_at { get; set; }
// Skip RefreshedAt and Year
public DateTime added_at { get; set; }
public string SeriesTitle { get; set; } // Only used in a custom query for the TV Shows
}
}

View file

@ -0,0 +1,55 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexContent.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Data.Linq.Mapping;
namespace Ombi.Store.Models.Plex
{
[Table(Name = nameof(PlexContent))]
public class PlexContent : Entity
{
public string Title { get; set; }
public string ReleaseYear { get; set; }
public string ProviderId { get; set; }
public PlexMediaType Type { get; set; }
public string Url { get; set; }
/// <summary>
/// Only used for TV Shows
/// </summary>
public byte[] Seasons { get; set; }
/// <summary>
/// Only used for Albums
/// </summary>
public string Artist { get; set; }
public string ItemId { get; set; }
public DateTime AddedAt { get; set; }
}
}

View file

@ -0,0 +1,42 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: LogEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models.Plex
{
[Table("PlexEpisodes")]
public class PlexEpisodes : Entity
{
public string EpisodeTitle { get; set; }
public string ShowTitle { get; set; }
public string RatingKey { get; set; }
public string ProviderId { get; set; }
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
}
}

View file

@ -0,0 +1,35 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexMediaType .cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
namespace Ombi.Store.Models.Plex
{
public enum PlexMediaType
{
Movie = 0,
Show = 1,
Artist = 2
}
}

View file

@ -0,0 +1,43 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexUsers.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models.Plex
{
[Table(nameof(PlexUsers))]
public class PlexUsers : Entity
{
public string PlexUserId { get; set; }
public string UserAlias { get; set; }
public int Permissions { get; set; }
public int Features { get; set; }
public string Username { get; set; }
public string EmailAddress { get; set; }
public string LoginId { get; set; }
}
}

View file

@ -0,0 +1,43 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: LogEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
using Newtonsoft.Json;
namespace Ombi.Store.Models
{
[Table("RecentlyAddedLog")]
public class RecentlyAddedLog : Entity
{
/// <summary>
/// This is actually a unique id for that content...
/// </summary>
public string ProviderId { get; set; }
public DateTime AddedAt { get; set; }
}
}

View file

@ -0,0 +1,40 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: RequestBlobs.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("RequestBlobs")]
public class RequestBlobs : Entity
{
public int ProviderId { get; set; }
public byte[] Content { get; set; }
public RequestType Type { get; set; }
public string MusicId { get; set; }
}
}

View file

@ -0,0 +1,41 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UsersToNotify.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("RequestLimit")]
public class RequestLimit : Entity
{
public string Username { get; set; }
public DateTime FirstRequestDate { get; set; }
public int RequestCount { get; set; }
public RequestType RequestType { get; set; }
}
}

View file

@ -0,0 +1,52 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: RequestQueue.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("RequestFaultQueue")]
public class RequestQueue : Entity
{
public string PrimaryIdentifier { get; set; }
public RequestType Type { get; set; }
public byte[] Content { get; set; }
public FaultType FaultType { get; set; }
public DateTime? LastRetry { get; set; }
public string Description { get; set; }
}
public enum FaultType
{
RequestFault,
MissingInformation
}
}

View file

@ -0,0 +1,40 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: LogEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("ScheduledJobs")]
public class ScheduledJobs : Entity
{
public string Name { get; set; }
public DateTime LastRun { get; set; }
public bool Running { get; set; }
}
}

View file

@ -0,0 +1,37 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UsersToNotify.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store.Models
{
[Table("UsersToNotify")]
public class UsersToNotify : Entity
{
public string Username { get; set; }
}
}

View file

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{92433867-2B7B-477B-A566-96C382427525}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Ombi.Store</RootNamespace>
<AssemblyName>Ombi.Store</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Dapper, Version=1.50.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapper.1.50.0-beta8\lib\net45\Dapper.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Dapper.Contrib, Version=1.50.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Dapper.Contrib.1.50.0-beta8\lib\net45\Dapper.Contrib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Data.Sqlite">
<HintPath>..\Assemblies\Mono.Data.Sqlite.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.3.6\lib\net45\NLog.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DbConfiguration.cs" />
<Compile Include="Entity.cs" />
<Compile Include="IPlexDatabase.cs" />
<Compile Include="Models\Emby\EmbyContent.cs" />
<Compile Include="Models\Emby\EmbyEpisodes.cs" />
<Compile Include="Models\IssueBlobs.cs" />
<Compile Include="Models\RecentlyAddedLog.cs" />
<Compile Include="Models\Plex\PlexEpisodes.cs" />
<Compile Include="Models\Emby\EmbyUsers.cs" />
<Compile Include="Models\Plex\PlexUsers.cs" />
<Compile Include="Models\Plex\MetadataItems.cs" />
<Compile Include="Models\Plex\PlexContent.cs" />
<Compile Include="Models\Emby\EmbyMediaType.cs" />
<Compile Include="Models\Plex\PlexMediaType .cs" />
<Compile Include="Models\RequestQueue.cs" />
<Compile Include="Models\ScheduledJobs.cs" />
<Compile Include="Models\RequestLimit.cs" />
<Compile Include="Models\UsersToNotify.cs" />
<Compile Include="PlexDatabase.cs" />
<Compile Include="Repository\BaseGenericRepository.cs" />
<Compile Include="Repository\BaseExternalUserRepository.cs" />
<Compile Include="Repository\IExternalUserRepository.cs" />
<Compile Include="Repository\IRequestRepository.cs" />
<Compile Include="Repository\ISettingsRepository.cs" />
<Compile Include="ISqliteConfiguration.cs" />
<Compile Include="Repository\IRepository.cs" />
<Compile Include="Models\GlobalSettings.cs" />
<Compile Include="Models\LogEntity.cs" />
<Compile Include="Models\RequestBlobs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Repository\SettingsJsonRepository.cs" />
<Compile Include="Repository\RequestJsonRepository.cs" />
<Compile Include="Repository\GenericRepository.cs" />
<Compile Include="Repository\UserRepository.cs" />
<Compile Include="RequestedModel.cs" />
<Compile Include="UserEntity.cs" />
<Compile Include="UserLogins.cs" />
<Compile Include="UsersModel.cs" />
<Compile Include="UserRepository.cs" />
<Compile Include="Sql.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Sql.resx</DependentUpon>
</Compile>
<Compile Include="TableCreation.cs" />
<Compile Include="Models\Audit.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="sqlite3.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="SqlTables.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Sql.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Sql.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj">
<Project>{1252336D-42A3-482A-804C-836E60173DFA}</Project>
<Name>Ombi.Helpers</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,92 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: PlexDatabase.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Dapper;
using Dapper.Contrib.Extensions;
using Mono.Data.Sqlite;
using Ombi.Store.Models.Plex;
namespace Ombi.Store
{
/// <summary>
/// We should only ever READ, NEVER WRITE!
/// </summary>
public class PlexDatabase : IPlexDatabase
{
public PlexDatabase(SqliteFactory provider)
{
Factory = provider;
}
private SqliteFactory Factory { get; }
/// <summary>
/// https://support.plex.tv/hc/en-us/articles/202915258-Where-is-the-Plex-Media-Server-data-directory-located-
/// </summary>
public string DbLocation { get; set; }
private IDbConnection DbConnection()
{
var fact = Factory.CreateConnection();
if (fact == null)
{
throw new SqliteException("Factory returned null");
}
fact.ConnectionString = "Data Source=" + DbLocation;
return fact;
}
public IEnumerable<MetadataItems> GetMetadata()
{
using (var con = DbConnection())
{
return con.GetAll<MetadataItems>();
}
}
public async Task<IEnumerable<MetadataItems>> GetMetadataAsync()
{
using (var con = DbConnection())
{
return await con.GetAllAsync<MetadataItems>();
}
}
public IEnumerable<MetadataItems> QueryMetadataItems(string query, object param)
{
using (var con = DbConnection())
{
con.Open();
var data = con.Query<MetadataItems>(query, param);
con.Close();
return data;
}
}
}
}

View file

@ -0,0 +1,37 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Ombi.Store")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ombi.Store")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("92433867-2b7b-477b-a566-96c382427525")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersionAttribute("1.0.0.0")]

View file

@ -0,0 +1,119 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserRepository.cs
// Created By:
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Data;
using System.Threading.Tasks;
using Dapper;
using Ombi.Helpers;
using Ombi.Store.Models.Emby;
using Ombi.Store.Models.Plex;
namespace Ombi.Store.Repository
{
public class BaseExternalUserRepository<T> : BaseGenericRepository<T>, IExternalUserRepository<T> where T : Entity
{
public BaseExternalUserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config,cache)
{
DbConfig = config;
}
private ISqliteConfiguration DbConfig { get; }
private IDbConnection Db => DbConfig.DbConnection();
private string TableName
{
get
{
if (typeof(T) == typeof(PlexUsers))
{
return "PlexUsers";
}
if (typeof(T) == typeof(EmbyUsers))
{
return "EmbyUsers";
}
return string.Empty;
}
}
public T GetUser(string userGuid)
{
var sql = $@"SELECT * FROM {TableName}
WHERE PlexUserId = @UserGuid
COLLATE NOCASE";
return Db.QueryFirstOrDefault<T>(sql, new {UserGuid = userGuid});
}
public T GetUserByUsername(string username)
{
var sql = $@"SELECT * FROM {TableName}
WHERE Username = @UserName
COLLATE NOCASE";
return Db.QueryFirstOrDefault<T>(sql, new {UserName = username});
}
public async Task<T> GetUserAsync(string userguid)
{
var sql = $@"SELECT * FROM {TableName}
WHERE PlexUserId = @UserGuid
COLLATE NOCASE";
return await Db.QueryFirstOrDefaultAsync<T>(sql, new {UserGuid = userguid});
}
#region abstract implementation
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
[Obsolete]
public override T Get(string id)
{
throw new System.NotImplementedException();
}
[Obsolete]
public override Task<T> GetAsync(int id)
{
throw new System.NotImplementedException();
}
[Obsolete]
public override T Get(int id)
{
throw new System.NotImplementedException();
}
[Obsolete]
public override Task<T> GetAsync(string id)
{
throw new System.NotImplementedException();
}
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
#endregion
}
}

View file

@ -0,0 +1,361 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: BaseGenericRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using Dapper;
using Dapper.Contrib.Extensions;
using Mono.Data.Sqlite;
using NLog;
using Ombi.Helpers;
namespace Ombi.Store.Repository
{
public abstract class BaseGenericRepository<T> where T : class
{
private const string CorruptMessage =
"The database is corrupt, this could be due to the application exiting unexpectedly. See here to fix it: http://www.dosomethinghere.com/2013/02/20/fixing-the-sqlite-error-the-database-disk-image-is-malformed/";
protected BaseGenericRepository(ISqliteConfiguration config, ICacheProvider cache)
{
Config = config;
Cache = cache;
}
protected ICacheProvider Cache { get; }
protected ISqliteConfiguration Config { get; }
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
public abstract T Get(string id);
public abstract Task<T> GetAsync(int id);
public abstract T Get(int id);
public abstract Task<T> GetAsync(string id);
private IDbConnection Connection => Config.DbConnection();
public IEnumerable<T> Custom(Func<IDbConnection, IEnumerable<T>> func)
{
using (var cnn = Connection)
{
return func(cnn);
}
}
public T Custom(Func<IDbConnection, T> func)
{
using (var cnn = Connection)
{
return func(cnn);
}
}
public async Task<IEnumerable<T>> CustomAsync(Func<IDbConnection, Task<IEnumerable<T>>> func)
{
using (var cnn = Connection)
{
return await func(cnn);
}
}
public async Task<T> CustomAsync(Func<IDbConnection, Task<T>> func)
{
using (var cnn = Connection)
{
return await func(cnn);
}
}
public long Insert(T entity)
{
try
{
ResetCache();
using (var cnn = Config.DbConnection())
{
cnn.Open();
return cnn.Insert(entity);
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public void Delete(T entity)
{
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
db.Delete(entity);
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public async Task DeleteAsync(T entity)
{
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
await db.DeleteAsync(entity).ConfigureAwait(false);
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public bool Update(T entity)
{
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
return db.Update(entity);
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public async Task<bool> UpdateAsync(T entity)
{
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
return await db.UpdateAsync(entity).ConfigureAwait(false);
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public bool UpdateAll(IEnumerable<T> entity)
{
try
{
ResetCache();
var result = new HashSet<bool>();
using (var db = Config.DbConnection())
{
db.Open();
foreach (var e in entity)
{
result.Add(db.Update(e));
}
}
return result.All(x => true);
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public async Task<bool> UpdateAllAsync(IEnumerable<T> entity)
{
try
{
ResetCache();
var tasks = new List<Task<bool>>();
using (var db = Config.DbConnection())
{
db.Open();
foreach (var e in entity)
{
tasks.Add(db.UpdateAsync(e));
}
}
var result = await Task.WhenAll(tasks).ConfigureAwait(false);
return result.All(x => true);
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public async Task<int> InsertAsync(T entity)
{
try
{
ResetCache();
using (var cnn = Config.DbConnection())
{
cnn.Open();
return await cnn.InsertAsync(entity).ConfigureAwait(false);
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
private void ResetCache()
{
Cache.Remove("Get");
Cache.Remove("GetAll");
}
public IEnumerable<T> GetAll()
{
try
{
using (var db = Config.DbConnection())
{
db.Open();
var result = db.GetAll<T>();
return result;
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public async Task<IEnumerable<T>> GetAllAsync()
{
try
{
using (var db = Config.DbConnection())
{
db.Open();
var result = await db.GetAllAsync<T>().ConfigureAwait(false);
return result;
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public bool BatchInsert(IEnumerable<T> entities, string tableName)
{
// If we have nothing to update, then it didn't fail...
var enumerable = entities as T[] ?? entities.ToArray();
if (!enumerable.Any())
{
return true;
}
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
using (var tran = db.BeginTransaction())
{
var result = enumerable.Sum(e => db.Insert(e));
if (result != 0)
{
tran.Commit();
return true;
}
tran.Rollback();
return false;
}
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public void DeleteAll(string tableName)
{
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
db.Execute($"delete from {tableName}");
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
public async Task DeleteAllAsync(string tableName)
{
try
{
ResetCache();
using (var db = Config.DbConnection())
{
db.Open();
await db.ExecuteAsync($"delete from {tableName}");
}
}
catch (SqliteException e) when (e.ErrorCode == SQLiteErrorCode.Corrupt)
{
Log.Fatal(CorruptMessage);
throw;
}
}
}
}

View file

@ -0,0 +1,89 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: GenericRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
using Ombi.Helpers;
namespace Ombi.Store.Repository
{
public class GenericRepository<T> : BaseGenericRepository<T>, IRepository<T> where T : Entity
{
public GenericRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config, cache)
{
}
public override T Get(string id)
{
throw new NotSupportedException("Get(string) is not supported. Use Get(int)");
}
public override Task<T> GetAsync(string id)
{
throw new NotSupportedException("GetAsync(string) is not supported. Use GetAsync(int)");
}
public override T Get(int id)
{
var key = "Get" + id;
var item = Cache.GetOrSet(
key,
() =>
{
using (var db = Config.DbConnection())
{
db.Open();
return db.Get<T>(id);
}
});
return item;
}
public override async Task<T> GetAsync(int id)
{
var key = "Get" + id;
var item = await Cache.GetOrSetAsync(
key,
async () =>
{
using (var db = Config.DbConnection())
{
db.Open();
return await db.GetAsync<T>(id).ConfigureAwait(false);
}
});
return item;
}
}
}

View file

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
namespace Ombi.Store.Repository
{
public interface IExternalUserRepository<T> where T : Entity
{
T Get(string id);
T Get(int id);
Task<T> GetAsync(string id);
Task<T> GetAsync(int id);
T GetUser(string userGuid);
Task<T> GetUserAsync(string userguid);
T GetUserByUsername(string username);
IEnumerable<T> Custom(Func<IDbConnection, IEnumerable<T>> func);
long Insert(T entity);
void Delete(T entity);
IEnumerable<T> GetAll();
bool UpdateAll(IEnumerable<T> entity);
bool Update(T entity);
Task<IEnumerable<T>> GetAllAsync();
Task<bool> UpdateAsync(T users);
Task<int> InsertAsync(T users);
}
}

View file

@ -0,0 +1,94 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: IRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
namespace Ombi.Store.Repository
{
public interface IRepository<T>
{
/// <summary>
/// Inserts the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
long Insert(T entity);
Task<int> InsertAsync(T entity);
/// <summary>
/// Gets all.
/// </summary>
/// <returns></returns>
IEnumerable<T> GetAll();
Task<IEnumerable<T>> GetAllAsync();
/// <summary>
/// Gets the specified identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns></returns>
T Get(string id);
Task<T> GetAsync(string id);
T Get(int id);
Task<T> GetAsync(int id);
/// <summary>
/// Deletes the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
void Delete(T entity);
Task DeleteAsync(T entity);
/// <summary>
/// Updates the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
bool Update(T entity);
Task<bool> UpdateAsync(T entity);
/// <summary>
/// Updates all.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
bool UpdateAll(IEnumerable<T> entity);
Task<bool> UpdateAllAsync(IEnumerable<T> entity);
bool BatchInsert(IEnumerable<T> entities, string tableName);
IEnumerable<T> Custom(Func<IDbConnection, IEnumerable<T>> func);
Task<IEnumerable<T>> CustomAsync(Func<IDbConnection, Task<IEnumerable<T>>> func);
void DeleteAll(string tableName);
Task DeleteAllAsync(string tableName);
T Custom(Func<IDbConnection, T> func);
Task<T> CustomAsync(Func<IDbConnection, Task<T>> func);
}
}

View file

@ -0,0 +1,77 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: ISettingsRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Threading.Tasks;
using Ombi.Store.Models;
namespace Ombi.Store.Repository
{
public interface IRequestRepository
{
/// <summary>
/// Inserts the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
long Insert(RequestBlobs entity);
Task<int> InsertAsync(RequestBlobs entity);
/// <summary>
/// Gets all.
/// </summary>
/// <returns></returns>
IEnumerable<RequestBlobs> GetAll();
Task<IEnumerable<RequestBlobs>> GetAllAsync();
RequestBlobs Get(int id);
Task<RequestBlobs> GetAsync(int id);
/// <summary>
/// Deletes the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
bool Delete(RequestBlobs entity);
Task<bool> DeleteAsync(RequestBlobs entity);
bool DeleteAll(IEnumerable<RequestBlobs> entity);
Task<bool> DeleteAllAsync(IEnumerable<RequestBlobs> entity);
/// <summary>
/// Updates the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
bool Update(RequestBlobs entity);
Task<bool> UpdateAsync(RequestBlobs entity);
bool UpdateAll(IEnumerable<RequestBlobs> entity);
Task<bool> UpdateAllAsync(IEnumerable<RequestBlobs> entity);
}
}

View file

@ -0,0 +1,76 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: ISettingsRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Threading.Tasks;
using Ombi.Store.Models;
namespace Ombi.Store.Repository
{
public interface ISettingsRepository
{
/// <summary>
/// Inserts the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
long Insert(GlobalSettings entity);
Task<int> InsertAsync(GlobalSettings entity);
/// <summary>
/// Gets all.
/// </summary>
/// <returns></returns>
IEnumerable<GlobalSettings> GetAll();
Task<IEnumerable<GlobalSettings>> GetAllAsync();
/// <summary>
/// Gets the specified identifier.
/// </summary>
/// <param name="settingsName">Name of the settings.</param>
/// <returns></returns>
GlobalSettings Get(string settingsName);
Task<GlobalSettings> GetAsync(string settingsName);
/// <summary>
/// Deletes the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
Task<bool> DeleteAsync(GlobalSettings entity);
bool Delete(GlobalSettings entity);
/// <summary>
/// Updates the specified entity.
/// </summary>
/// <param name="entity">The entity.</param>
/// <returns></returns>
Task<bool> UpdateAsync(GlobalSettings entity);
bool Update(GlobalSettings entity);
}
}

View file

@ -0,0 +1,230 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: SettingsJsonRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
using Ombi.Helpers;
using Ombi.Store.Models;
namespace Ombi.Store.Repository
{
public class RequestJsonRepository : IRequestRepository
{
private ICacheProvider Cache { get; }
public RequestJsonRepository(ISqliteConfiguration config, ICacheProvider cacheProvider)
{
Db = config;
Cache = cacheProvider;
}
private ISqliteConfiguration Db { get; }
public long Insert(RequestBlobs entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
var id = con.Insert(entity);
return id;
}
}
public async Task<int> InsertAsync(RequestBlobs entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
var id = await con.InsertAsync(entity).ConfigureAwait(false);
return id;
}
}
public IEnumerable<RequestBlobs> GetAll()
{
var key = "GetAll";
var item = Cache.GetOrSet(key, () =>
{
using (var con = Db.DbConnection())
{
var page = con.GetAll<RequestBlobs>();
return page;
}
}, 5);
return item;
}
public async Task<IEnumerable<RequestBlobs>> GetAllAsync()
{
var key = "GetAll";
var item = await Cache.GetOrSetAsync(key, async() =>
{
using (var con = Db.DbConnection())
{
var page = await con.GetAllAsync<RequestBlobs>().ConfigureAwait(false);
return page;
}
}, 5);
return item;
}
public RequestBlobs Get(int id)
{
var key = "Get" + id;
var item = Cache.GetOrSet(key, () =>
{
using (var con = Db.DbConnection())
{
var page = con.Get<RequestBlobs>(id);
return page;
}
}, 5);
return item;
}
public async Task<RequestBlobs> GetAsync(int id)
{
var key = "Get" + id;
var item = await Cache.GetOrSetAsync(key, async () =>
{
using (var con = Db.DbConnection())
{
var page = await con.GetAsync<RequestBlobs>(id).ConfigureAwait(false);
return page;
}
}, 5);
return item;
}
public bool Delete(RequestBlobs entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return con.Delete(entity);
}
}
public async Task<bool> DeleteAsync(RequestBlobs entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return await con.DeleteAsync(entity).ConfigureAwait(false);
}
}
public async Task<bool> DeleteAllAsync(IEnumerable<RequestBlobs> entity)
{
ResetCache();
var tasks = new List<Task<bool>>();
using (var db = Db.DbConnection())
{
db.Open();
foreach (var e in entity)
{
tasks.Add(db.DeleteAsync(e));
}
}
var result = await Task.WhenAll(tasks).ConfigureAwait(false);
return result.All(x => true);
}
public bool Update(RequestBlobs entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return con.Update(entity);
}
}
public async Task<bool> UpdateAsync(RequestBlobs entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return await con.UpdateAsync(entity).ConfigureAwait(false);
}
}
private void ResetCache()
{
Cache.Remove("Get");
Cache.Remove("GetAll");
}
public bool UpdateAll(IEnumerable<RequestBlobs> entity)
{
ResetCache();
var result = new HashSet<bool>();
using (var db = Db.DbConnection())
{
db.Open();
foreach (var e in entity)
{
result.Add(db.Update(e));
}
}
return result.All(x => true);
}
public async Task<bool> UpdateAllAsync(IEnumerable<RequestBlobs> entity)
{
ResetCache();
var tasks = new List<Task<bool>>();
using (var db = Db.DbConnection())
{
db.Open();
foreach (var e in entity)
{
tasks.Add(db.UpdateAsync(e));
}
}
var result = await Task.WhenAll(tasks).ConfigureAwait(false);
return result.All(x => true);
}
public bool DeleteAll(IEnumerable<RequestBlobs> entity)
{
ResetCache();
var result = new HashSet<bool>();
using (var db = Db.DbConnection())
{
db.Open();
foreach (var e in entity)
{
result.Add(db.Delete(e));
}
}
return result.All(x => true);
}
}
}

View file

@ -0,0 +1,167 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: SettingsJsonRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
using Ombi.Helpers;
using Ombi.Store.Models;
namespace Ombi.Store.Repository
{
public class SettingsJsonRepository : ISettingsRepository
{
private ICacheProvider Cache { get; }
private string TypeName { get; }
public SettingsJsonRepository(ISqliteConfiguration config, ICacheProvider cacheProvider)
{
Db = config;
Cache = cacheProvider;
TypeName = typeof(SettingsJsonRepository).Name;
}
private ISqliteConfiguration Db { get; }
public long Insert(GlobalSettings entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return con.Insert(entity);
}
}
public async Task<int> InsertAsync(GlobalSettings entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return await con.InsertAsync(entity).ConfigureAwait(false);
}
}
public IEnumerable<GlobalSettings> GetAll()
{
var key = TypeName + "GetAll";
var item = Cache.GetOrSet(key, () =>
{
using (var con = Db.DbConnection())
{
var page = con.GetAll<GlobalSettings>();
return page;
}
}, 5);
return item;
}
public async Task<IEnumerable<GlobalSettings>> GetAllAsync()
{
var key = TypeName + "GetAll";
var item = await Cache.GetOrSetAsync(key, async() =>
{
using (var con = Db.DbConnection())
{
var page = await con.GetAllAsync<GlobalSettings>().ConfigureAwait(false);
return page;
}
}, 5);
return item;
}
public GlobalSettings Get(string pageName)
{
var key = pageName + "Get";
var item = Cache.GetOrSet(key, () =>
{
using (var con = Db.DbConnection())
{
var page = con.GetAll<GlobalSettings>().SingleOrDefault(x => x.SettingsName == pageName);
return page;
}
}, 5);
return item;
}
public async Task<GlobalSettings> GetAsync(string settingsName)
{
var key = settingsName + "Get";
var item = await Cache.GetOrSetAsync(key, async() =>
{
using (var con = Db.DbConnection())
{
var page = await con.GetAllAsync<GlobalSettings>().ConfigureAwait(false);
return page.SingleOrDefault(x => x.SettingsName == settingsName);
}
}, 5);
return item;
}
public async Task<bool> DeleteAsync(GlobalSettings entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return await con.DeleteAsync(entity).ConfigureAwait(false);
}
}
public async Task<bool> UpdateAsync(GlobalSettings entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return await con.UpdateAsync(entity).ConfigureAwait(false);
}
}
public bool Delete(GlobalSettings entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return con.Delete(entity);
}
}
public bool Update(GlobalSettings entity)
{
ResetCache();
using (var con = Db.DbConnection())
{
return con.Update(entity);
}
}
private void ResetCache()
{
Cache.Remove("Get");
Cache.Remove(TypeName + "GetAll");
}
}
}

View file

@ -0,0 +1,116 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserRepository.cs
// Created By:
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Dapper;
using Ombi.Helpers;
namespace Ombi.Store.Repository
{
public class UserRepository : BaseGenericRepository<UsersModel>, IUserRepository
{
public UserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config,cache)
{
DbConfig = config;
}
private ISqliteConfiguration DbConfig { get; }
private IDbConnection Db => DbConfig.DbConnection();
public UsersModel GetUser(string userGuid)
{
var sql = @"SELECT * FROM Users
WHERE Userguid = @UserGuid
COLLATE NOCASE";
return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserGuid = userGuid});
}
public UsersModel GetUserByUsername(string username)
{
var sql = @"SELECT * FROM Users
WHERE UserName = @UserName
COLLATE NOCASE";
return Db.QueryFirstOrDefault<UsersModel>(sql, new {UserName = username});
}
public async Task<UsersModel> GetUserAsync(string userguid)
{
var sql = @"SELECT * FROM Users
WHERE UserGuid = @UserGuid
COLLATE NOCASE";
return await Db.QueryFirstOrDefaultAsync<UsersModel>(sql, new {UserGuid = userguid});
}
#region abstract implementation
#pragma warning disable CS0809 // Obsolete member overrides non-obsolete member
[Obsolete]
public override UsersModel Get(string id)
{
throw new System.NotImplementedException();
}
[Obsolete]
public override Task<UsersModel> GetAsync(int id)
{
throw new System.NotImplementedException();
}
[Obsolete]
public override UsersModel Get(int id)
{
throw new System.NotImplementedException();
}
[Obsolete]
public override Task<UsersModel> GetAsync(string id)
{
throw new System.NotImplementedException();
}
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
#endregion
}
public interface IUserRepository
{
UsersModel GetUser(string userGuid);
UsersModel GetUserByUsername(string username);
Task<UsersModel> GetUserAsync(string userguid);
IEnumerable<UsersModel> Custom(Func<IDbConnection, IEnumerable<UsersModel>> func);
long Insert(UsersModel entity);
void Delete(UsersModel entity);
IEnumerable<UsersModel> GetAll();
bool UpdateAll(IEnumerable<UsersModel> entity);
bool Update(UsersModel entity);
}
}

View file

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Dapper.Contrib.Extensions;
using Newtonsoft.Json;
namespace Ombi.Store
{
[Table("Requested")]
public class RequestedModel : Entity
{
public RequestedModel()
{
RequestedUsers = new List<string>();
Episodes = new List<EpisodesModel>();
}
// ReSharper disable once IdentifierTypo
public int ProviderId { get; set; }
public string ImdbId { get; set; }
public string TvDbId { get; set; }
public string Overview { get; set; }
public string Title { get; set; }
public string PosterPath { get; set; }
public DateTime ReleaseDate { get; set; }
public RequestType Type { get; set; }
public string Status { get; set; }
public bool Approved { get; set; }
public DateTime RequestedDate { get; set; }
public bool Available { get; set; }
public IssueState Issues { get; set; }
public string OtherMessage { get; set; }
public string AdminNote { get; set; }
public int[] SeasonList { get; set; }
public int SeasonCount { get; set; }
public string SeasonsRequested { get; set; }
public string MusicBrainzId { get; set; }
public List<string> RequestedUsers { get; set; }
public string ArtistName { get; set; }
public string ArtistId { get; set; }
public int IssueId { get; set; }
public List<EpisodesModel> Episodes { get; set; }
public bool Denied { get; set; }
public string DeniedReason { get; set; }
/// <summary>
/// For TV Shows with a custom root folder
/// </summary>
/// <value>
/// The root folder selected.
/// </value>
public int RootFolderSelected { get; set; }
[JsonIgnore]
public List<string> AllUsers
{
get
{
var u = new List<string>();
if (RequestedUsers != null && RequestedUsers.Any())
{
u.AddRange(RequestedUsers);
}
return u;
}
}
[JsonIgnore]
public bool CanApprove => !Approved && !Available;
public string ReleaseId { get; set; }
public bool UserHasRequested(string username)
{
return AllUsers.Any(x => x.Equals(username, StringComparison.OrdinalIgnoreCase));
}
}
public enum RequestType
{
Movie,
TvShow,
Album
}
public static class RequestTypeDisplay
{
public static string GetString(this RequestType type)
{
switch (type)
{
case RequestType.Movie:
return "Movie";
case RequestType.TvShow:
return "TV Show";
case RequestType.Album:
return "Album";
default:
return string.Empty;
}
}
}
public enum IssueState
{
None = 99,
WrongAudio = 0,
NoSubtitles = 1,
WrongContent = 2,
PlaybackIssues = 3,
Other = 4, // Provide a message
}
public class EpisodesModel : IEquatable<EpisodesModel>
{
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
public bool Equals(EpisodesModel other)
{
// Check whether the compared object is null.
if (ReferenceEquals(other, null)) return false;
//Check whether the compared object references the same data.
if (ReferenceEquals(this, other)) return true;
//Check whether the properties are equal.
return SeasonNumber.Equals(other.SeasonNumber) && EpisodeNumber.Equals(other.EpisodeNumber);
}
public override int GetHashCode()
{
var hashSeason = SeasonNumber.GetHashCode();
var hashEp = EpisodeNumber.GetHashCode();
//Calculate the hash code.
return hashSeason + hashEp;
}
}
}

90
Old/Ombi.Store/Sql.Designer.cs generated Normal file
View file

@ -0,0 +1,90 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Ombi.Store {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Sql {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Sql() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ombi.Store.Sql", typeof(Sql).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to --Any DB changes need to be made in this file.
///
///CREATE TABLE IF NOT EXISTS Users
///(
/// Id INTEGER PRIMARY KEY AUTOINCREMENT,
/// UserGuid varchar(50) NOT NULL ,
/// UserName varchar(50) NOT NULL,
/// Salt BLOB NOT NULL,
/// Hash BLOB NOT NULL,
/// UserProperties BLOB,
/// Permissions INTEGER,
/// Features INTEGER,
/// Claims BLOB
///);
///
///CREATE TABLE IF NOT EXISTS UserLogins
///(
/// Id INTEGER PRIMARY KEY AUTOINCREMENT,
/// UserId varchar(50 [rest of string was truncated]&quot;;.
/// </summary>
internal static string SqlTables {
get {
return ResourceManager.GetString("SqlTables", resourceCulture);
}
}
}
}

124
Old/Ombi.Store/Sql.resx Normal file
View file

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="SqlTables" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>SqlTables.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
</root>

View file

@ -0,0 +1,222 @@
--Any DB changes need to be made in this file.
CREATE TABLE IF NOT EXISTS Users
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
UserGuid varchar(50) NOT NULL ,
UserName varchar(50) NOT NULL,
Salt BLOB NOT NULL,
Hash BLOB NOT NULL,
UserProperties BLOB,
Permissions INTEGER,
Features INTEGER,
Claims BLOB
);
CREATE TABLE IF NOT EXISTS UserLogins
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
UserId varchar(50) NOT NULL ,
Type INTEGER NOT NULL,
LastLoggedIn varchar(100) NOT NULL
);
CREATE INDEX IF NOT EXISTS UserLogins_UserId ON UserLogins (UserId);
CREATE TABLE IF NOT EXISTS GlobalSettings
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
SettingsName varchar(50) NOT NULL,
Content varchar(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS GlobalSettings_Id ON GlobalSettings (Id);
CREATE TABLE IF NOT EXISTS RequestBlobs
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
ProviderId INTEGER NOT NULL,
Type INTEGER NOT NULL,
Content BLOB NOT NULL,
MusicId TEXT
);
CREATE UNIQUE INDEX IF NOT EXISTS RequestBlobs_Id ON RequestBlobs (Id);
CREATE TABLE IF NOT EXISTS Logs
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Date varchar(100) NOT NULL,
Level varchar(100) NOT NULL,
Logger varchar(100) NOT NULL,
Message varchar(100) NOT NULL,
CallSite varchar(100) NOT NULL,
Exception varchar(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS Logs_Id ON Logs (Id);
CREATE TABLE IF NOT EXISTS Audit
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Date varchar(100) NOT NULL,
Username varchar(100) NOT NULL,
ChangeType varchar(100) NOT NULL,
OldValue varchar(100),
NewValue varchar(100)
);
CREATE UNIQUE INDEX IF NOT EXISTS Audit_Id ON Audit (Id);
CREATE TABLE IF NOT EXISTS DBInfo
(
SchemaVersion INTEGER
);
CREATE TABLE IF NOT EXISTS VersionInfo
(
Version INTEGER NOT NULL,
Description VARCHAR(100) NOT NULL
);
CREATE TABLE IF NOT EXISTS ScheduledJobs
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Name varchar(100) NOT NULL,
LastRun varchar(100) NOT NULL,
Running INTEGER
);
CREATE UNIQUE INDEX IF NOT EXISTS ScheduledJobs_Id ON ScheduledJobs (Id);
CREATE TABLE IF NOT EXISTS UsersToNotify
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Username varchar(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS UsersToNotify_Id ON UsersToNotify (Id);
CREATE TABLE IF NOT EXISTS IssueBlobs
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
RequestId INTEGER,
Type INTEGER NOT NULL,
Content BLOB NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS IssueBlobs_Id ON IssueBlobs (Id);
CREATE TABLE IF NOT EXISTS RequestLimit
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Username varchar(100) NOT NULL,
FirstRequestDate varchar(100) NOT NULL,
RequestCount INTEGER NOT NULL,
RequestType INTEGER NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS RequestLimit_Id ON RequestLimit (Id);
CREATE TABLE IF NOT EXISTS PlexUsers
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
PlexUserId varchar(100) NOT NULL,
UserAlias varchar(100) NOT NULL,
Permissions INTEGER,
Features INTEGER,
Username VARCHAR(100),
EmailAddress VARCHAR(100),
LoginId VARCHAR(100)
);
CREATE UNIQUE INDEX IF NOT EXISTS PlexUsers_Id ON PlexUsers (Id);
CREATE TABLE IF NOT EXISTS EmbyUsers
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
EmbyUserId varchar(100) NOT NULL,
UserAlias varchar(100) NOT NULL,
Permissions INTEGER,
Features INTEGER,
Username VARCHAR(100),
EmailAddress VARCHAR(100),
LoginId VARCHAR(100)
);
CREATE UNIQUE INDEX IF NOT EXISTS EmbyUsers_Id ON EmbyUsers (Id);
BEGIN;
CREATE TABLE IF NOT EXISTS PlexEpisodes
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
EpisodeTitle VARCHAR(100) NOT NULL,
ShowTitle VARCHAR(100) NOT NULL,
RatingKey VARCHAR(100) NOT NULL,
ProviderId VARCHAR(100) NOT NULL,
SeasonNumber INTEGER NOT NULL,
EpisodeNumber INTEGER NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS PlexEpisodes_Id ON PlexEpisodes (Id);
CREATE INDEX IF NOT EXISTS PlexEpisodes_ProviderId ON PlexEpisodes (ProviderId);
CREATE TABLE IF NOT EXISTS RequestFaultQueue
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
PrimaryIdentifier VARCHAR(100) NOT NULL,
Type INTEGER NOT NULL,
FaultType INTEGER NOT NULL,
Content BLOB NOT NULL,
LastRetry VARCHAR(100),
Description VARCHAR(100)
);
CREATE UNIQUE INDEX IF NOT EXISTS PlexUsers_Id ON PlexUsers (Id);
CREATE TABLE IF NOT EXISTS PlexContent
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Title VARCHAR(100) NOT NULL,
ReleaseYear VARCHAR(100) NOT NULL,
ProviderId VARCHAR(100) NOT NULL,
Url VARCHAR(100) NOT NULL,
Artist VARCHAR(100),
Seasons BLOB,
Type INTEGER NOT NULL,
ItemID VARCHAR(100) NOT NULL,
AddedAt VARCHAR(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS PlexContent_Id ON PlexContent (Id);
CREATE TABLE IF NOT EXISTS EmbyEpisodes
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
EpisodeTitle VARCHAR(100) NOT NULL,
ShowTitle VARCHAR(100) NOT NULL,
EmbyId VARCHAR(100) NOT NULL,
SeasonNumber INTEGER NOT NULL,
EpisodeNumber INTEGER NOT NULL,
ParentId VARCHAR(100) NOT NULL,
ProviderId VARCHAR(100) NOT NULL,
AddedAt VARCHAR(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS EmbyEpisodes_Id ON EmbyEpisodes (Id);
CREATE TABLE IF NOT EXISTS EmbyContent
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Title VARCHAR(100) NOT NULL,
PremierDate VARCHAR(100) NOT NULL,
EmbyId VARCHAR(100) NOT NULL,
ProviderId VARCHAR(100) NOT NULL,
Type INTEGER NOT NULL,
AddedAt VARCHAR(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS EmbyEpisodes_Id ON EmbyEpisodes (Id);
CREATE TABLE IF NOT EXISTS RecentlyAddedLog
(
Id INTEGER PRIMARY KEY AUTOINCREMENT,
ProviderId VARCHAR(100) NOT NULL,
AddedAt VARCHAR(100) NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS RecentlyAddedLog_Id ON RecentlyAddedLog (Id);
CREATE INDEX IF NOT EXISTS RecentlyAddedLog_ProviderId ON RecentlyAddedLog (ProviderId);
COMMIT;

View file

@ -0,0 +1,167 @@
#region Copyright
// ***********************************************************************
// Copyright (c) 2016 Jamie Rees
// File: TableCreation.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************
#endregion
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using Dapper;
using Dapper.Contrib.Extensions;
namespace Ombi.Store
{
public static class TableCreation
{
/// <summary>
/// Creates the tables located in the SqlTables.sql file.
/// </summary>
/// <param name="connection">The connection.</param>
public static void CreateTables(this IDbConnection connection)
{
connection.Open();
connection.Execute(Sql.SqlTables);
connection.Close();
}
public static void DropTable(this IDbConnection con, string tableName)
{
using (con)
{
con.Open();
var query = $"DROP TABLE IF EXISTS {tableName}";
con.Execute(query);
con.Close();
}
}
public static void AlterTable(this IDbConnection connection, string tableName, string alterType, string newColumn, bool allowNulls, string dataType)
{
connection.Open();
var result = connection.Query<TableInfo>($"PRAGMA table_info({tableName});");
if (result.Any(x => x.name.Equals(newColumn, StringComparison.CurrentCultureIgnoreCase)))
{
connection.Close();
return;
}
var query = $"ALTER TABLE {tableName} {alterType} {newColumn} {dataType}";
if (!allowNulls)
{
query = query + " NOT NULL";
}
connection.Execute(query);
connection.Close();
}
public static void Vacuum(this IDbConnection con)
{
using (con)
{
con.Open();
con.Query("VACUUM;");
}
}
public static DbInfo GetSchemaVersion(this IDbConnection con)
{
con.Open();
var result = con.Query<DbInfo>("SELECT * FROM DBInfo");
con.Close();
return result.FirstOrDefault();
}
public static void UpdateSchemaVersion(this IDbConnection con, int version)
{
con.Open();
con.Query($"UPDATE DBInfo SET SchemaVersion = {version}");
con.Close();
}
public static void CreateSchema(this IDbConnection con, int version)
{
con.Open();
con.Query($"INSERT INTO DBInfo (SchemaVersion) values ({version})");
con.Close();
}
public static IEnumerable<VersionInfo> GetVersionInfo(this IDbConnection con)
{
con.Open();
var result = con.Query<VersionInfo>("SELECT * FROM VersionInfo");
con.Close();
return result;
}
public static void AddVersionInfo(this IDbConnection con, VersionInfo ver)
{
con.Open();
con.Insert(ver);
con.Close();
}
[Table("VersionInfo")]
public class VersionInfo
{
public int Version { get; set; }
public string Description { get; set; }
}
[Table("DBInfo")]
public class DbInfo
{
public int SchemaVersion { get; set; }
}
[Table("sqlite_master")]
public class SqliteMasterTable
{
public string type { get; set; }
public string name { get; set; }
public string tbl_name { get; set; }
[Key]
public long rootpage { get; set; }
public string sql { get; set; }
}
[Table("table_info")]
public class TableInfo
{
public int cid { get; set; }
public string name { get; set; }
public int notnull { get; set; }
public string dflt_value { get; set; }
public int pk { get; set; }
}
}
}

View file

@ -0,0 +1,40 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserEntity.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using Dapper.Contrib.Extensions;
namespace Ombi.Store
{
public class UserEntity
{
[Key]
public int Id { get; set; }
public string UserName { get; set; }
public string UserGuid { get; set; }
}
}

View file

@ -0,0 +1,41 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserLogins.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
using Ombi.Helpers;
namespace Ombi.Store
{
[Table("UserLogins")]
public class UserLogins : Entity
{
public string UserId { get; set; }
public UserType Type { get; set; }
public DateTime LastLoggedIn { get; set; }
}
}

View file

@ -0,0 +1,77 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserRepository.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using System.Linq;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
using Ombi.Helpers;
using Ombi.Store.Repository;
namespace Ombi.Store
{
public class UserRepository<T> : BaseGenericRepository<T>, IRepository<T> where T : UserEntity
{
public UserRepository(ISqliteConfiguration config, ICacheProvider cache) : base(config, cache)
{
}
public override T Get(int id)
{
throw new NotSupportedException("Get(int) is not supported. Use Get(string)");
}
public override Task<T> GetAsync(int id)
{
throw new NotSupportedException("GetAsync(int) is not supported. Use GetAsync(string)");
}
public override T Get(string id)
{
using (var db = Config.DbConnection())
{
db.Open();
var result = db.GetAll<T>();
var selected = result.FirstOrDefault(x => x.UserGuid == id);
return selected;
}
}
public override async Task<T> GetAsync(string id)
{
using (var db = Config.DbConnection())
{
db.Open();
var result = await db.GetAllAsync<T>().ConfigureAwait(false);
var selected = result.FirstOrDefault(x => x.UserGuid == id);
return selected;
}
}
}
}

View file

@ -0,0 +1,44 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2016 Jamie Rees
// File: UserModel.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
using System;
using Dapper.Contrib.Extensions;
namespace Ombi.Store
{
[Table("Users")]
public class UsersModel : UserEntity
{
public byte[] Hash { get; set; }
public byte[] Salt { get; set; }
[Obsolete]
public byte[] Claims { get; set; }
public byte[] UserProperties { get; set; }
public int Permissions { get; set; }
public int Features { get; set; }
}
}

11
Old/Ombi.Store/app.config Normal file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Dapper" version="1.50.0-beta8" targetFramework="net45" />
<package id="Dapper.Contrib" version="1.50.0-beta8" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="NLog" version="4.3.6" targetFramework="net45" />
</packages>

BIN
Old/Ombi.Store/sqlite3.dll Normal file

Binary file not shown.