#467 DeleteCatCorrectionsAsync

This commit is contained in:
Hamid Reza Mohammadi 2025-02-14 16:40:41 +03:30
parent 2cb078efc4
commit 3f65ff1af5
2 changed files with 27 additions and 0 deletions

View File

@ -20600,6 +20600,14 @@
<param name="correction"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.DeleteCatCorrectionsAsync(System.Guid,System.Int32)">
<summary>
delete unreviewed user corrections for a cat
</summary>
<param name="userId"></param>
<param name="catId"></param>
<returns></returns>
</member>
<member name="P:RMuseum.Services.Implementation.GanjoorService.AggressiveCacheEnabled">
<summary>
aggressive cache

View File

@ -3916,6 +3916,25 @@ namespace RMuseum.Services.Implementation
return new RServiceResult<GanjoorCatCorrectionViewModel>(correction);
}
/// <summary>
/// delete unreviewed user corrections for a cat
/// </summary>
/// <param name="userId"></param>
/// <param name="catId"></param>
/// <returns></returns>
public async Task<RServiceResult<bool>> DeleteCatCorrectionsAsync(Guid userId, int catId)
{
var preCorrections = await _context.GanjoorCatCorrections
.Where(c => c.UserId == userId && c.CatId == catId && c.Reviewed == false)
.ToListAsync();
if (preCorrections.Count > 0)
{
_context.GanjoorCatCorrections.RemoveRange(preCorrections);
await _context.SaveChangesAsync();
}
return new RServiceResult<bool>(true);
}
/// <summary>
/// aggressive cache