diff --git a/src/Ombi.Api.Lidarr/ILidarrApi.cs b/src/Ombi.Api.Lidarr/ILidarrApi.cs index 9e5e3b57e..16d841bcf 100644 --- a/src/Ombi.Api.Lidarr/ILidarrApi.cs +++ b/src/Ombi.Api.Lidarr/ILidarrApi.cs @@ -9,6 +9,7 @@ namespace Ombi.Api.Lidarr { Task> AlbumLookup(string searchTerm, string apiKey, string baseUrl); Task> ArtistLookup(string searchTerm, string apiKey, string baseUrl); + Task> Search(string searchTerm, string apiKey, string baseUrl); Task> GetProfiles(string apiKey, string baseUrl); Task> GetRootFolders(string apiKey, string baseUrl); Task GetArtist(int artistId, string apiKey, string baseUrl); diff --git a/src/Ombi.Api.Lidarr/LidarrApi.cs b/src/Ombi.Api.Lidarr/LidarrApi.cs index 5e8a81676..50c3d8b64 100644 --- a/src/Ombi.Api.Lidarr/LidarrApi.cs +++ b/src/Ombi.Api.Lidarr/LidarrApi.cs @@ -36,6 +36,15 @@ namespace Ombi.Api.Lidarr return _api.Request>(request); } + public async Task> Search(string searchTerm, string apiKey, string baseUrl) + { + var request = new Request($"{ApiVersion}/search", baseUrl, HttpMethod.Get); + request.AddQueryString("term", searchTerm); + + AddHeaders(request, apiKey); + return await _api.Request>(request); + } + public async Task> ArtistLookup(string searchTerm, string apiKey, string baseUrl) { var request = new Request($"{ApiVersion}/Artist/lookup", baseUrl, HttpMethod.Get); @@ -83,7 +92,7 @@ namespace Ombi.Api.Lidarr public Task GetAlbumsByArtist(string foreignArtistId) { - var request = new Request(string.Empty, $"https://api.lidarr.audio/api/v0.4/artist/{foreignArtistId}", + var request = new Request(string.Empty, $"https://api.lidarr.audio/api/v1/artist/{foreignArtistId}", HttpMethod.Get) {IgnoreBaseUrlAppend = true}; return _api.Request(request); } diff --git a/src/Ombi.Api.Lidarr/Models/AlbumLookup.cs b/src/Ombi.Api.Lidarr/Models/AlbumLookup.cs index 1e909cf4c..7de1c73ec 100644 --- a/src/Ombi.Api.Lidarr/Models/AlbumLookup.cs +++ b/src/Ombi.Api.Lidarr/Models/AlbumLookup.cs @@ -8,6 +8,7 @@ namespace Ombi.Api.Lidarr.Models public string title { get; set; } public string status { get; set; } public string artistType { get; set; } + public string overview { get; set; } public string disambiguation { get; set; } public List links { get; set; } public int artistId { get; set; } diff --git a/src/Ombi.Api.Lidarr/Models/ArtistAdd.cs b/src/Ombi.Api.Lidarr/Models/ArtistAdd.cs index 27ff3f733..c5fea92f3 100644 --- a/src/Ombi.Api.Lidarr/Models/ArtistAdd.cs +++ b/src/Ombi.Api.Lidarr/Models/ArtistAdd.cs @@ -32,21 +32,9 @@ namespace Ombi.Api.Lidarr.Models public class Addoptions { - public MonitorTypes monitor { get; set; } + public string monitor { get; set; } public bool monitored { get; set; } public bool searchForMissingAlbums { get; set; } // Only for Artists add public string[] AlbumsToMonitor { get; set; } // Uses the MusicBrainzAlbumId! } - - public enum MonitorTypes - { - All, - Future, - Missing, - Existing, - Latest, - First, - None, - Unknown - } } \ No newline at end of file diff --git a/src/Ombi.Api.Lidarr/Models/Search.cs b/src/Ombi.Api.Lidarr/Models/Search.cs new file mode 100644 index 000000000..b90593961 --- /dev/null +++ b/src/Ombi.Api.Lidarr/Models/Search.cs @@ -0,0 +1,13 @@ +using System; +using System.Net.Mime; + +namespace Ombi.Api.Lidarr.Models +{ + public class Search + { + public ArtistLookup artist { get; set; } + public AlbumLookup album { get; set; } + public string foreignId { get; set; } + public string id { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj b/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj index a25024b6c..b46dc3311 100644 --- a/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj +++ b/src/Ombi.Api.Mattermost/Ombi.Api.Mattermost.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Ombi.Core.Tests/Engine/V2/MusicSearchEngineV2Tests.cs b/src/Ombi.Core.Tests/Engine/V2/MusicSearchEngineV2Tests.cs index 50ab63346..783c04b76 100644 --- a/src/Ombi.Core.Tests/Engine/V2/MusicSearchEngineV2Tests.cs +++ b/src/Ombi.Core.Tests/Engine/V2/MusicSearchEngineV2Tests.cs @@ -5,12 +5,10 @@ using System.Threading.Tasks; using System.Linq; using System.Threading; using AutoFixture; -using Hqub.MusicBrainz.API.Entities; using Moq; using NUnit.Framework; using Ombi.Api.Lidarr; using Ombi.Api.Lidarr.Models; -using Ombi.Api.MusicBrainz; using Ombi.Core.Engine.V2; using Ombi.Core.Models.Requests; using Ombi.Core.Models.Search.V2.Music; @@ -22,7 +20,6 @@ using Ombi.Settings.Settings.Models.External; using Ombi.Store.Entities; using Ombi.Store.Repository; using Ombi.Test.Common; -using Artist = Hqub.MusicBrainz.API.Entities.Artist; namespace Ombi.Core.Tests.Engine.V2 { @@ -32,7 +29,6 @@ namespace Ombi.Core.Tests.Engine.V2 private MusicSearchEngineV2 _engine; - private Mock _musicApi; private Mock _lidarrApi; private Mock> _lidarrSettings; private Fixture F; @@ -52,118 +48,14 @@ namespace Ombi.Core.Tests.Engine.V2 var cache = new Mock(); var ombiSettings = new Mock>(); var requestSub = new Mock>(); - _musicApi = new Mock(); _lidarrSettings = new Mock>(); _lidarrApi = new Mock(); _lidarrSettings.Setup(x => x.GetSettingsAsync()).ReturnsAsync(new LidarrSettings()); _engine = new MusicSearchEngineV2(principle.Object, requestService.Object, ruleEval.Object, - um.Object, cache.Object, ombiSettings.Object, requestSub.Object, _musicApi.Object, + um.Object, cache.Object, ombiSettings.Object, requestSub.Object, _lidarrSettings.Object, _lidarrApi.Object); } - - [Test] - public async Task GetBasicArtistInformation_SingleArtist_Test() - { - _musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(F.Create()); - - var result = await _engine.GetArtistInformation("pretend-artist-id"); - - Assert.That(result, Is.Not.Null); - Assert.That(result.ReleaseGroups.Any(), Is.True, "Release Groups are null"); - Assert.That(result.Members.Any(), Is.False, "Members somehow populated?"); - } - - [Test] - public async Task GetBasicArtistInformation_Group_Test() - { - var musicReturnVal = F.Build().With(x => x.Relations, new List - { - new Relation - { - TypeId = RelationLinks.BandMember, - Artist = new Artist - { - Name = "Mr Artist" - }, - Attributes = new []{"a nobody"}, - Begin = "1992", - End = "2019", - Ended = true - }, - new Relation - { - TypeId = RelationLinks.BandMember, - Artist = new Artist - { - Name = "Mr Artist2" - }, - Attributes = new []{"a nobody2"}, - Begin = "1993", - } - }); - _musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(musicReturnVal.Create()); - - var result = await _engine.GetArtistInformation("pretend-artist-id"); - - Assert.That(result, Is.Not.Null); - Assert.That(result.ReleaseGroups.Any(), Is.True, "Release Groups are null"); - Assert.That(result.Members.Any(), Is.True, "Members IS NULL!"); - - Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").End, Is.EqualTo("2019")); - Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").Attributes.Length, Is.EqualTo(1)); - Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").IsCurrentMember, Is.EqualTo(false)); - Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist").Start, Is.EqualTo("1992")); - - Assert.That(result.Members.FirstOrDefault(x => x.Name == "Mr Artist2").IsCurrentMember, Is.EqualTo(true)); - } - - [TestCaseSource(nameof(LinksData))] - public async Task GetBasicArtistInformation_Links_Test(string url, string typeId, Func func) - { - var musicReturnVal = F.Build().With(x => x.Relations, new List - { - new Relation - { - TypeId = typeId, - Url = new Url - { - Resource = url - } - }, - - }); - _musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(musicReturnVal.Create()); - - var result = await _engine.GetArtistInformation("pretend-artist-id"); - - Assert.That(result, Is.Not.Null); - return func(result); - } - - private static IEnumerable LinksData - { - get - { - yield return new TestCaseData("twitter.com", RelationLinks.SocialNetwork, new Func(artist => artist.Links.Twitter)).Returns("twitter.com").SetName("ArtistInformation_Links_Twitter"); - yield return new TestCaseData("allmusic", RelationLinks.AllMusic, new Func(artist => artist.Links.AllMusic)).Returns("allmusic").SetName("ArtistInformation_Links_AllMusic"); - yield return new TestCaseData("bbcmusic", RelationLinks.BbcMusic, new Func(artist => artist.Links.BbcMusic)).Returns("bbcmusic").SetName("ArtistInformation_Links_BbcMusic"); - yield return new TestCaseData("discogs", RelationLinks.Discogs, new Func(artist => artist.Links.Discogs)).Returns("discogs").SetName("ArtistInformation_Links_Discogs"); - yield return new TestCaseData("homepage", RelationLinks.Homepage, new Func(artist => artist.Links.HomePage)).Returns("homepage").SetName("ArtistInformation_Links_Homepage"); - yield return new TestCaseData("imdb", RelationLinks.Imdb, new Func(artist => artist.Links.Imdb)).Returns("imdb").SetName("ArtistInformation_Links_Imdb"); - yield return new TestCaseData("lastfm", RelationLinks.LastFm, new Func(artist => artist.Links.LastFm)).Returns("lastfm").SetName("ArtistInformation_Links_LastFm"); - yield return new TestCaseData("myspace", RelationLinks.MySpace, new Func(artist => artist.Links.MySpace)).Returns("myspace").SetName("ArtistInformation_Links_MySpace"); - yield return new TestCaseData("onlinecommunity", RelationLinks.OnlineCommunity, new Func(artist => artist.Links.OnlineCommunity)).Returns("onlinecommunity").SetName("ArtistInformation_Links_OnlineCommunity"); - yield return new TestCaseData("www.facebook.com", RelationLinks.SocialNetwork, new Func(artist => artist.Links.Facebook)).Returns("www.facebook.com").SetName("ArtistInformation_Links_Facebook"); - yield return new TestCaseData("www.instagram.com", RelationLinks.SocialNetwork, new Func(artist => artist.Links.Instagram)).Returns("www.instagram.com").SetName("ArtistInformation_Links_insta"); - yield return new TestCaseData("www.vk.com", RelationLinks.SocialNetwork, new Func(artist => artist.Links.Vk)).Returns("www.vk.com").SetName("ArtistInformation_Links_vk"); - yield return new TestCaseData("app.spotify.com", RelationLinks.Streams, new Func(artist => artist.Links.Spotify)).Returns("app.spotify.com").SetName("ArtistInformation_Links_Spotify"); - yield return new TestCaseData("deezer.com", RelationLinks.Streams, new Func(artist => artist.Links.Deezer)).Returns("deezer.com").SetName("ArtistInformation_Links_Deezer"); - yield return new TestCaseData("play.google.com", RelationLinks.Download, new Func(artist => artist.Links.Google)).Returns("play.google.com").SetName("ArtistInformation_Links_Google"); - yield return new TestCaseData("itunes.apple.com", RelationLinks.Download, new Func(artist => artist.Links.Apple)).Returns("itunes.apple.com").SetName("ArtistInformation_Links_Apple"); - } - } - [Test] public async Task GetArtistInformation_WithPosters() { @@ -200,7 +92,6 @@ namespace Ombi.Core.Tests.Engine.V2 }, } }); - _musicApi.Setup(x => x.GetArtistInformation("pretend-artist-id")).ReturnsAsync(F.Create()); var result = await _engine.GetArtistInformation("pretend-artist-id"); diff --git a/src/Ombi.Core/Engine/IMusicRequestEngine.cs b/src/Ombi.Core/Engine/IMusicRequestEngine.cs index fcdb06496..adb0cd3ad 100644 --- a/src/Ombi.Core/Engine/IMusicRequestEngine.cs +++ b/src/Ombi.Core/Engine/IMusicRequestEngine.cs @@ -10,19 +10,24 @@ namespace Ombi.Core.Engine { public interface IMusicRequestEngine { - TaskApproveAlbum(AlbumRequest request); + TaskApproveAlbum(MusicRequests request); Task ApproveAlbumById(int requestId); Task DenyAlbumById(int modelId, string reason); - Task> GetRequests(); - Task> GetRequests(int count, int position, OrderFilterModel orderFilter); + Task> GetRequests(); + Task> GetRequests(int count, int position, OrderFilterModel orderFilter); Task GetTotal(); Task MarkAvailable(int modelId); Task MarkUnavailable(int modelId); Task RemoveAlbumRequest(int requestId); Task RequestAlbum(MusicAlbumRequestViewModel model); - Task> SearchAlbumRequest(string search); + Task RequestArtist(MusicArtistRequestViewModel model); + Task> SearchAlbumRequest(string search); Task UserHasRequest(string userId); Task> GetRequestsByStatus(int count, int position, string sort, string sortOrder, RequestStatus available); Task> GetRequests(int count, int position, string sort, string sortOrder); + + Task GetRemainingRequests(OmbiUser user = null); + Task> GetRequestsByStatus(int count, int position, string sort, string sortOrder, RequestStatus available); + Task> GetRequests(int count, int position, string sort, string sortOrder); } } \ No newline at end of file diff --git a/src/Ombi.Core/Engine/Interfaces/IMusicSearchEngineV2.cs b/src/Ombi.Core/Engine/Interfaces/IMusicSearchEngineV2.cs index efd42dc68..847dedc2c 100644 --- a/src/Ombi.Core/Engine/Interfaces/IMusicSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/Interfaces/IMusicSearchEngineV2.cs @@ -9,6 +9,6 @@ namespace Ombi.Core.Engine.Interfaces Task GetArtistInformation(string artistId); Task GetArtistInformationByRequestId(int requestId); Task GetReleaseGroupArt(string musicBrainzId, CancellationToken token); - Task GetAlbum(string albumId); + Task GetAlbumInformation(string albumId); } } \ No newline at end of file diff --git a/src/Ombi.Core/Engine/MusicRequestEngine.cs b/src/Ombi.Core/Engine/MusicRequestEngine.cs index b9aa183d2..8e6b5dfb5 100644 --- a/src/Ombi.Core/Engine/MusicRequestEngine.cs +++ b/src/Ombi.Core/Engine/MusicRequestEngine.cs @@ -73,7 +73,7 @@ namespace Ombi.Core.Engine var userDetails = await GetUser(); - var requestModel = new AlbumRequest + var requestModel = new MusicRequests { ForeignAlbumId = model.ForeignAlbumId, ArtistName = album.artist?.artistName, @@ -85,8 +85,10 @@ namespace Ombi.Core.Engine Title = album.title, Disk = album.images?.FirstOrDefault(x => x.coverType.Equals("disc"))?.url, Cover = album.images?.FirstOrDefault(x => x.coverType.Equals("cover"))?.url, - ForeignArtistId = album?.artist?.foreignArtistId ?? string.Empty, // This needs to be populated to send to Lidarr for new requests - RequestedByAlias = model.RequestedByAlias + ForeignArtistId = album.artist?.foreignArtistId, + RequestedByAlias = model.RequestedByAlias, + Monitor = model.Monitor, + SearchForMissingAlbums = model.SearchForMissingAlbums }; if (requestModel.Cover.IsNullOrEmpty()) { @@ -128,6 +130,58 @@ namespace Ombi.Core.Engine return await AddAlbumRequest(requestModel); } + public async Task RequestArtist(MusicArtistRequestViewModel model) + { + var s = await _lidarrSettings.GetSettingsAsync(); + var artist = await _lidarrApi.GetArtistByForeignId(model.ForeignArtistId, s.ApiKey, s.FullUri); + var userDetails = await GetUser(); + var requestModel = new MusicRequests + { + ForeignArtistId = model.ForeignArtistId, + Monitored = model.Monitored, + Title = artist.artistName, + ArtistName = artist.artistName, + RequestedDate = DateTime.Now, + RequestType = RequestType.Artist, + RequestedUserId = userDetails.Id, + Monitor = model.Monitor, + SearchForMissingAlbums = model.SearchForMissingAlbums + }; + + var ruleResults = (await RunRequestRules(requestModel)).ToList(); + if (ruleResults.Any(x => !x.Success)) + { + return new RequestEngineResult + { + ErrorMessage = ruleResults.FirstOrDefault(x => x.Message.HasValue()).Message + }; + } + if (requestModel.Approved) // The rules have auto approved this + { + var requestEngineResult = await AddArtistRequest(requestModel); + if (requestEngineResult.Result) + { + var result = await ApproveArtist(requestModel); + if (result.IsError) + { + Logger.LogWarning("Tried auto sending Album but failed. Message: {0}", result.Message); + return new RequestEngineResult + { + Message = result.Message, + ErrorMessage = result.Message, + Result = false + }; + } + + return requestEngineResult; + } + + // If there are no providers then it's successful but album has not been sent + } + + return await AddArtistRequest(requestModel); + } + /// /// Gets the requests. /// @@ -135,11 +189,11 @@ namespace Ombi.Core.Engine /// The position. /// The order/filter type. /// - public async Task> GetRequests(int count, int position, + public async Task> GetRequests(int count, int position, OrderFilterModel orderFilter) { var shouldHide = await HideFromOtherUsers(); - IQueryable allRequests; + IQueryable allRequests; if (shouldHide.Hide) { allRequests = @@ -193,14 +247,86 @@ namespace Ombi.Core.Engine { await CheckForSubscription(shouldHide, x); }); - return new RequestsViewModel + return new RequestsViewModel { Collection = requests, Total = total }; } - private IQueryable OrderAlbums(IQueryable allRequests, OrderType type) + /// + /// Gets the requests. + /// + /// The count. + /// The position. + /// The order/filter type. + /// + public async Task> GetRequestArtist(int count, int position, + OrderFilterModel orderFilter) + { + var shouldHide = await HideFromOtherUsers(); + IQueryable allRequests; + if (shouldHide.Hide) + { + allRequests = + MusicRepository.GetWithUser(shouldHide + .UserId); //.Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync(); + } + else + { + allRequests = + MusicRepository + .GetWithUser(); //.Skip(position).Take(count).OrderByDescending(x => x.ReleaseDate).ToListAsync(); + } + + switch (orderFilter.AvailabilityFilter) + { + case FilterType.None: + break; + case FilterType.Available: + allRequests = allRequests.Where(x => x.Available); + break; + case FilterType.NotAvailable: + allRequests = allRequests.Where(x => !x.Available); + break; + default: + throw new ArgumentOutOfRangeException(); + } + + switch (orderFilter.StatusFilter) + { + case FilterType.None: + break; + case FilterType.Approved: + allRequests = allRequests.Where(x => x.Approved); + break; + case FilterType.Processing: + allRequests = allRequests.Where(x => x.Approved && !x.Available); + break; + case FilterType.PendingApproval: + allRequests = allRequests.Where(x => !x.Approved && !x.Available && !(x.Denied ?? false)); + break; + default: + throw new ArgumentOutOfRangeException(); + } + + var total = allRequests.Count(); + + var requests = await (OrderAlbums(allRequests, orderFilter.OrderType)).Skip(position).Take(count) + .ToListAsync(); + + requests.ForEach(async x => + { + await CheckForSubscription(shouldHide, x); + }); + return new RequestsViewModel + { + Collection = requests, + Total = total + }; + } + + private IQueryable OrderAlbums(IQueryable allRequests, OrderType type) { switch (type) { @@ -234,10 +360,10 @@ namespace Ombi.Core.Engine /// Gets the requests. /// /// - public async Task> GetRequests() + public async Task> GetRequests() { var shouldHide = await HideFromOtherUsers(); - List allRequests; + List allRequests; if (shouldHide.Hide) { allRequests = await MusicRepository.GetWithUser(shouldHide.UserId).ToListAsync(); @@ -254,8 +380,28 @@ namespace Ombi.Core.Engine return allRequests; } + public async Task> GetRequestsArtist() + { + var shouldHide = await HideFromOtherUsers(); + List allRequests; + if (shouldHide.Hide) + { + allRequests = await MusicRepository.GetWithUser(shouldHide.UserId).ToListAsync(); + } + else + { + allRequests = await MusicRepository.GetWithUser().ToListAsync(); + } + + allRequests.ForEach(async x => + { + await CheckForArtistSubscription(shouldHide, x); + }); + return allRequests; + } + - private async Task CheckForSubscription(HideResult shouldHide, List albumRequests) + private async Task CheckForSubscription(HideResult shouldHide, List albumRequests) { var requestIds = albumRequests.Select(x => x.Id); var sub = await _subscriptionRepository.GetAll().Where(s => @@ -276,7 +422,22 @@ namespace Ombi.Core.Engine } } - private async Task CheckForSubscription(HideResult shouldHide, AlbumRequest x) + private async Task CheckForArtistSubscription(HideResult shouldHide, MusicRequests artistRequest) + { + if (shouldHide.UserId == artistRequest.RequestedUserId) + { + artistRequest.ShowSubscribe = false; + } + else + { + artistRequest.ShowSubscribe = true; + var sub = await _subscriptionRepository.GetAll().FirstOrDefaultAsync(s => + s.UserId == shouldHide.UserId && s.RequestId == artistRequest.Id && s.RequestType == RequestType.Artist); + artistRequest.Subscribed = sub != null; + } + } + + private async Task CheckForSubscription(HideResult shouldHide, MusicRequests x) { if (shouldHide.UserId == x.RequestedUserId) { @@ -296,10 +457,10 @@ namespace Ombi.Core.Engine /// /// The search. /// - public async Task> SearchAlbumRequest(string search) + public async Task> SearchAlbumRequest(string search) { var shouldHide = await HideFromOtherUsers(); - List allRequests; + List allRequests; if (shouldHide.Hide) { allRequests = await MusicRepository.GetWithUser(shouldHide.UserId).ToListAsync(); @@ -346,7 +507,7 @@ namespace Ombi.Core.Engine }; } - public async Task ApproveAlbum(AlbumRequest request) + public async Task ApproveAlbum(MusicRequests request) { if (request == null) { @@ -370,7 +531,60 @@ namespace Ombi.Core.Engine if (request.Approved) { - var result = await _musicSender.Send(request); + var result = await _musicSender.SendAlbum(request); + if (result.Success && result.Sent) + { + return new RequestEngineResult + { + Result = true + }; + } + + if (!result.Success) + { + Logger.LogWarning("Tried auto sending album but failed. Message: {0}", result.Message); + return new RequestEngineResult + { + Message = result.Message, + ErrorMessage = result.Message, + Result = false + }; + } + + // If there are no providers then it's successful but movie has not been sent + } + + return new RequestEngineResult + { + Result = true + }; + } + + public async Task ApproveArtist(MusicRequests request) + { + if (request == null) + { + return new RequestEngineResult + { + ErrorMessage = "Request does not exist" + }; + } + + request.MarkedAsApproved = DateTime.Now; + request.Approved = true; + request.Denied = false; + await MusicRepository.Update(request); + + + var canNotify = await RunSpecificRule(request, SpecificRules.CanSendNotification, string.Empty); + if (canNotify.Success) + { + await NotificationHelper.Notify(request, NotificationType.RequestApproved); + } + + if (request.Approved) + { + var result = await _musicSender.SendArtist(request); if (result.Success && result.Sent) { return new RequestEngineResult @@ -469,7 +683,7 @@ namespace Ombi.Core.Engine }; } - private async Task AddAlbumRequest(AlbumRequest model) + private async Task AddAlbumRequest(MusicRequests model) { await MusicRepository.Add(model); @@ -490,10 +704,32 @@ namespace Ombi.Core.Engine return new RequestEngineResult { Result = true, Message = $"{model.Title} has been successfully added!", RequestId = model.Id }; } - public async Task> GetRequestsByStatus(int count, int position, string sortProperty, string sortOrder, RequestStatus status) + private async Task AddArtistRequest(MusicRequests model) + { + // Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(MusicRepository)); + await MusicRepository.Add(model); + + var result = await RunSpecificRule(model, SpecificRules.CanSendNotification, string.Empty); + if (result.Success) + { + await NotificationHelper.NewRequest(model); + } + + await _requestLog.Add(new RequestLog + { + UserId = (await GetUser()).Id, + RequestDate = DateTime.UtcNow, + RequestId = model.Id, + RequestType = RequestType.Artist, + }); + + return new RequestEngineResult { Result = true, Message = $"{model.Title} has been successfully added!", RequestId = model.Id }; + } + + public async Task> GetRequestsByStatus(int count, int position, string sortProperty, string sortOrder, RequestStatus status) { var shouldHide = await HideFromOtherUsers(); - IQueryable allRequests; + IQueryable allRequests; if (shouldHide.Hide) { allRequests = @@ -525,12 +761,12 @@ namespace Ombi.Core.Engine break; } - var prop = TypeDescriptor.GetProperties(typeof(AlbumRequest)).Find(sortProperty, true); + var prop = TypeDescriptor.GetProperties(typeof(MusicRequests)).Find(sortProperty, true); if (sortProperty.Contains('.')) { // This is a navigation property currently not supported - prop = TypeDescriptor.GetProperties(typeof(AlbumRequest)).Find("RequestedDate", true); + prop = TypeDescriptor.GetProperties(typeof(MusicRequests)).Find("RequestedDate", true); //var properties = sortProperty.Split(new []{'.'}, StringSplitOptions.RemoveEmptyEntries); //var firstProp = TypeDescriptor.GetProperties(typeof(MovieRequests)).Find(properties[0], true); //var propType = firstProp.PropertyType; @@ -545,17 +781,17 @@ namespace Ombi.Core.Engine requests = requests.Skip(position).Take(count).ToList(); await CheckForSubscription(shouldHide, requests); - return new RequestsViewModel + return new RequestsViewModel { Collection = requests, Total = total }; } - public async Task> GetRequests(int count, int position, string sortProperty, string sortOrder) + public async Task> GetRequests(int count, int position, string sortProperty, string sortOrder) { var shouldHide = await HideFromOtherUsers(); - IQueryable allRequests; + IQueryable allRequests; if (shouldHide.Hide) { allRequests = @@ -589,7 +825,7 @@ namespace Ombi.Core.Engine requests = requests.Skip(position).Take(count).ToList(); await CheckForSubscription(shouldHide, requests); - return new RequestsViewModel + return new RequestsViewModel { Collection = requests, Total = total diff --git a/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs b/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs index fc2595676..8ddb8c6e0 100644 --- a/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs +++ b/src/Ombi.Core/Engine/V2/MultiSearchEngine.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Security.Principal; using System.Threading; using System.Threading.Tasks; -using Ombi.Api.MusicBrainz; using Ombi.Api.TheMovieDb; using Ombi.Api.TheMovieDb.Models; +using Ombi.Api.Lidarr; using Ombi.Core.Authentication; using Ombi.Core.Models.Requests; using Ombi.Core.Models.Search.V2; @@ -23,17 +23,18 @@ namespace Ombi.Core.Engine.V2 { public MultiSearchEngine(IPrincipal identity, IRequestServiceMain requestService, IRuleEvaluator rules, OmbiUserManager um, ICacheService cache, ISettingsService ombiSettings, IRepository sub, - IMovieDbApi movieDbApi, ISettingsService lidarrSettings, IMusicBrainzApi musicApi) + IMovieDbApi movieDbApi, ISettingsService lidarrSettings, ILidarrApi lidarrApi) : base(identity, requestService, rules, um, cache, ombiSettings, sub) { _movieDbApi = movieDbApi; _lidarrSettings = lidarrSettings; - _musicApi = musicApi; + _lidarrApi = lidarrApi; } private readonly IMovieDbApi _movieDbApi; private readonly ISettingsService _lidarrSettings; - private readonly IMusicBrainzApi _musicApi; + + private readonly ILidarrApi _lidarrApi; private bool _demo = DemoSingleton.Instance.Demo; @@ -43,72 +44,92 @@ namespace Ombi.Core.Engine.V2 var lang = await DefaultLanguageCode(null); var model = new List(); - var movieDbData = (await _movieDbApi.MultiSearch(searchTerm, lang, cancellationToken)).results; - var lidarrSettings = await _lidarrSettings.GetSettingsAsync(); if (lidarrSettings.Enabled && filter.Music) { - var artistResult = await _musicApi.SearchArtist(searchTerm); - foreach (var artist in artistResult) + var lidarSearchResult = await _lidarrApi.Search(searchTerm, lidarrSettings.ApiKey, lidarrSettings.FullUri); + foreach (var search_result in lidarSearchResult) { - model.Add(new MultiSearchResult + if (search_result.artist != null) { - MediaType = "Artist", - Title = artist.Name, - Id = artist.Id - }); + model.Add(new MultiSearchResult + { + MediaType = "Artist", + Title = search_result.artist.artistName, + Id = search_result.artist.foreignArtistId, + Poster = search_result.artist.remotePoster, + Monitored = search_result.artist.monitored + + }); + } else if (search_result.album != null) + { + model.Add(new MultiSearchResult + { + MediaType = "Album", + Title = search_result.album.title, + Id = search_result.album.foreignAlbumId, + Poster = search_result.album.remoteCover, + Monitored = search_result.album.monitored + }); + } + } } - foreach (var multiSearch in movieDbData) + if (filter.Movies || filter.TvShows) { + var movieDbData = (await _movieDbApi.MultiSearch(searchTerm, lang, cancellationToken)).results; - if (DemoCheck(multiSearch.title) || DemoCheck(multiSearch.name)) + foreach (var multiSearch in movieDbData) { - continue; - } - var result = new MultiSearchResult - { - MediaType = multiSearch.media_type, - Poster = multiSearch.poster_path, - Overview = multiSearch.overview - }; - - if (multiSearch.media_type.Equals("movie", StringComparison.InvariantCultureIgnoreCase) && filter.Movies) - { - if (multiSearch.release_date.HasValue() && DateTime.TryParse(multiSearch.release_date, out var releaseDate)) + if (DemoCheck(multiSearch.title) || DemoCheck(multiSearch.name)) { - result.Title = $"{multiSearch.title} ({releaseDate.Year})"; + continue; } - else - { - result.Title = multiSearch.title; - } - } - else if (multiSearch.media_type.Equals("tv", StringComparison.InvariantCultureIgnoreCase) && filter.TvShows) - { - if (multiSearch.release_date.HasValue() && DateTime.TryParse(multiSearch.release_date, out var releaseDate)) + var result = new MultiSearchResult { - result.Title = $"{multiSearch.name} ({releaseDate.Year})"; + MediaType = multiSearch.media_type, + Poster = multiSearch.poster_path, + Overview = multiSearch.overview + }; + + if (multiSearch.media_type.Equals("movie", StringComparison.InvariantCultureIgnoreCase) && filter.Movies) + { + if (multiSearch.release_date.HasValue() && DateTime.TryParse(multiSearch.release_date, out var releaseDate)) + { + result.Title = $"{multiSearch.title} ({releaseDate.Year})"; + } + else + { + result.Title = multiSearch.title; + } } - else + + else if (multiSearch.media_type.Equals("tv", StringComparison.InvariantCultureIgnoreCase) && filter.TvShows) + { + if (multiSearch.release_date.HasValue() && DateTime.TryParse(multiSearch.release_date, out var releaseDate)) + { + result.Title = $"{multiSearch.name} ({releaseDate.Year})"; + } + else + { + result.Title = multiSearch.name; + } + } + else if (multiSearch.media_type.Equals("person", StringComparison.InvariantCultureIgnoreCase) && filter.People) { result.Title = multiSearch.name; } - } - else if (multiSearch.media_type.Equals("person", StringComparison.InvariantCultureIgnoreCase) && filter.People) - { - result.Title = multiSearch.name; - } - else - { - continue; - } + else + { + continue; + } - result.Id = multiSearch.id.ToString(); - model.Add(result); + result.Id = multiSearch.id.ToString(); + model.Add(result); + } } return model; diff --git a/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs b/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs index b7d9575db..e02fbe11b 100644 --- a/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs +++ b/src/Ombi.Core/Engine/V2/MusicSearchEngineV2.cs @@ -8,7 +8,6 @@ using System.Threading.Tasks; using Newtonsoft.Json; using Ombi.Api.Lidarr; using Ombi.Api.Lidarr.Models; -using Ombi.Api.MusicBrainz; using Ombi.Core.Authentication; using Ombi.Core.Engine.Interfaces; using Ombi.Core.Models.Requests; @@ -20,98 +19,108 @@ using Ombi.Settings.Settings.Models; using Ombi.Settings.Settings.Models.External; using Ombi.Store.Entities; using Ombi.Store.Repository; -using Artist = Hqub.MusicBrainz.API.Entities.Artist; using ReleaseGroup = Ombi.Core.Models.Search.V2.Music.ReleaseGroup; namespace Ombi.Core.Engine.V2 { public class MusicSearchEngineV2 : BaseMediaEngine, IMusicSearchEngineV2 { - private readonly IMusicBrainzApi _musicBrainzApi; private readonly ISettingsService _lidarrSettings; private readonly ILidarrApi _lidarrApi; public MusicSearchEngineV2(IPrincipal identity, IRequestServiceMain requestService, IRuleEvaluator rules, OmbiUserManager um, ICacheService cache, ISettingsService ombiSettings, - IRepository sub, IMusicBrainzApi musicBrainzApi, ISettingsService lidarrSettings, + IRepository sub, ISettingsService lidarrSettings, ILidarrApi lidarrApi) : base(identity, requestService, rules, um, cache, ombiSettings, sub) { - _musicBrainzApi = musicBrainzApi; _lidarrSettings = lidarrSettings; _lidarrApi = lidarrApi; } public async Task GetAlbum(string albumId) { - var g = await _musicBrainzApi.GetAlbumInformation(albumId); - var release = new ReleaseGroup + var lidarrSettings = await GetLidarrSettings(); + Task lidarrAlbumTask = null; + var release = new ReleaseGroup{}; + if (lidarrSettings.Enabled) { - ReleaseType = g.ReleaseGroup.PrimaryType, - Id = g.Id, - Title = g.Title, - ReleaseDate = g.ReleaseGroup.FirstReleaseDate, - }; + lidarrAlbumTask = _lidarrApi.GetAlbumByForeignId(albumId, lidarrSettings.ApiKey, lidarrSettings.FullUri); + var albumResult = await lidarrAlbumTask; + release = new ReleaseGroup + { + ReleaseType = albumResult.artistType, + Id = albumResult.artistId.ToString(), + Title = albumResult.title, + ReleaseDate = albumResult.releaseDate.ToString(), + }; - await RunSearchRules(release); + await RunSearchRules(release); + } + return release; } public async Task GetArtistInformation(string artistId) { - var artist = await _musicBrainzApi.GetArtistInformation(artistId); var lidarrSettings = await GetLidarrSettings(); Task lidarrArtistTask = null; + var info = new ArtistInformation { }; if (lidarrSettings.Enabled) { lidarrArtistTask = _lidarrApi.GetArtistByForeignId(artistId, lidarrSettings.ApiKey, lidarrSettings.FullUri); - } + info = new ArtistInformation { }; - var info = new ArtistInformation - { - Id = artistId, - Name = artist.Name, - Country = artist.Country, - Region = artist.Area?.Name, - Type = artist.Type, - StartYear = artist.LifeSpan?.Begin ?? "", - EndYear = artist.LifeSpan?.End ?? "", - Disambiguation = artist.Disambiguation, - ReleaseGroups = new List(), - Members = new List() - }; - - foreach (var g in artist.ReleaseGroups) - { - var release = new ReleaseGroup + if (lidarrArtistTask != null) { - ReleaseType = g.PrimaryType, - Id = g.Id, - Title = g.Title, - ReleaseDate = g.FirstReleaseDate, - }; - - await RunSearchRules(release); - info.ReleaseGroups.Add(release); - } - - info.Links = GetLinksForArtist(artist); - info.Members = GetBandMembers(artist); - - if (lidarrArtistTask != null) - { - try - { - var artistResult = await lidarrArtistTask; - info.Banner = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("banner", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); - info.Logo = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("logo", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); - info.Poster = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("poster", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); - info.FanArt = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("fanart", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); - info.Overview = artistResult.overview; + try + { + var artistResult = await lidarrArtistTask; + info.Banner = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("banner", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); + info.Logo = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("logo", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); + info.Poster = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("poster", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); + info.FanArt = artistResult.images?.FirstOrDefault(x => x.coverType.Equals("fanart", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); + info.Overview = artistResult.overview; + info.Name = artistResult.artistName; + info.Monitored = artistResult.monitored; + } + catch (JsonSerializationException) + { + // swallow, Lidarr probably doesn't have this artist + } } - catch (JsonSerializationException) + } + + + + return info; + } + + public async Task GetAlbumInformation(string albumId) + { + var lidarrSettings = await GetLidarrSettings(); + Task lidarrAlbumTask = null; + var info = new AlbumInformation { }; + if (lidarrSettings.Enabled) + { + lidarrAlbumTask = _lidarrApi.GetAlbumByForeignId(albumId, lidarrSettings.ApiKey, lidarrSettings.FullUri); + + if (lidarrAlbumTask != null) { - // swallow, Lidarr probably doesn't have this artist + try + { + var albumResult = await lidarrAlbumTask; + info.Cover = albumResult.images?.FirstOrDefault(x => x.coverType.Equals("cover", StringComparison.InvariantCultureIgnoreCase))?.url.ToHttpsUrl(); + info.Title = albumResult.title; + info.Disambiguation = albumResult.disambiguation; + info.Overview = albumResult.overview; + info.Monitored = albumResult.monitored; + info.Id = albumResult.foreignAlbumId; + } + catch (JsonSerializationException) + { + // swallow, Lidarr probably doesn't have this album + } } } @@ -120,24 +129,24 @@ namespace Ombi.Core.Engine.V2 public async Task GetReleaseGroupArt(string musicBrainzId, CancellationToken token) { - var art = await _musicBrainzApi.GetCoverArtForReleaseGroup(musicBrainzId, token); + // var art = await _musicBrainzApi.GetCoverArtForReleaseGroup(musicBrainzId, token); - if (art == null || !art.images.Any()) - { - return new AlbumArt(); - } + // if (art == null || !art.images.Any()) + // { + // return new AlbumArt(); + // } - foreach (var cover in art.images) - { - if ((cover.thumbnails?.small ?? string.Empty).HasValue()) - { - return new AlbumArt(cover.thumbnails.small.ToHttpsUrl()); - } - if ((cover.thumbnails?.large ?? string.Empty).HasValue()) - { - return new AlbumArt(cover.thumbnails.large.ToHttpsUrl()); - } - } + // foreach (var cover in art.images) + // { + // if ((cover.thumbnails?.small ?? string.Empty).HasValue()) + // { + // return new AlbumArt(cover.thumbnails.small.ToHttpsUrl()); + // } + // if ((cover.thumbnails?.large ?? string.Empty).HasValue()) + // { + // return new AlbumArt(cover.thumbnails.large.ToHttpsUrl()); + // } + // } return new AlbumArt(); } @@ -151,18 +160,18 @@ namespace Ombi.Core.Engine.V2 private List GetBandMembers(Artist artist) { var members = new List(); - var membersOfBand = artist.Relations.Where(x => x.TypeId == RelationLinks.BandMember); - foreach (var member in membersOfBand) - { - members.Add(new BandMember - { - Name = member.Artist?.Name, - Attributes = member.Attributes, - IsCurrentMember = member.Ended == null, - End = member.End, - Start = member.Begin - }); - } + // var membersOfBand = artist.Relations.Where(x => x.TypeId == RelationLinks.BandMember); + // foreach (var member in membersOfBand) + // { + // members.Add(new BandMember + // { + // Name = member.Artist?.Name, + // Attributes = member.Attributes, + // IsCurrentMember = member.Ended == null, + // End = member.End, + // Start = member.Begin + // }); + // } return members; } @@ -170,79 +179,79 @@ namespace Ombi.Core.Engine.V2 private ArtistLinks GetLinksForArtist(Artist artist) { var links = new ArtistLinks(); - foreach (var relation in artist.Relations) - { - switch (relation.TypeId) - { - case RelationLinks.AllMusic: - links.AllMusic = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.BbcMusic: - links.BbcMusic = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.Discogs: - links.Discogs = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.Homepage: - links.HomePage = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.Imdb: - links.Imdb = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.LastFm: - links.LastFm = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.MySpace: - links.MySpace = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.OnlineCommunity: - links.OnlineCommunity = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.SocialNetwork: - if ((relation.Url?.Resource ?? string.Empty).Contains("twitter", CompareOptions.IgnoreCase)) - { - links.Twitter = relation.Url?.Resource.ToHttpsUrl(); - } - if ((relation.Url?.Resource ?? string.Empty).Contains("facebook", CompareOptions.IgnoreCase)) - { - links.Facebook = relation.Url?.Resource.ToHttpsUrl(); - } - if ((relation.Url?.Resource ?? string.Empty).Contains("instagram", CompareOptions.IgnoreCase)) - { - links.Instagram = relation.Url?.Resource.ToHttpsUrl(); - } - if ((relation.Url?.Resource ?? string.Empty).Contains("vk", CompareOptions.IgnoreCase)) - { - links.Vk = relation.Url?.Resource.ToHttpsUrl(); - } - break; - case RelationLinks.Streams: - if ((relation.Url?.Resource ?? string.Empty).Contains("spotify", CompareOptions.IgnoreCase)) - { - links.Spotify = relation.Url?.Resource.ToHttpsUrl(); - } - if ((relation.Url?.Resource ?? string.Empty).Contains("deezer", CompareOptions.IgnoreCase)) - { - links.Deezer = relation.Url?.Resource.ToHttpsUrl(); - } + // foreach (var relation in artist.Relations) + // { + // switch (relation.TypeId) + // { + // case RelationLinks.AllMusic: + // links.AllMusic = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.BbcMusic: + // links.BbcMusic = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.Discogs: + // links.Discogs = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.Homepage: + // links.HomePage = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.Imdb: + // links.Imdb = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.LastFm: + // links.LastFm = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.MySpace: + // links.MySpace = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.OnlineCommunity: + // links.OnlineCommunity = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.SocialNetwork: + // if ((relation.Url?.Resource ?? string.Empty).Contains("twitter", CompareOptions.IgnoreCase)) + // { + // links.Twitter = relation.Url?.Resource.ToHttpsUrl(); + // } + // if ((relation.Url?.Resource ?? string.Empty).Contains("facebook", CompareOptions.IgnoreCase)) + // { + // links.Facebook = relation.Url?.Resource.ToHttpsUrl(); + // } + // if ((relation.Url?.Resource ?? string.Empty).Contains("instagram", CompareOptions.IgnoreCase)) + // { + // links.Instagram = relation.Url?.Resource.ToHttpsUrl(); + // } + // if ((relation.Url?.Resource ?? string.Empty).Contains("vk", CompareOptions.IgnoreCase)) + // { + // links.Vk = relation.Url?.Resource.ToHttpsUrl(); + // } + // break; + // case RelationLinks.Streams: + // if ((relation.Url?.Resource ?? string.Empty).Contains("spotify", CompareOptions.IgnoreCase)) + // { + // links.Spotify = relation.Url?.Resource.ToHttpsUrl(); + // } + // if ((relation.Url?.Resource ?? string.Empty).Contains("deezer", CompareOptions.IgnoreCase)) + // { + // links.Deezer = relation.Url?.Resource.ToHttpsUrl(); + // } - break; - case RelationLinks.YouTube: - links.YouTube = relation.Url?.Resource.ToHttpsUrl(); - break; - case RelationLinks.Download: - if ((relation.Url?.Resource ?? string.Empty).Contains("google", CompareOptions.IgnoreCase)) - { - links.Google = relation.Url?.Resource.ToHttpsUrl(); - } - if ((relation.Url?.Resource ?? string.Empty).Contains("apple", CompareOptions.IgnoreCase)) - { - links.Apple = relation.Url?.Resource.ToHttpsUrl(); - } + // break; + // case RelationLinks.YouTube: + // links.YouTube = relation.Url?.Resource.ToHttpsUrl(); + // break; + // case RelationLinks.Download: + // if ((relation.Url?.Resource ?? string.Empty).Contains("google", CompareOptions.IgnoreCase)) + // { + // links.Google = relation.Url?.Resource.ToHttpsUrl(); + // } + // if ((relation.Url?.Resource ?? string.Empty).Contains("apple", CompareOptions.IgnoreCase)) + // { + // links.Apple = relation.Url?.Resource.ToHttpsUrl(); + // } - break; - } - } + // break; + // } + // } return links; } diff --git a/src/Ombi.Core/Helpers/NotificationHelper.cs b/src/Ombi.Core/Helpers/NotificationHelper.cs index f94e8f0db..9c44f4653 100644 --- a/src/Ombi.Core/Helpers/NotificationHelper.cs +++ b/src/Ombi.Core/Helpers/NotificationHelper.cs @@ -40,7 +40,7 @@ namespace Ombi.Core }); } - public async Task NewRequest(AlbumRequest model) + public async Task NewRequest(MusicRequests model) { var notificationModel = new NotificationOptions { @@ -55,7 +55,6 @@ namespace Ombi.Core }); } - public async Task Notify(MovieRequests model, NotificationType type) { var notificationModel = new NotificationOptions @@ -88,7 +87,7 @@ namespace Ombi.Core }); } - public async Task Notify(AlbumRequest model, NotificationType type) + public async Task Notify(MusicRequests model, NotificationType type) { var notificationModel = new NotificationOptions { diff --git a/src/Ombi.Core/Models/Requests/MusicArtistRequestViewModel.cs b/src/Ombi.Core/Models/Requests/MusicArtistRequestViewModel.cs index cd799406b..dd556c8ee 100644 --- a/src/Ombi.Core/Models/Requests/MusicArtistRequestViewModel.cs +++ b/src/Ombi.Core/Models/Requests/MusicArtistRequestViewModel.cs @@ -4,5 +4,16 @@ { public string ForeignAlbumId { get; set; } public string RequestedByAlias { get; set; } + public string Monitor { get; set; } + public bool SearchForMissingAlbums { get; set; } + } + + public class MusicArtistRequestViewModel + { + public string ForeignArtistId { get; set; } + public bool Monitored { get; set; } + public string RequestedByAlias { get; set; } + public string Monitor { get; set; } + public bool SearchForMissingAlbums { get; set; } } } \ No newline at end of file diff --git a/src/Ombi.Core/Models/Search/V2/MultiSearchResult.cs b/src/Ombi.Core/Models/Search/V2/MultiSearchResult.cs index 64870a97c..00b11e1e7 100644 --- a/src/Ombi.Core/Models/Search/V2/MultiSearchResult.cs +++ b/src/Ombi.Core/Models/Search/V2/MultiSearchResult.cs @@ -7,5 +7,6 @@ public string Title { get; set; } public string Poster { get; set; } public string Overview { get; set; } + public bool Monitored { get; set; } } } \ No newline at end of file diff --git a/src/Ombi.Core/Models/Search/V2/Music/AlbumInformation.cs b/src/Ombi.Core/Models/Search/V2/Music/AlbumInformation.cs new file mode 100644 index 000000000..67234a2ab --- /dev/null +++ b/src/Ombi.Core/Models/Search/V2/Music/AlbumInformation.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; + +namespace Ombi.Core.Models.Search.V2.Music +{ + public class AlbumInformation + { + public string Title { get; set; } + public string Id { get; set; } + public string StartYear { get; set; } + public string EndYear { get; set; } + public bool IsEnded => string.IsNullOrEmpty(EndYear); + public bool Monitored { get; set; } + public string Type { get; set; } + public string Country { get; set; } + public string Region { get; set; } + public string Disambiguation { get; set; } + public string Cover { get; set; } + public string Overview { get; set; } + } +} \ No newline at end of file diff --git a/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs b/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs index 04dfd44d8..ebb39eb97 100644 --- a/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs +++ b/src/Ombi.Core/Models/Search/V2/Music/ArtistInformation.cs @@ -18,6 +18,7 @@ namespace Ombi.Core.Models.Search.V2.Music public string Poster { get; set; } public string FanArt { get; set; } public string Overview { get; set; } + public bool Monitored { get; set; } public List ReleaseGroups { get; set; } public ArtistLinks Links { get; set; } public List Members { get; set; } diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj index 359792e0d..d29bc34dd 100644 --- a/src/Ombi.Core/Ombi.Core.csproj +++ b/src/Ombi.Core/Ombi.Core.csproj @@ -28,7 +28,6 @@ - diff --git a/src/Ombi.Core/Senders/IMusicSender.cs b/src/Ombi.Core/Senders/IMusicSender.cs index abeec5c29..5c8fdf90e 100644 --- a/src/Ombi.Core/Senders/IMusicSender.cs +++ b/src/Ombi.Core/Senders/IMusicSender.cs @@ -5,6 +5,7 @@ namespace Ombi.Core.Senders { public interface IMusicSender { - Task Send(AlbumRequest model); + Task SendAlbum(MusicRequests model); + Task SendArtist(MusicRequests model); } } \ No newline at end of file diff --git a/src/Ombi.Core/Senders/INotificationHelper.cs b/src/Ombi.Core/Senders/INotificationHelper.cs index 70947a57e..a75d630a9 100644 --- a/src/Ombi.Core/Senders/INotificationHelper.cs +++ b/src/Ombi.Core/Senders/INotificationHelper.cs @@ -10,10 +10,10 @@ namespace Ombi.Core { Task NewRequest(FullBaseRequest model); Task NewRequest(ChildRequests model); - Task NewRequest(AlbumRequest model); + Task NewRequest(MusicRequests model); Task Notify(MovieRequests model, NotificationType type); Task Notify(ChildRequests model, NotificationType type); - Task Notify(AlbumRequest model, NotificationType type); + Task Notify(MusicRequests model, NotificationType type); Task Notify(NotificationOptions model); } } \ No newline at end of file diff --git a/src/Ombi.Core/Senders/MusicSender.cs b/src/Ombi.Core/Senders/MusicSender.cs index 6390578dd..7981efc68 100644 --- a/src/Ombi.Core/Senders/MusicSender.cs +++ b/src/Ombi.Core/Senders/MusicSender.cs @@ -33,14 +33,14 @@ namespace Ombi.Core.Senders private readonly IRepository _requestQueueRepository; private readonly INotificationHelper _notificationHelper; - public async Task Send(AlbumRequest model) + public async Task SendAlbum(MusicRequests model) { try { var settings = await _lidarrSettings.GetSettingsAsync(); if (settings.Enabled) { - return await SendToLidarr(model, settings); + return await SendAlbumToLidarr(model, settings); } return new SenderResult { Success = false, Sent = false, Message = "Lidarr is not enabled" }; @@ -73,7 +73,47 @@ namespace Ombi.Core.Senders return new SenderResult { Success = false, Sent = false, Message = "Something went wrong!" }; } - private async Task SendToLidarr(AlbumRequest model, LidarrSettings settings) + public async Task SendArtist(MusicRequests model) + { + try + { + var settings = await _lidarrSettings.GetSettingsAsync(); + if (settings.Enabled) + { + return await SendArtistToLidarr(model, settings); + } + + return new SenderResult { Success = false, Sent = false, Message = "Lidarr is not enabled" }; + } + catch (Exception e) + { + _log.LogError(e, "Exception thrown when sending a music to DVR app, added to the request queue"); + var existingQueue = await _requestQueueRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id); + if (existingQueue != null) + { + existingQueue.RetryCount++; + existingQueue.Error = e.Message; + await _requestQueueRepository.SaveChangesAsync(); + } + else + { + await _requestQueueRepository.Add(new RequestQueue + { + Dts = DateTime.UtcNow, + Error = e.Message, + RequestId = model.Id, + Type = RequestType.Album, + RetryCount = 0 + }); + await _notificationHelper.Notify(model, NotificationType.ItemAddedToFaultQueue); + } + } + + + return new SenderResult { Success = false, Sent = false, Message = "Something went wrong!" }; + } + + private async Task SendAlbumToLidarr(MusicRequests model, LidarrSettings settings) { var qualityToUse = int.Parse(settings.DefaultQualityProfile); //if (model.QualityOverride > 0) @@ -99,9 +139,9 @@ namespace Ombi.Core.Senders foreignArtistId = model.ForeignArtistId, addOptions = new Addoptions { - monitored = true, - monitor = MonitorTypes.None, - searchForMissingAlbums = false, + monitored = model.Monitored, + monitor = model.Monitor, + searchForMissingAlbums = model.SearchForMissingAlbums, AlbumsToMonitor = new[] {model.ForeignAlbumId} }, added = DateTime.Now, @@ -160,7 +200,46 @@ namespace Ombi.Core.Senders return new SenderResult { Success = false, Sent = false, Message = "Album is already monitored" }; } - private async Task SetupAlbum(AlbumRequest model, ArtistResult artist, LidarrSettings settings) + private async Task SendArtistToLidarr(MusicRequests model, LidarrSettings settings) + { + var qualityToUse = int.Parse(settings.DefaultQualityProfile); + //if (model.QualityOverride > 0) + //{ + // qualityToUse = model.QualityOverride; + //} + + var rootFolderPath = /*model.RootPathOverride <= 0 ?*/ settings.DefaultRootPath /*: await RadarrRootPath(model.RootPathOverride, settings)*/; + + EnsureArg.IsNotNullOrEmpty(model.ForeignArtistId, nameof(model.ForeignArtistId)); + EnsureArg.IsNotNullOrEmpty(rootFolderPath, nameof(rootFolderPath)); + + // Create artist + var newArtist = new ArtistAdd + { + foreignArtistId = model.ForeignArtistId, + addOptions = new Addoptions + { + monitor = model.Monitor, + searchForMissingAlbums = model.SearchForMissingAlbums + }, + artistName = model.ArtistName, + added = DateTime.Now, + monitored = model.Monitored, + metadataProfileId = settings.MetadataProfileId, + qualityProfileId = qualityToUse, + rootFolderPath = rootFolderPath, + }; +// Console.Write(newArtist); + var result = await _lidarrApi.AddArtist(newArtist, settings.ApiKey, settings.FullUri); + if (result != null && result.id > 0) + { + return new SenderResult { Message = "Artist has been requested!", Sent = true, Success = true }; + } + + return new SenderResult { Success = false, Sent = false, Message = "Artist is already monitored" }; + } + + private async Task SetupAlbum(MusicRequests model, ArtistResult artist, LidarrSettings settings) { // Get the album id var albums = await _lidarrApi.GetAllAlbumsByArtistId(artist.id, settings.ApiKey, settings.FullUri); diff --git a/src/Ombi.Core/Senders/TvSender.cs b/src/Ombi.Core/Senders/TvSender.cs index 2f42a12c0..38220d121 100644 --- a/src/Ombi.Core/Senders/TvSender.cs +++ b/src/Ombi.Core/Senders/TvSender.cs @@ -261,7 +261,7 @@ namespace Ombi.Core.Senders qualityProfileId = qualityToUse, titleSlug = model.ParentRequest.Title, seriesType = seriesType, - addOptions = new AddOptions + addOptions = new Ombi.Api.Sonarr.Models.AddOptions { ignoreEpisodesWithFiles = false, // There shouldn't be any episodes with files, this is a new season ignoreEpisodesWithoutFiles = false, // We want all missing diff --git a/src/Ombi.DependencyInjection/IocExtensions.cs b/src/Ombi.DependencyInjection/IocExtensions.cs index f81cd05da..44758b871 100644 --- a/src/Ombi.DependencyInjection/IocExtensions.cs +++ b/src/Ombi.DependencyInjection/IocExtensions.cs @@ -63,7 +63,6 @@ using Ombi.Schedule.Jobs.Plex.Interfaces; using Ombi.Schedule.Jobs.SickRage; using Ombi.Schedule.Processor; using Quartz.Spi; -using Ombi.Api.MusicBrainz; using Ombi.Api.Twilio; using Ombi.Api.CloudService; using Ombi.Api.RottenTomatoes; @@ -167,7 +166,6 @@ namespace Ombi.DependencyInjection services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj index e65f2d5a2..0fb3dc702 100644 --- a/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj +++ b/src/Ombi.DependencyInjection/Ombi.DependencyInjection.csproj @@ -28,7 +28,6 @@ - diff --git a/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs b/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs index 783844a82..2845273b8 100644 --- a/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs +++ b/src/Ombi.Notifications.Tests/NotificationMessageCurlysTests.cs @@ -197,7 +197,7 @@ namespace Ombi.Notifications.Tests public void MusicNotificationTests() { var notificationOptions = new NotificationOptions(); - var req = F.Build() + var req = F.Build() .With(x => x.RequestType, RequestType.Album) .With(x => x.Available, true) .Create(); @@ -232,7 +232,7 @@ namespace Ombi.Notifications.Tests public string MusicNotificationTests_RequestStatus(bool available, bool denied, bool approved) { var notificationOptions = new NotificationOptions(); - var req = F.Build() + var req = F.Build() .With(x => x.RequestType, RequestType.Album) .With(x => x.Available, available) .With(x => x.Denied, denied) diff --git a/src/Ombi.Notifications/BaseNotification.cs b/src/Ombi.Notifications/BaseNotification.cs index ac9de5736..622584aa6 100644 --- a/src/Ombi.Notifications/BaseNotification.cs +++ b/src/Ombi.Notifications/BaseNotification.cs @@ -46,7 +46,8 @@ namespace Ombi.Notifications protected ChildRequests TvRequest { get; set; } - protected AlbumRequest AlbumRequest { get; set; } + protected MusicRequests AlbumRequest { get; set; } + protected MusicRequests ArtistRequest { get; set; } protected MovieRequests MovieRequest { get; set; } protected IQueryable Subscribed { get; private set; } diff --git a/src/Ombi.Notifications/NotificationMessageCurlys.cs b/src/Ombi.Notifications/NotificationMessageCurlys.cs index 8023ae464..58c5dc519 100644 --- a/src/Ombi.Notifications/NotificationMessageCurlys.cs +++ b/src/Ombi.Notifications/NotificationMessageCurlys.cs @@ -88,7 +88,7 @@ namespace Ombi.Notifications CalculateRequestStatus(req); } - public void Setup(NotificationOptions opts, AlbumRequest req, CustomizationSettings s, + public void Setup(NotificationOptions opts, MusicRequests req, CustomizationSettings s, UserNotificationPreferences pref) { LoadIssues(opts); diff --git a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs index 99b27fec7..6ce28565b 100644 --- a/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs +++ b/src/Ombi.Schedule/Jobs/Lidarr/LidarrAvailabilityChecker.cs @@ -41,7 +41,7 @@ namespace Ombi.Schedule.Jobs.Lidarr await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Lidarr Availability Check Started"); var allAlbumRequests = _requestRepository.GetAll().Include(x => x.RequestedUser).Where(x => !x.Available); - var albumsToUpdate = new List(); + var albumsToUpdate = new List(); foreach (var request in allAlbumRequests) { // Check if we have it cached diff --git a/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs b/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs index 3a9a75835..8886471c3 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/ResendFailedRequests.cs @@ -81,7 +81,23 @@ namespace Ombi.Schedule.Jobs.Ombi await _requestQueue.SaveChangesAsync(); continue; } - var result = await _musicSender.Send(musicRequest); + var result = await _musicSender.SendAlbum(musicRequest); + if (result.Success) + { + request.Completed = DateTime.UtcNow; + await _requestQueue.SaveChangesAsync(); + } + } + if (request.Type == RequestType.Artist) + { + var musicRequest = await _musicRequestRepository.GetAll().FirstOrDefaultAsync(x => x.Id == request.RequestId); + if (musicRequest == null) + { + await _requestQueue.Delete(request); + await _requestQueue.SaveChangesAsync(); + continue; + } + var result = await _musicSender.SendArtist(musicRequest); if (result.Success) { request.Completed = DateTime.UtcNow; diff --git a/src/Ombi.Store/Context/OmbiContext.cs b/src/Ombi.Store/Context/OmbiContext.cs index 0681d9ca0..1d2061bc8 100644 --- a/src/Ombi.Store/Context/OmbiContext.cs +++ b/src/Ombi.Store/Context/OmbiContext.cs @@ -34,7 +34,7 @@ namespace Ombi.Store.Context public DbSet NotificationTemplates { get; set; } public DbSet MovieRequests { get; set; } - public DbSet AlbumRequests { get; set; } + public DbSet MusicRequests { get; set; } public DbSet TvRequests { get; set; } public DbSet ChildRequests { get; set; } public DbSet EpisodeRequests { get; set; } diff --git a/src/Ombi.Store/Entities/RequestType.cs b/src/Ombi.Store/Entities/RequestType.cs index 4d2d20ac4..4dca39554 100644 --- a/src/Ombi.Store/Entities/RequestType.cs +++ b/src/Ombi.Store/Entities/RequestType.cs @@ -5,5 +5,6 @@ TvShow = 0, Movie = 1, Album = 2, + Artist = 3 } } diff --git a/src/Ombi.Store/Entities/Requests/AlbumRequest.cs b/src/Ombi.Store/Entities/Requests/MusicRequests.cs similarity index 85% rename from src/Ombi.Store/Entities/Requests/AlbumRequest.cs rename to src/Ombi.Store/Entities/Requests/MusicRequests.cs index eecf05e6e..0aaac7b16 100644 --- a/src/Ombi.Store/Entities/Requests/AlbumRequest.cs +++ b/src/Ombi.Store/Entities/Requests/MusicRequests.cs @@ -3,8 +3,8 @@ using System.ComponentModel.DataAnnotations.Schema; namespace Ombi.Store.Entities.Requests { - [Table("AlbumRequests")] - public class AlbumRequest : BaseRequest + [Table("MusicRequests")] + public class MusicRequests : BaseRequest { public string ForeignAlbumId { get; set; } public string ForeignArtistId { get; set; } @@ -17,6 +17,9 @@ namespace Ombi.Store.Entities.Requests public bool Subscribed { get; set; } [NotMapped] public bool ShowSubscribe { get; set; } + public bool Monitored { get; set; } + public string Monitor { get; set; } + public bool SearchForMissingAlbums { get; set; } [NotMapped] diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20210802192907_RenameAlbumRequests.Designer.cs b/src/Ombi.Store/Migrations/OmbiMySql/20210802192907_RenameAlbumRequests.Designer.cs new file mode 100644 index 000000000..0e0adf663 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiMySql/20210802192907_RenameAlbumRequests.Designer.cs @@ -0,0 +1,1243 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context.MySql; + +namespace Ombi.Store.Migrations.OmbiMySql +{ + [DbContext(typeof(OmbiMySqlContext))] + [Migration("20210802192907_RenameAlbumRequests")] + partial class RenameAlbumRequests + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuditArea") + .HasColumnType("INTEGER"); + + b.Property("AuditType") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("User") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("NotificationType") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("PlayerId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("Alias") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("EpisodeRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("Language") + .HasColumnType("TEXT"); + + b.Property("LastLoggedIn") + .HasColumnType("TEXT"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("MovieRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("MusicRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("ProviderUserId") + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("StreamingCountry") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserAccessToken") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("UserType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("AlbumId") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .HasColumnType("INTEGER"); + + b.Property("ContentType") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("TEXT"); + + b.Property("Dts") + .HasColumnType("TEXT"); + + b.Property("Error") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RetryCount") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("ParentRequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SeriesType") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("IssuesId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IssueCategoryId") + .HasColumnType("INTEGER"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("ProviderId") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("ResovledDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("UserReportedId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssueCategoryId"); + + b.HasIndex("IssueId"); + + b.HasIndex("UserReportedId"); + + b.ToTable("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("DigitalReleaseDate") + .HasColumnType("TEXT"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("LangCode") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("RootPathOverride") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("TheMovieDbId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("ArtistName") + .HasColumnType("TEXT"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Cover") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("Disk") + .HasColumnType("TEXT"); + + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); + + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Monitor") + .HasColumnType("TEXT"); + + b.Property("Monitored") + .HasColumnType("INTEGER"); + + b.Property("Rating") + .HasColumnType("TEXT"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SearchForMissingAlbums") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MusicRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EpisodeCount") + .HasColumnType("INTEGER"); + + b.Property("RequestDate") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("ExternalProviderId") + .HasColumnType("INTEGER"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("LanguageProfile") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RootFolder") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("TotalSeasons") + .HasColumnType("INTEGER"); + + b.Property("TvDbId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RadarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("RadarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfileAnime") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPathAnime") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("Deleted") + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VoteType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AirDate") + .HasColumnType("TEXT"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("Requested") + .HasColumnType("INTEGER"); + + b.Property("SeasonId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChildRequestId") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("ParentRequest"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.HasOne("Ombi.Store.Entities.Requests.Issues", "Issues") + .WithMany("Comments") + .HasForeignKey("IssuesId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Issues"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") + .WithMany() + .HasForeignKey("IssueCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "UserReported") + .WithMany() + .HasForeignKey("UserReportedId"); + + b.Navigation("IssueCategory"); + + b.Navigation("UserReported"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") + .WithMany("Episodes") + .HasForeignKey("SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChildRequest"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Navigation("NotificationUserIds"); + + b.Navigation("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Navigation("Issues"); + + b.Navigation("SeasonRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Navigation("Comments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Navigation("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Navigation("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Navigation("Episodes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20210802192907_RenameAlbumRequests.cs b/src/Ombi.Store/Migrations/OmbiMySql/20210802192907_RenameAlbumRequests.cs new file mode 100644 index 000000000..53d8affd1 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiMySql/20210802192907_RenameAlbumRequests.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations.OmbiMySql +{ + public partial class RenameAlbumRequests : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameTable("AlbumRequests", null, "MusicRequests"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20210802193833_MusicRequestsMonitor.Designer.cs b/src/Ombi.Store/Migrations/OmbiMySql/20210802193833_MusicRequestsMonitor.Designer.cs new file mode 100644 index 000000000..b084453e8 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiMySql/20210802193833_MusicRequestsMonitor.Designer.cs @@ -0,0 +1,1243 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context.MySql; + +namespace Ombi.Store.Migrations.OmbiMySql +{ + [DbContext(typeof(OmbiMySqlContext))] + [Migration("20210802193833_MusicRequestsMonitor")] + partial class MusicRequestsMonitor + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuditArea") + .HasColumnType("INTEGER"); + + b.Property("AuditType") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("User") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("NotificationType") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("PlayerId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("Alias") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("EpisodeRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("Language") + .HasColumnType("TEXT"); + + b.Property("LastLoggedIn") + .HasColumnType("TEXT"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("MovieRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("MusicRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("ProviderUserId") + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("StreamingCountry") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserAccessToken") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("UserType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("AlbumId") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .HasColumnType("INTEGER"); + + b.Property("ContentType") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("TEXT"); + + b.Property("Dts") + .HasColumnType("TEXT"); + + b.Property("Error") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RetryCount") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("ParentRequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SeriesType") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("IssuesId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IssueCategoryId") + .HasColumnType("INTEGER"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("ProviderId") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("ResovledDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("UserReportedId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssueCategoryId"); + + b.HasIndex("IssueId"); + + b.HasIndex("UserReportedId"); + + b.ToTable("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("DigitalReleaseDate") + .HasColumnType("TEXT"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("LangCode") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("RootPathOverride") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("TheMovieDbId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("ArtistName") + .HasColumnType("TEXT"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Cover") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("Disk") + .HasColumnType("TEXT"); + + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); + + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Monitor") + .HasColumnType("TEXT"); + + b.Property("Monitored") + .HasColumnType("INTEGER"); + + b.Property("Rating") + .HasColumnType("TEXT"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SearchForMissingAlbums") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MusicRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EpisodeCount") + .HasColumnType("INTEGER"); + + b.Property("RequestDate") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("ExternalProviderId") + .HasColumnType("INTEGER"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("LanguageProfile") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RootFolder") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("TotalSeasons") + .HasColumnType("INTEGER"); + + b.Property("TvDbId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RadarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("RadarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfileAnime") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPathAnime") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("Deleted") + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VoteType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AirDate") + .HasColumnType("TEXT"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("Requested") + .HasColumnType("INTEGER"); + + b.Property("SeasonId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChildRequestId") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("ParentRequest"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.HasOne("Ombi.Store.Entities.Requests.Issues", "Issues") + .WithMany("Comments") + .HasForeignKey("IssuesId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Issues"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") + .WithMany() + .HasForeignKey("IssueCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "UserReported") + .WithMany() + .HasForeignKey("UserReportedId"); + + b.Navigation("IssueCategory"); + + b.Navigation("UserReported"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") + .WithMany("Episodes") + .HasForeignKey("SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChildRequest"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Navigation("NotificationUserIds"); + + b.Navigation("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Navigation("Issues"); + + b.Navigation("SeasonRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Navigation("Comments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Navigation("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Navigation("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Navigation("Episodes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiMySql/20210802193833_MusicRequestsMonitor.cs b/src/Ombi.Store/Migrations/OmbiMySql/20210802193833_MusicRequestsMonitor.cs new file mode 100644 index 000000000..d539174dc --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiMySql/20210802193833_MusicRequestsMonitor.cs @@ -0,0 +1,46 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations.OmbiMySql +{ + public partial class MusicRequestsMonitor : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Monitored", + table: "MusicRequests", + type: "BOOLEAN", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Monitor", + table: "MusicRequests", + type: "longtext", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "SearchForMissingAlbums", + table: "MusicRequests", + type: "longtext", + nullable: false, + defaultValue: ""); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Monitored", + table: "MusicRequests"); + + migrationBuilder.DropColumn( + name: "Monitor", + table: "MusicRequests"); + + migrationBuilder.DropColumn( + name: "SearchForMissingAlbums", + table: "MusicRequests"); + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/20210802192907_RenameAlbumRequests.Designer.cs b/src/Ombi.Store/Migrations/OmbiSqlite/20210802192907_RenameAlbumRequests.Designer.cs new file mode 100644 index 000000000..8379b2972 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiSqlite/20210802192907_RenameAlbumRequests.Designer.cs @@ -0,0 +1,1243 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context.Sqlite; + +namespace Ombi.Store.Migrations.OmbiSqlite +{ + [DbContext(typeof(OmbiSqliteContext))] + [Migration("20210802192907_RenameAlbumRequests")] + partial class RenameAlbumRequests + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuditArea") + .HasColumnType("INTEGER"); + + b.Property("AuditType") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("User") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("NotificationType") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("PlayerId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("Alias") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("EpisodeRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("Language") + .HasColumnType("TEXT"); + + b.Property("LastLoggedIn") + .HasColumnType("TEXT"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("MovieRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("MusicRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("ProviderUserId") + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("StreamingCountry") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserAccessToken") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("UserType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("AlbumId") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .HasColumnType("INTEGER"); + + b.Property("ContentType") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("TEXT"); + + b.Property("Dts") + .HasColumnType("TEXT"); + + b.Property("Error") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RetryCount") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("ParentRequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SeriesType") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("IssuesId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IssueCategoryId") + .HasColumnType("INTEGER"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("ProviderId") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("ResovledDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("UserReportedId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssueCategoryId"); + + b.HasIndex("IssueId"); + + b.HasIndex("UserReportedId"); + + b.ToTable("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("DigitalReleaseDate") + .HasColumnType("TEXT"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("LangCode") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("RootPathOverride") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("TheMovieDbId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("ArtistName") + .HasColumnType("TEXT"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Cover") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("Disk") + .HasColumnType("TEXT"); + + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); + + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Monitor") + .HasColumnType("TEXT"); + + b.Property("Monitored") + .HasColumnType("INTEGER"); + + b.Property("Rating") + .HasColumnType("TEXT"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SearchForMissingAlbums") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MusicRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EpisodeCount") + .HasColumnType("INTEGER"); + + b.Property("RequestDate") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("ExternalProviderId") + .HasColumnType("INTEGER"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("LanguageProfile") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RootFolder") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("TotalSeasons") + .HasColumnType("INTEGER"); + + b.Property("TvDbId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RadarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("RadarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfileAnime") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPathAnime") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("Deleted") + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VoteType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AirDate") + .HasColumnType("TEXT"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("Requested") + .HasColumnType("INTEGER"); + + b.Property("SeasonId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChildRequestId") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("ParentRequest"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.HasOne("Ombi.Store.Entities.Requests.Issues", "Issues") + .WithMany("Comments") + .HasForeignKey("IssuesId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Issues"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") + .WithMany() + .HasForeignKey("IssueCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "UserReported") + .WithMany() + .HasForeignKey("UserReportedId"); + + b.Navigation("IssueCategory"); + + b.Navigation("UserReported"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") + .WithMany("Episodes") + .HasForeignKey("SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChildRequest"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Navigation("NotificationUserIds"); + + b.Navigation("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Navigation("Issues"); + + b.Navigation("SeasonRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Navigation("Comments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Navigation("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Navigation("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Navigation("Episodes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/20210802192907_RenameAlbumRequests.cs b/src/Ombi.Store/Migrations/OmbiSqlite/20210802192907_RenameAlbumRequests.cs new file mode 100644 index 000000000..bb2ef3ec1 --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiSqlite/20210802192907_RenameAlbumRequests.cs @@ -0,0 +1,17 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations.OmbiSqlite +{ + public partial class RenameAlbumRequests : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameTable("AlbumRequests", null, "MusicRequests"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/20210802193833_MusicRequestsMonitor.Designer.cs b/src/Ombi.Store/Migrations/OmbiSqlite/20210802193833_MusicRequestsMonitor.Designer.cs new file mode 100644 index 000000000..03639907d --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiSqlite/20210802193833_MusicRequestsMonitor.Designer.cs @@ -0,0 +1,1243 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Ombi.Store.Context.Sqlite; + +namespace Ombi.Store.Migrations.OmbiSqlite +{ + [DbContext(typeof(OmbiSqliteContext))] + [Migration("20210802193833_MusicRequestsMonitor")] + partial class MusicRequestsMonitor + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.1"); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ClaimType") + .HasColumnType("TEXT"); + + b.Property("ClaimValue") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("ProviderKey") + .HasColumnType("TEXT"); + + b.Property("ProviderDisplayName") + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("RoleId") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("LoginProvider") + .HasColumnType("TEXT"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Audit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AuditArea") + .HasColumnType("INTEGER"); + + b.Property("AuditType") + .HasColumnType("INTEGER"); + + b.Property("DateTime") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("User") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Audit"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("MobileDevices"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationTemplates", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("NotificationType") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("NotificationTemplates"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("PlayerId") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("NotificationUserId"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("AccessFailedCount") + .HasColumnType("INTEGER"); + + b.Property("Alias") + .HasColumnType("TEXT"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("TEXT"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("EmailConfirmed") + .HasColumnType("INTEGER"); + + b.Property("EpisodeRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("Language") + .HasColumnType("TEXT"); + + b.Property("LastLoggedIn") + .HasColumnType("TEXT"); + + b.Property("LockoutEnabled") + .HasColumnType("INTEGER"); + + b.Property("LockoutEnd") + .HasColumnType("TEXT"); + + b.Property("MovieRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("MusicRequestLimit") + .HasColumnType("INTEGER"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("PasswordHash") + .HasColumnType("TEXT"); + + b.Property("PhoneNumber") + .HasColumnType("TEXT"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("INTEGER"); + + b.Property("ProviderUserId") + .HasColumnType("TEXT"); + + b.Property("SecurityStamp") + .HasColumnType("TEXT"); + + b.Property("StreamingCountry") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TwoFactorEnabled") + .HasColumnType("INTEGER"); + + b.Property("UserAccessToken") + .HasColumnType("TEXT"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("TEXT"); + + b.Property("UserType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RecentlyAddedLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AddedAt") + .HasColumnType("TEXT"); + + b.Property("AlbumId") + .HasColumnType("TEXT"); + + b.Property("ContentId") + .HasColumnType("INTEGER"); + + b.Property("ContentType") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RecentlyAddedLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestQueue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Completed") + .HasColumnType("TEXT"); + + b.Property("Dts") + .HasColumnType("TEXT"); + + b.Property("Error") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RetryCount") + .HasColumnType("INTEGER"); + + b.Property("Type") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("RequestQueue"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestSubscription"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("ParentRequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SeriesType") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ParentRequestId"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("IssueCategory"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Comment") + .HasColumnType("TEXT"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("IssuesId") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssuesId"); + + b.HasIndex("UserId"); + + b.ToTable("IssueComments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedDate") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("IssueCategoryId") + .HasColumnType("INTEGER"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("ProviderId") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("ResovledDate") + .HasColumnType("TEXT"); + + b.Property("Status") + .HasColumnType("INTEGER"); + + b.Property("Subject") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("UserReportedId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("IssueCategoryId"); + + b.HasIndex("IssueId"); + + b.HasIndex("UserReportedId"); + + b.ToTable("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("DigitalReleaseDate") + .HasColumnType("TEXT"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("IssueId") + .HasColumnType("INTEGER"); + + b.Property("LangCode") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("RootPathOverride") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("TheMovieDbId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MovieRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("ArtistName") + .HasColumnType("TEXT"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Cover") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("Disk") + .HasColumnType("TEXT"); + + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); + + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Monitor") + .HasColumnType("TEXT"); + + b.Property("Monitored") + .HasColumnType("INTEGER"); + + b.Property("Rating") + .HasColumnType("TEXT"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SearchForMissingAlbums") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MusicRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EpisodeCount") + .HasColumnType("INTEGER"); + + b.Property("RequestDate") + .HasColumnType("TEXT"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("RequestLog"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Background") + .HasColumnType("TEXT"); + + b.Property("ExternalProviderId") + .HasColumnType("INTEGER"); + + b.Property("ImdbId") + .HasColumnType("TEXT"); + + b.Property("LanguageProfile") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("PosterPath") + .HasColumnType("TEXT"); + + b.Property("QualityOverride") + .HasColumnType("INTEGER"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RootFolder") + .HasColumnType("INTEGER"); + + b.Property("Status") + .HasColumnType("TEXT"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("TotalSeasons") + .HasColumnType("INTEGER"); + + b.Property("TvDbId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("TvRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Token") + .HasColumnType("TEXT"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Tokens"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Agent") + .HasColumnType("INTEGER"); + + b.Property("Enabled") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("Value") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("RadarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("RadarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfile") + .HasColumnType("INTEGER"); + + b.Property("SonarrQualityProfileAnime") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPath") + .HasColumnType("INTEGER"); + + b.Property("SonarrRootPathAnime") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserQualityProfiles"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Date") + .HasColumnType("TEXT"); + + b.Property("Deleted") + .HasColumnType("INTEGER"); + + b.Property("RequestId") + .HasColumnType("INTEGER"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("UserId") + .HasColumnType("TEXT"); + + b.Property("VoteType") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Votes"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("AirDate") + .HasColumnType("TEXT"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("EpisodeNumber") + .HasColumnType("INTEGER"); + + b.Property("Requested") + .HasColumnType("INTEGER"); + + b.Property("SeasonId") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.Property("Url") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("SeasonId"); + + b.ToTable("EpisodeRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ChildRequestId") + .HasColumnType("INTEGER"); + + b.Property("Overview") + .HasColumnType("TEXT"); + + b.Property("SeasonNumber") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("ChildRequestId"); + + b.ToTable("SeasonRequests"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Ombi.Store.Entities.MobileDevices", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.NotificationUserId", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("NotificationUserIds") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.RequestSubscription", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") + .WithMany("ChildRequests") + .HasForeignKey("ParentRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("ParentRequest"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.IssueComments", b => + { + b.HasOne("Ombi.Store.Entities.Requests.Issues", "Issues") + .WithMany("Comments") + .HasForeignKey("IssuesId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("Issues"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.HasOne("Ombi.Store.Entities.Requests.IssueCategory", "IssueCategory") + .WithMany() + .HasForeignKey("IssueCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.Requests.MovieRequests", null) + .WithMany("Issues") + .HasForeignKey("IssueId"); + + b.HasOne("Ombi.Store.Entities.OmbiUser", "UserReported") + .WithMany() + .HasForeignKey("UserReportedId"); + + b.Navigation("IssueCategory"); + + b.Navigation("UserReported"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Tokens", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserNotificationPreferences", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany("UserNotificationPreferences") + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.UserQualityProfiles", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Votes", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "User") + .WithMany() + .HasForeignKey("UserId"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.EpisodeRequests", b => + { + b.HasOne("Ombi.Store.Repository.Requests.SeasonRequests", "Season") + .WithMany("Episodes") + .HasForeignKey("SeasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Season"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.HasOne("Ombi.Store.Entities.Requests.ChildRequests", "ChildRequest") + .WithMany("SeasonRequests") + .HasForeignKey("ChildRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ChildRequest"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.OmbiUser", b => + { + b.Navigation("NotificationUserIds"); + + b.Navigation("UserNotificationPreferences"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => + { + b.Navigation("Issues"); + + b.Navigation("SeasonRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.Issues", b => + { + b.Navigation("Comments"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.MovieRequests", b => + { + b.Navigation("Issues"); + }); + + modelBuilder.Entity("Ombi.Store.Entities.Requests.TvRequests", b => + { + b.Navigation("ChildRequests"); + }); + + modelBuilder.Entity("Ombi.Store.Repository.Requests.SeasonRequests", b => + { + b.Navigation("Episodes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/20210802193833_MusicRequestsMonitor.cs b/src/Ombi.Store/Migrations/OmbiSqlite/20210802193833_MusicRequestsMonitor.cs new file mode 100644 index 000000000..4bc91a3ce --- /dev/null +++ b/src/Ombi.Store/Migrations/OmbiSqlite/20210802193833_MusicRequestsMonitor.cs @@ -0,0 +1,46 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Ombi.Store.Migrations.OmbiSqlite +{ + public partial class MusicRequestsMonitor : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Monitored", + table: "MusicRequests", + type: "BOOLEAN", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "Monitor", + table: "MusicRequests", + type: "longtext", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "SearchForMissingAlbums", + table: "MusicRequests", + type: "longtext", + nullable: false, + defaultValue: ""); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Monitored", + table: "MusicRequests"); + + migrationBuilder.DropColumn( + name: "Monitor", + table: "MusicRequests"); + + migrationBuilder.DropColumn( + name: "SearchForMissingAlbums", + table: "MusicRequests"); + } + } +} diff --git a/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs b/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs index 46a00353e..172aadbac 100644 --- a/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs +++ b/src/Ombi.Store/Migrations/OmbiSqlite/OmbiSqliteContextModelSnapshot.cs @@ -427,76 +427,6 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.ToTable("RequestSubscription"); }); - modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("Approved") - .HasColumnType("INTEGER"); - - b.Property("ArtistName") - .HasColumnType("TEXT"); - - b.Property("Available") - .HasColumnType("INTEGER"); - - b.Property("Cover") - .HasColumnType("TEXT"); - - b.Property("Denied") - .HasColumnType("INTEGER"); - - b.Property("DeniedReason") - .HasColumnType("TEXT"); - - b.Property("Disk") - .HasColumnType("TEXT"); - - b.Property("ForeignAlbumId") - .HasColumnType("TEXT"); - - b.Property("ForeignArtistId") - .HasColumnType("TEXT"); - - b.Property("MarkedAsApproved") - .HasColumnType("TEXT"); - - b.Property("MarkedAsAvailable") - .HasColumnType("TEXT"); - - b.Property("MarkedAsDenied") - .HasColumnType("TEXT"); - - b.Property("Rating") - .HasColumnType("TEXT"); - - b.Property("ReleaseDate") - .HasColumnType("TEXT"); - - b.Property("RequestType") - .HasColumnType("INTEGER"); - - b.Property("RequestedByAlias") - .HasColumnType("TEXT"); - - b.Property("RequestedDate") - .HasColumnType("TEXT"); - - b.Property("RequestedUserId") - .HasColumnType("TEXT"); - - b.Property("Title") - .HasColumnType("TEXT"); - - b.HasKey("Id"); - - b.HasIndex("RequestedUserId"); - - b.ToTable("AlbumRequests"); - }); - modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => { b.Property("Id") @@ -736,6 +666,85 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.ToTable("MovieRequests"); }); + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Approved") + .HasColumnType("INTEGER"); + + b.Property("ArtistName") + .HasColumnType("TEXT"); + + b.Property("Available") + .HasColumnType("INTEGER"); + + b.Property("Cover") + .HasColumnType("TEXT"); + + b.Property("Denied") + .HasColumnType("INTEGER"); + + b.Property("DeniedReason") + .HasColumnType("TEXT"); + + b.Property("Disk") + .HasColumnType("TEXT"); + + b.Property("ForeignAlbumId") + .HasColumnType("TEXT"); + + b.Property("ForeignArtistId") + .HasColumnType("TEXT"); + + b.Property("MarkedAsApproved") + .HasColumnType("TEXT"); + + b.Property("MarkedAsAvailable") + .HasColumnType("TEXT"); + + b.Property("MarkedAsDenied") + .HasColumnType("TEXT"); + + b.Property("Monitor") + .HasColumnType("TEXT"); + + b.Property("Monitored") + .HasColumnType("INTEGER"); + + b.Property("Rating") + .HasColumnType("TEXT"); + + b.Property("ReleaseDate") + .HasColumnType("TEXT"); + + b.Property("RequestType") + .HasColumnType("INTEGER"); + + b.Property("RequestedByAlias") + .HasColumnType("TEXT"); + + b.Property("RequestedDate") + .HasColumnType("TEXT"); + + b.Property("RequestedUserId") + .HasColumnType("TEXT"); + + b.Property("SearchForMissingAlbums") + .HasColumnType("INTEGER"); + + b.Property("Title") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("RequestedUserId"); + + b.ToTable("MusicRequests"); + }); + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => { b.Property("Id") @@ -1060,15 +1069,6 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.Navigation("User"); }); - modelBuilder.Entity("Ombi.Store.Entities.Requests.AlbumRequest", b => - { - b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") - .WithMany() - .HasForeignKey("RequestedUserId"); - - b.Navigation("RequestedUser"); - }); - modelBuilder.Entity("Ombi.Store.Entities.Requests.ChildRequests", b => { b.HasOne("Ombi.Store.Entities.Requests.TvRequests", "ParentRequest") @@ -1135,6 +1135,15 @@ namespace Ombi.Store.Migrations.OmbiSqlite b.Navigation("RequestedUser"); }); + modelBuilder.Entity("Ombi.Store.Entities.Requests.MusicRequests", b => + { + b.HasOne("Ombi.Store.Entities.OmbiUser", "RequestedUser") + .WithMany() + .HasForeignKey("RequestedUserId"); + + b.Navigation("RequestedUser"); + }); + modelBuilder.Entity("Ombi.Store.Entities.Requests.RequestLog", b => { b.HasOne("Ombi.Store.Entities.OmbiUser", "User") diff --git a/src/Ombi.Store/Repository/Requests/IMusicRequestRepository.cs b/src/Ombi.Store/Repository/Requests/IMusicRequestRepository.cs index 28cb0b2f9..8506c283b 100644 --- a/src/Ombi.Store/Repository/Requests/IMusicRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/IMusicRequestRepository.cs @@ -4,14 +4,14 @@ using Ombi.Store.Entities.Requests; namespace Ombi.Store.Repository.Requests { - public interface IMusicRequestRepository : IRepository + public interface IMusicRequestRepository : IRepository { - IQueryable GetAll(string userId); - AlbumRequest GetRequest(string foreignAlbumId); - Task GetRequestAsync(string foreignAlbumId); - IQueryable GetWithUser(); - IQueryable GetWithUser(string userId); + IQueryable GetAll(string userId); + MusicRequests GetRequest(string foreignAlbumId); + Task GetRequestAsync(string foreignAlbumId); + IQueryable GetWithUser(); + IQueryable GetWithUser(string userId); Task Save(); - Task Update(AlbumRequest request); + Task Update(MusicRequests request); } } \ No newline at end of file diff --git a/src/Ombi.Store/Repository/Requests/MusicRequestRepository.cs b/src/Ombi.Store/Repository/Requests/MusicRequestRepository.cs index 95f855ef6..9bfaea25b 100644 --- a/src/Ombi.Store/Repository/Requests/MusicRequestRepository.cs +++ b/src/Ombi.Store/Repository/Requests/MusicRequestRepository.cs @@ -9,7 +9,7 @@ using Ombi.Store.Entities.Requests; namespace Ombi.Store.Repository.Requests { - public class MusicRequestRepository : Repository, IMusicRequestRepository + public class MusicRequestRepository : Repository, IMusicRequestRepository { public MusicRequestRepository(OmbiContext ctx) : base(ctx) { @@ -18,48 +18,58 @@ namespace Ombi.Store.Repository.Requests private OmbiContext Db { get; } - public Task GetRequestAsync(string foreignAlbumId) + public Task GetRequestAsync(string foreignAlbumId) { - return Db.AlbumRequests.Where(x => x.ForeignAlbumId == foreignAlbumId) + return Db.MusicRequests.Where(x => x.ForeignAlbumId == foreignAlbumId) .Include(x => x.RequestedUser) .FirstOrDefaultAsync(); } - public IQueryable GetAll(string userId) + public IQueryable GetAll(string userId) { return GetWithUser().Where(x => x.RequestedUserId == userId); } - public AlbumRequest GetRequest(string foreignAlbumId) + public MusicRequests GetRequest(string foreignAlbumId) { - return Db.AlbumRequests.Where(x => x.ForeignAlbumId == foreignAlbumId) + return Db.MusicRequests.Where(x => x.ForeignAlbumId == foreignAlbumId) .Include(x => x.RequestedUser) .FirstOrDefault(); } - public IQueryable GetWithUser() + public IQueryable GetWithUser() { - return Db.AlbumRequests + return Db.MusicRequests .Include(x => x.RequestedUser) .ThenInclude(x => x.NotificationUserIds) .AsQueryable(); } - public IQueryable GetWithUser(string userId) + public IQueryable GetWithUser(string userId) { - return Db.AlbumRequests + return Db.MusicRequests .Where(x => x.RequestedUserId == userId) .Include(x => x.RequestedUser) .ThenInclude(x => x.NotificationUserIds) .AsQueryable(); } - public async Task Update(AlbumRequest request) + public async Task Update(MusicRequests request) { if (Db.Entry(request).State == EntityState.Detached) { - Db.AlbumRequests.Attach(request); + Db.MusicRequests.Attach(request); + Db.Update(request); + } + await InternalSaveChanges(); + } + + public async Task UpdateArtist(MusicRequests request) + { + if (Db.Entry(request).State == EntityState.Detached) + { + Db.MusicRequests.Attach(request); Db.Update(request); } await InternalSaveChanges(); diff --git a/src/Ombi.sln b/src/Ombi.sln index 5149f020b..0ce34d97b 100644 --- a/src/Ombi.sln +++ b/src/Ombi.sln @@ -112,8 +112,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Hubs", "Ombi.Hubs\Ombi EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.GroupMe", "Ombi.Api.GroupMe\Ombi.Api.GroupMe.csproj", "{9266403C-B04D-4C0F-AC39-82F12C781949}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.MusicBrainz", "Ombi.Api.MusicBrainz\Ombi.Api.MusicBrainz.csproj", "{C5C1769B-4197-4410-A160-0EEF39EDDC98}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Twilio", "Ombi.Api.Twilio\Ombi.Api.Twilio.csproj", "{34E5DD1A-6A90-448B-9E71-64D1ACD6C1A3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.HealthChecks", "Ombi.HealthChecks\Ombi.HealthChecks.csproj", "{59D19538-0496-44EE-936E-EBBC22CF7B27}" @@ -431,6 +429,10 @@ Global {8F19C701-7881-4BC7-8BBA-B068A6B954AD}.NonUiBuild|Any CPU.Build.0 = NonUiBuild|Any CPU {8F19C701-7881-4BC7-8BBA-B068A6B954AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {8F19C701-7881-4BC7-8BBA-B068A6B954AD}.Release|Any CPU.Build.0 = Release|Any CPU + {0C81C423-25CC-4A91-ABE7-9C3F97770F69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C81C423-25CC-4A91-ABE7-9C3F97770F69}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C81C423-25CC-4A91-ABE7-9C3F97770F69}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C81C423-25CC-4A91-ABE7-9C3F97770F69}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.html b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.html index 5a6993e44..d0fa2c3a9 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.html +++ b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.html @@ -11,7 +11,7 @@ {{result.title}} - \ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts index 4de883256..040ba74f2 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/card/discover-card.component.ts @@ -27,6 +27,7 @@ export class DiscoverCardComponent implements OnInit { public loading: boolean; public requestable: boolean; + public monitored: boolean; // This data is needed to open the dialog private tvSearchResult: ISearchTvResultV2; @@ -42,6 +43,9 @@ export class DiscoverCardComponent implements OnInit { if (this.result.type == RequestType.movie) { this.getExtraMovieInfo(); } + if (this.result.type == RequestType.artist) { + this.getArtistInformation(); + } if (this.result.type == RequestType.album) { this.getAlbumInformation(); } @@ -54,7 +58,7 @@ export class DiscoverCardComponent implements OnInit { this.updateTvItem(this.tvSearchResult); } - public async getAlbumInformation() { + public async getArtistInformation() { this.searchService.getArtistInformation(this.result.id.toString()).subscribe(x => { if (x.poster) { this.result.posterPath = x.poster; @@ -63,14 +67,38 @@ export class DiscoverCardComponent implements OnInit { this.searchService.getReleaseGroupArt(this.result.id.toString()).subscribe(art => { if (art.image) { this.result.posterPath = art.image; - } }) } - this.result.title = x.startYear ? `${x.name} (${x.startYear})` : x.name; + this.result.title = x.name; this.result.overview = x.overview; this.fullyLoaded = true; - this.requestable = true; + if (x.monitored) { + this.requestable = false; + this.monitored = true; + } else { + this.requestable = true; + this.monitored = false; + } + }); + } + + public async getAlbumInformation() { + this.searchService.getAlbumInformation(this.result.id.toString()).subscribe(x => { + if (x.cover) { + this.result.posterPath = x.cover; + this.fullyLoaded = true; + } + this.result.title = x.title; + this.result.overview = x.overview; + this.fullyLoaded = true; + if (x.monitored) { + this.requestable = false; + this.monitored = true; + } else { + this.requestable = true; + this.monitored = false; + } }); } @@ -80,8 +108,10 @@ export class DiscoverCardComponent implements OnInit { return `/details/movie/${this.result.id}`; case RequestType.tvShow: return `/details/tv/${this.result.id}`; - case RequestType.album: //Actually artist + case RequestType.artist: //Actually artist return `/details/artist/${this.result.id}`; + case RequestType.album: + return `/details/album/${this.result.id}`; } } @@ -115,6 +145,27 @@ export class DiscoverCardComponent implements OnInit { event.preventDefault(); this.loading = true; switch (this.result.type) { + case RequestType.artist: + this.requestService.requestArtist({ foreignArtistId: this.result.id.toString(), monitored: true, monitor: "all", searchForMissingAlbums: true }).subscribe(x => { + if (x.result) { + this.result.requested = true; + this.messageService.send(x.message, "Ok"); + } else { + this.messageService.send(x.errorMessage, "Ok"); + } + this.loading = false; + }); + return; + case RequestType.album: + this.requestService.requestAlbum({foreignAlbumId: this.result.id.toString(), monitor: 'all', monitored: true, searchForMissingAlbums: false}).subscribe(x => { + if (x.result) { + this.result.requested = true; + this.messageService.send(x.message, "Ok"); + } else { + this.messageService.send(x.errorMessage, "Ok"); + } + this.loading = false; + }); case RequestType.tvShow: const dia = this.dialog.open(EpisodeRequestComponent, { width: "700px", data: { series: this.tvSearchResult, isAdmin: this.isAdmin }, panelClass: 'modal-panel' }); dia.afterClosed().subscribe(x => this.loading = false); diff --git a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts index f0258b97d..cbc9c3dad 100644 --- a/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts +++ b/src/Ombi/ClientApp/src/app/discover/components/search-results/search-results.component.ts @@ -87,6 +87,8 @@ export class DiscoverSearchResultsComponent implements OnInit { } else if (m.mediaType == "tv") { mediaType = RequestType.tvShow; } else if (m.mediaType == "Artist") { + mediaType = RequestType.artist; + } else if (m.mediaType == "Album") { mediaType = RequestType.album; } @@ -98,10 +100,13 @@ export class DiscoverSearchResultsComponent implements OnInit { if (mediaType === RequestType.tvShow) { poster = "images/default_tv_poster.png" } + if (mediaType === RequestType.album || mediaType === RequestType.artist) { + poster = "images/default-music-placeholder.png"; + } } this.discoverResults.push({ - posterPath: mediaType !== RequestType.album ? poster : "images/default-music-placeholder.png", + posterPath: poster, requested: false, title: m.title, type: mediaType, @@ -154,6 +159,9 @@ export class DiscoverSearchResultsComponent implements OnInit { if (mediaType === RequestType.tvShow) { poster = "images/default_tv_poster.png" } + if (mediaType === RequestType.album || mediaType === RequestType.artist) { + poster = "images/default-music-placeholder.png"; + } } this.discoverResults.push({ diff --git a/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts b/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts index ca8f62c1e..492996ef3 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/IMusicSearchResultV2.ts @@ -15,6 +15,29 @@ export interface IArtistSearchResult { links: IArtistLinks; members: IBandMembers[]; overview: string; + monitored: boolean; + + background: any; +} + +export interface IAlbumSearchResult { + title: string; + id: string; + startYear: string; + endYear: string; + type: string; + country: string; + region: string; + disambiguation: string; + banner: string; + logo: string; + cover: string; + fanArt: string; + releaseGroups: IReleaseGroups[]; + links: IArtistLinks; + members: IBandMembers[]; + overview: string; + monitored: boolean; background: any; } diff --git a/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts b/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts index 440e0d5b2..da674ada7 100644 --- a/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts +++ b/src/Ombi/ClientApp/src/app/interfaces/IRequestModel.ts @@ -3,7 +3,8 @@ export enum RequestType { tvShow = 0, movie = 1, - album = 2, + artist = 2, + album = 3 } // NEW WORLD @@ -44,6 +45,16 @@ export interface IAlbumRequest extends IBaseRequest { export interface IAlbumRequestModel { foreignAlbumId: string; + monitored: boolean; + monitor: string; + searchForMissingAlbums: boolean; +} + +export interface IArtistRequestModel { + foreignArtistId: string; + monitored: boolean; + monitor: string; + searchForMissingAlbums: boolean; } export interface IRequestsViewModel { diff --git a/src/Ombi/ClientApp/src/app/issues/components/details/details.component.ts b/src/Ombi/ClientApp/src/app/issues/components/details/details.component.ts index 12ceb422e..b41a68a84 100644 --- a/src/Ombi/ClientApp/src/app/issues/components/details/details.component.ts +++ b/src/Ombi/ClientApp/src/app/issues/components/details/details.component.ts @@ -80,8 +80,9 @@ export class IssuesDetailsComponent implements OnInit { this.router.navigate(['/details/movie/', this.providerId]); return; - case RequestType.album: - this.router.navigate(['/details/artist/', this.providerId]); + + case RequestType.artist: + this.router.navigate(['/details/artist/', firstIssue.providerId]); return; case RequestType.tvShow: diff --git a/src/Ombi/ClientApp/src/app/media-details/components/album/album-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/album/album-details.component.html new file mode 100644 index 000000000..cffd2ac1d --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/components/album/album-details.component.html @@ -0,0 +1,205 @@ +
+ +
+ +
+ + + +
+
+ +
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ +
+ + + +
+
+
+ + +

{{album.title}} - {{album.disambiguation}}

+
+ {{album.overview}} +
+
+
+
+ + + + + + + +
+
+ + + + +
+ + + + +
+
+
+ + + + + + + + +
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/media-details/components/album/album-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/album/album-details.component.ts new file mode 100644 index 000000000..eb0914f1a --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/components/album/album-details.component.ts @@ -0,0 +1,126 @@ +import { Component, ViewEncapsulation } from "@angular/core"; +import { ImageService, SearchV2Service, RequestService, MessageService } from "../../../services"; +import { ActivatedRoute } from "@angular/router"; +import { DomSanitizer } from "@angular/platform-browser"; +import { MatDialog } from "@angular/material/dialog"; +import { YoutubeTrailerComponent } from "../shared/youtube-trailer.component"; +import { AuthService } from "../../../auth/auth.service"; +import { DenyDialogComponent } from "../shared/deny-dialog/deny-dialog.component"; +import { NewIssueComponent } from "../shared/new-issue/new-issue.component"; +import { IAlbumSearchResult, IReleaseGroups } from "../../../interfaces/IMusicSearchResultV2"; + +@Component({ + templateUrl: "./album-details.component.html", + styleUrls: ["../../media-details.component.scss"], + encapsulation: ViewEncapsulation.None +}) +export class AlbumDetailsComponent { + private albumId: string; + + public album: IAlbumSearchResult = null; + private selectedAlbums: IReleaseGroups[] = []; + + public isAdmin: boolean; + + constructor(private searchService: SearchV2Service, private route: ActivatedRoute, + private sanitizer: DomSanitizer, private imageService: ImageService, + public dialog: MatDialog, private requestService: RequestService, + public messageService: MessageService, private auth: AuthService) { + this.route.params.subscribe((params: any) => { + this.albumId = params.albumId; + this.load(); + }); + } + + public load() { + this.isAdmin = this.auth.hasRole("admin") || this.auth.hasRole("poweruser"); + this.searchService.getAlbumInformation(this.albumId).subscribe(x => this.album = x); + } + + public getBackground(): string { + if (this.album.cover) { + this.album.background = this.sanitizer.bypassSecurityTrustStyle + ("url(" + this.album.cover + ")"); + return this.album.background + } + + return this.album.background + } + + public async requestAlbum() { + if (this.album.monitored) { + return; + } + this.requestService.requestAlbum({ + foreignAlbumId: this.album.id, + monitored: true, + monitor: "existing", + searchForMissingAlbums: true + }).toPromise() + .then(r => { + if (r.result) { + this.album.monitored = true; + this.messageService.send(r.message); + } else { + this.messageService.send(r.errorMessage); + } + }) + .catch(r => { + console.log(r); + this.messageService.send("Error when requesting album"); + }); + // const + } + + public openDialog() { + this.dialog.open(YoutubeTrailerComponent, { + width: '560px', + // data: this.movie.videos.results[0].key + }); + } + + public async deny() { + const dialogRef = this.dialog.open(DenyDialogComponent, { + width: '250px', + // data: {requestId: this.movieRequest.id, requestType: RequestType.movie} + }); + + dialogRef.afterClosed().subscribe(result => { + // this.movieRequest.denied = result; + // if(this.movieRequest.denied) { + // this.movie.approved = false; + // } + }); + } + + public async issue() { + const dialogRef = this.dialog.open(NewIssueComponent, { + width: '500px', + // data: {requestId: this.movieRequest ? this.movieRequest.id : null, requestType: RequestType.movie, imdbid: this.movie.imdbId} + }); + } + + public async approve() { + // const result = await this.requestService.approveMovie({ id: this.movieRequest.id }).toPromise(); + // if (result.result) { + // this.movie.approved = false; + // this.messageService.send("Successfully Approved", "Ok"); + // } else { + // this.messageService.send(result.errorMessage, "Ok"); + // } + } + + public async markAvailable() { + // const result = await this.requestService.markMovieAvailable({id: this.movieRequest.id}).toPromise(); + // if (result.result) { + // // this.movie.available = true; + // this.messageService.send(result.message, "Ok"); + // } else { + // this.messageService.send(result.errorMessage, "Ok"); + // } + } + + public setAdvancedOptions(data: any) { + // this.advancedOptions = data; + } +} diff --git a/src/Ombi/ClientApp/src/app/media-details/components/album/panels/album-information-panel/album-information-panel.component.html b/src/Ombi/ClientApp/src/app/media-details/components/album/panels/album-information-panel/album-information-panel.component.html new file mode 100644 index 000000000..a2940f918 --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/components/album/panels/album-information-panel/album-information-panel.component.html @@ -0,0 +1,14 @@ +
+
+ Type: +
{{album.type}}
+
+
+ Country +
{{album.country}}
+
+
+ Release Date +
{{album.startYear}}
+
+
\ No newline at end of file diff --git a/src/Ombi/ClientApp/src/app/media-details/components/album/panels/album-information-panel/album-information-panel.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/album/panels/album-information-panel/album-information-panel.component.ts new file mode 100644 index 000000000..e7d88148b --- /dev/null +++ b/src/Ombi/ClientApp/src/app/media-details/components/album/panels/album-information-panel/album-information-panel.component.ts @@ -0,0 +1,12 @@ +import { Component, Input, ViewEncapsulation } from "@angular/core"; +import { ISearchArtistResult } from "../../../../../interfaces"; + +@Component({ + templateUrl: "./album-information-panel.component.html", + styleUrls: ["../../../../media-details.component.scss"], + selector: "album-information-panel", + encapsulation: ViewEncapsulation.None +}) +export class AlbumInformationPanel { + @Input() public album: ISearchAlbumResult; +} diff --git a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html index 1a7db7f91..3a7b8fb6d 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.html @@ -16,73 +16,22 @@
- +
- - - - - - - - - - - - - - - - - + +
-
+
@@ -106,7 +55,7 @@
- +
@@ -119,78 +68,6 @@
- - - - -
diff --git a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.ts index 5aebde2e5..d1e4f7f30 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/artist/artist-details.component.ts @@ -1,4 +1,4 @@ -import { Component } from "@angular/core"; +import { Component, ViewEncapsulation } from "@angular/core"; import { ImageService, SearchV2Service, RequestService, MessageService } from "../../../services"; import { ActivatedRoute } from "@angular/router"; import { DomSanitizer } from "@angular/platform-browser"; @@ -13,6 +13,7 @@ import { TranslateService } from "@ngx-translate/core"; @Component({ templateUrl: "./artist-details.component.html", styleUrls: ["../../media-details.component.scss"], + encapsulation: ViewEncapsulation.None }) export class ArtistDetailsComponent { private artistId: string; @@ -89,7 +90,10 @@ export class ArtistDetailsComponent { return; } this.requestService.requestAlbum({ - foreignAlbumId : a.id + foreignAlbumId : a.id, + monitored: true, + monitor: "all", + searchForMissingAlbums: true }).toPromise() .then(r => { if (r.result) { @@ -112,7 +116,10 @@ export class ArtistDetailsComponent { return; } this.requestService.requestAlbum({ - foreignAlbumId : a.id + foreignAlbumId : a.id, + monitored: true, + monitor: "all", + searchForMissingAlbums: true }).toPromise() .then(r => { if (r.result) { diff --git a/src/Ombi/ClientApp/src/app/media-details/components/index.ts b/src/Ombi/ClientApp/src/app/media-details/components/index.ts index eadc8d635..d5a14e611 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/index.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/index.ts @@ -1,4 +1,20 @@ -import { IssuesService, RadarrService, RequestService, SearchService, SonarrService } from "../../services"; + +import { MovieDetailsComponent } from "./movie/movie-details.component"; +import { YoutubeTrailerComponent } from "./shared/youtube-trailer.component"; +import { TvDetailsComponent } from "./tv/tv-details.component"; +import { MovieInformationPanelComponent } from "./movie/panels/movie-information-panel.component"; +import { TvInformationPanelComponent } from "./tv/panels/tv-information-panel/tv-information-panel.component"; +import { TopBannerComponent } from "./shared/top-banner/top-banner.component"; +import { SocialIconsComponent } from "./shared/social-icons/social-icons.component"; +import { MediaPosterComponent } from "./shared/media-poster/media-poster.component"; +import { CastCarouselComponent } from "./shared/cast-carousel/cast-carousel.component"; +import { DenyDialogComponent } from "./shared/deny-dialog/deny-dialog.component"; +import { TvRequestsPanelComponent } from "./tv/panels/tv-requests/tv-requests-panel.component"; +import { MovieAdvancedOptionsComponent } from "./movie/panels/movie-advanced-options/movie-advanced-options.component"; +import { SearchService, RequestService, RadarrService, IssuesService, SonarrService } from "../../services"; +import { RequestServiceV2 } from "../../services/requestV2.service"; +import { NewIssueComponent } from "./shared/new-issue/new-issue.component"; +import { AlbumDetailsComponent } from "./album/album-details.component"; import { ArtistDetailsComponent } from "./artist/artist-details.component"; import { ArtistInformationPanel } from "./artist/panels/artist-information-panel/artist-information-panel.component"; @@ -37,6 +53,7 @@ export const components: any[] = [ MovieAdvancedOptionsComponent, TvAdvancedOptionsComponent, NewIssueComponent, + AlbumDetailsComponent, ArtistDetailsComponent, ArtistInformationPanel, ArtistReleasePanel, diff --git a/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts b/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts index 3132ac84f..349f40d0e 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts +++ b/src/Ombi/ClientApp/src/app/media-details/components/shared/deny-dialog/deny-dialog.component.ts @@ -27,7 +27,7 @@ export class DenyDialogComponent { if(this.data.requestType == RequestType.tvShow) { result = await this.requestService.denyChild({id: this.data.requestId, reason: this.denyReason }).toPromise(); } - if(this.data.requestType == RequestType.album) { + if(this.data.requestType == RequestType.artist) { result = await this.requestService.denyAlbum({id: this.data.requestId, reason: this.denyReason }).toPromise(); } diff --git a/src/Ombi/ClientApp/src/app/media-details/components/shared/media-poster/media-poster.component.html b/src/Ombi/ClientApp/src/app/media-details/components/shared/media-poster/media-poster.component.html index f0a6f04ea..58df8fb58 100644 --- a/src/Ombi/ClientApp/src/app/media-details/components/shared/media-poster/media-poster.component.html +++ b/src/Ombi/ClientApp/src/app/media-details/components/shared/media-poster/media-poster.component.html @@ -2,7 +2,7 @@