@70 adding rejected field to PoemMusicTrack + service method for retrieving next unreviewed suggested song
This commit is contained in:
parent
8cf06bb7f9
commit
a7727f3d43
2072
RMuseum/Migrations/20210128111216_PoemMusicTrack-Rejected.Designer.cs
generated
Normal file
2072
RMuseum/Migrations/20210128111216_PoemMusicTrack-Rejected.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
32
RMuseum/Migrations/20210128111216_PoemMusicTrack-Rejected.cs
Normal file
32
RMuseum/Migrations/20210128111216_PoemMusicTrack-Rejected.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace RMuseum.Migrations
|
||||
{
|
||||
public partial class PoemMusicTrackRejected : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Rejected",
|
||||
table: "GanjoorPoemMusicTracks",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RejectionCause",
|
||||
table: "GanjoorPoemMusicTracks",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Rejected",
|
||||
table: "GanjoorPoemMusicTracks");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RejectionCause",
|
||||
table: "GanjoorPoemMusicTracks");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -589,6 +589,12 @@ namespace RMuseum.Migrations
|
||||
b.Property<int>("PoemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Rejected")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("RejectionCause")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("SingerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ namespace RMuseum.Models.Auth.Memory
|
||||
Description = "محتوای گنجور",
|
||||
Operations = new SecurableItemOperation[]
|
||||
{
|
||||
new SecurableItemOperation(ReviewSongs, "بازبینی آهنگهای مرتبط", false),
|
||||
new SecurableItemOperation(ReviewSongs, "بازبینی آهنگهای پیشنهادی", false),
|
||||
new SecurableItemOperation(ImportOperationShortName, "ورود اطلاعات از منابع خارجی", false),
|
||||
}
|
||||
},
|
||||
|
||||
@ -121,5 +121,15 @@ namespace RMuseum.Models.Ganjoor
|
||||
/// broken link
|
||||
/// </summary>
|
||||
public bool BrokenLink { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// instead of deleting rejected songs keep track of them
|
||||
/// </summary>
|
||||
public bool Rejected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// rejection cause
|
||||
/// </summary>
|
||||
public string RejectionCause { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -3863,6 +3863,16 @@
|
||||
broken link
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.Rejected">
|
||||
<summary>
|
||||
instead of deleting rejected songs keep track of them
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:RMuseum.Models.Ganjoor.PoemMusicTrack.RejectionCause">
|
||||
<summary>
|
||||
rejection cause
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:RMuseum.Models.Ganjoor.PoemMusicTrackType">
|
||||
<summary>
|
||||
poem music track type
|
||||
@ -5650,6 +5660,13 @@
|
||||
<param name="trackType"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetNextUnreviewedSong(System.Int32)">
|
||||
<summary>
|
||||
next unreviewed track
|
||||
</summary>
|
||||
<param name="skip"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.SuggestSong(System.Guid,RMuseum.Models.Ganjoor.ViewModels.PoemMusicTrackViewModel)">
|
||||
<summary>
|
||||
suggest song
|
||||
@ -6491,6 +6508,13 @@
|
||||
<param name="song"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetNextUnreviewedSong(System.Int32)">
|
||||
<summary>
|
||||
next unreviewed track
|
||||
</summary>
|
||||
<param name="skip"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.Faal">
|
||||
<summary>
|
||||
get a random poem from hafez
|
||||
|
||||
@ -115,6 +115,13 @@ namespace RMuseum.Services
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<PoemMusicTrackViewModel[]>> GetPoemSongs(int id, bool approved, PoemMusicTrackType trackType = PoemMusicTrackType.All);
|
||||
|
||||
/// <summary>
|
||||
/// next unreviewed track
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<PoemMusicTrackViewModel>> GetNextUnreviewedSong(int skip);
|
||||
|
||||
/// <summary>
|
||||
/// suggest song
|
||||
/// </summary>
|
||||
@ -124,8 +131,6 @@ namespace RMuseum.Services
|
||||
Task<RServiceResult<PoemMusicTrackViewModel>> SuggestSong(Guid userId, PoemMusicTrackViewModel song);
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// get a random poem from hafez
|
||||
/// </summary>
|
||||
|
||||
@ -728,6 +728,8 @@ namespace RMuseum.Services.Implementation
|
||||
&&
|
||||
t.Approved == approved
|
||||
&&
|
||||
t.Rejected == false
|
||||
&&
|
||||
(trackType == PoemMusicTrackType.All || t.TrackType == trackType)
|
||||
)
|
||||
.OrderBy(t => t.Id)
|
||||
@ -834,6 +836,46 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// next unreviewed track
|
||||
/// </summary>
|
||||
/// <param name="skip"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<PoemMusicTrackViewModel>> GetNextUnreviewedSong(int skip)
|
||||
{
|
||||
try
|
||||
{
|
||||
var song = await _context.GanjoorPoemMusicTracks.Where(p => p.Approved == false && p.Rejected == false).OrderBy(p => p.Id).Skip(skip).FirstOrDefaultAsync();
|
||||
if(song != null)
|
||||
{
|
||||
return new RServiceResult<PoemMusicTrackViewModel>
|
||||
(
|
||||
new PoemMusicTrackViewModel()
|
||||
{
|
||||
Id = song.Id,
|
||||
TrackType = song.TrackType,
|
||||
PoemId = song.PoemId,
|
||||
ArtistName = song.ArtistName,
|
||||
ArtistUrl = song.ArtistUrl,
|
||||
AlbumName = song.AlbumName,
|
||||
AlbumUrl = song.AlbumUrl,
|
||||
TrackName = song.TrackName,
|
||||
TrackUrl = song.TrackUrl,
|
||||
Description = song.Description,
|
||||
GolhaTrackId = song.TrackType == PoemMusicTrackType.Golha ? (int)song.GolhaTrackId : 0,
|
||||
BrokenLink = song.BrokenLink
|
||||
}
|
||||
);
|
||||
}
|
||||
return new RServiceResult<PoemMusicTrackViewModel>(null); //not found
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<PoemMusicTrackViewModel>(null, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get a random poem from hafez
|
||||
/// </summary>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user