From e837e905b6e401fc3ad5a2126ff91f99b4ac38e8 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sun, 31 Jan 2021 19:39:40 +0330 Subject: [PATCH] adding fields to PoemMusicTrackViewModel to be used in moderation process --- .../ViewModels/PoemMusicTrackViewModel.cs | 15 +++++++++++++++ RMuseum/RMuseum.xml | 15 +++++++++++++++ .../Services/Implementation/GanjoorService.cs | 19 ++++++++++++++++--- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/RMuseum/Models/Ganjoor/ViewModels/PoemMusicTrackViewModel.cs b/RMuseum/Models/Ganjoor/ViewModels/PoemMusicTrackViewModel.cs index da8baf4b..afb86da8 100644 --- a/RMuseum/Models/Ganjoor/ViewModels/PoemMusicTrackViewModel.cs +++ b/RMuseum/Models/Ganjoor/ViewModels/PoemMusicTrackViewModel.cs @@ -65,6 +65,21 @@ /// public int GolhaTrackId { get; set; } + /// + /// approved + /// + public bool Approved { get; set; } + + /// + /// instead of deleting rejected songs keep track of them + /// + public bool Rejected { get; set; } + + /// + /// rejection cause + /// + public string RejectionCause { get; set; } + /// /// to string /// diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index 56e814dd..17bbed6d 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -4309,6 +4309,21 @@ golha id + + + approved + + + + + instead of deleting rejected songs keep track of them + + + + + rejection cause + + to string diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index b1a4f53d..17d4e676 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -748,7 +748,10 @@ namespace RMuseum.Services.Implementation TrackUrl = t.TrackUrl, Description = t.Description, BrokenLink = t.BrokenLink, - GolhaTrackId = t.GolhaTrackId == null ? 0 : (int)t.GolhaTrackId + GolhaTrackId = t.GolhaTrackId == null ? 0 : (int)t.GolhaTrackId, + Approved = t.Approved, + Rejected = t.Rejected, + RejectionCause = t.RejectionCause } ).ToArrayAsync() @@ -770,6 +773,10 @@ namespace RMuseum.Services.Implementation { try { + song.Approved = false; + song.Rejected = false; + song.RejectionCause = ""; + song.BrokenLink = false; if(song.TrackType == PoemMusicTrackType.Golha) { var golhaTrack = await _context.GolhaTracks.Include(g => g.GolhaProgram).ThenInclude(p => p.GolhaCollection).Where(g => g.Id == song.GolhaTrackId).FirstOrDefaultAsync(); @@ -812,7 +819,10 @@ namespace RMuseum.Services.Implementation TrackUrl = song.TrackUrl, SuggestedById = userId, Description = song.Description, - GolhaTrackId = song.TrackType == PoemMusicTrackType.Golha ? song.GolhaTrackId : (int?)null + GolhaTrackId = song.TrackType == PoemMusicTrackType.Golha ? song.GolhaTrackId : (int?)null, + Approved = false, + Rejected = false, + RejectionCause = "" }; GanjoorSinger singer = await _context.GanjoorSingers.Where(s => s.Url == song.ArtistUrl).FirstOrDefaultAsync(); @@ -867,7 +877,10 @@ namespace RMuseum.Services.Implementation TrackUrl = song.TrackUrl, Description = song.Description, GolhaTrackId = song.TrackType == PoemMusicTrackType.Golha ? (int)song.GolhaTrackId : 0, - BrokenLink = song.BrokenLink + BrokenLink = song.BrokenLink, + Approved = song.Approved, + Rejected = song.Rejected, + RejectionCause = song.RejectionCause } ); }