From 3f65ff1af52e580c62b719f5bce262cca41b114e Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Fri, 14 Feb 2025 16:40:41 +0330 Subject: [PATCH] #467 DeleteCatCorrectionsAsync --- RMuseum/RMuseum.xml | 8 ++++++++ .../Services/Implementation/GanjoorService.cs | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml index f3ddaec3..c3f63787 100644 --- a/RMuseum/RMuseum.xml +++ b/RMuseum/RMuseum.xml @@ -20600,6 +20600,14 @@ + + + delete unreviewed user corrections for a cat + + + + + aggressive cache diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs index a923b061..1d2f169b 100644 --- a/RMuseum/Services/Implementation/GanjoorService.cs +++ b/RMuseum/Services/Implementation/GanjoorService.cs @@ -3916,6 +3916,25 @@ namespace RMuseum.Services.Implementation return new RServiceResult(correction); } + /// + /// delete unreviewed user corrections for a cat + /// + /// + /// + /// + public async Task> 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(true); + } + /// /// aggressive cache