From 921663364490bce9d81cbf2bba883cc1e4b5d7ea Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sun, 30 Mar 2025 15:07:45 +0330 Subject: [PATCH] RemoveUserData fix --- .../Services/Implementation/GanjoorAppUserService.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/RMuseum/Services/Implementation/GanjoorAppUserService.cs b/RMuseum/Services/Implementation/GanjoorAppUserService.cs index 15c41330..1decff5c 100644 --- a/RMuseum/Services/Implementation/GanjoorAppUserService.cs +++ b/RMuseum/Services/Implementation/GanjoorAppUserService.cs @@ -341,6 +341,18 @@ namespace RMuseum.Services.Implementation context.UpdateRange(reviewedSectionCorrections); await context.SaveChangesAsync(); + var suggestedCatCorrections = await context.GanjoorCatCorrections.Where(c => c.UserId == userId).ToListAsync(); + foreach (var suggestedCatCorrection in suggestedCatCorrections) + suggestedCatCorrection.UserId = deletedUserId; + context.UpdateRange(suggestedCatCorrections); + await context.SaveChangesAsync(); + + var reviewedCatCorrections = await context.GanjoorCatCorrections.Where(c => c.ReviewerUserId == userId).ToListAsync(); + foreach (var reviewedCatCorrection in reviewedCatCorrections) + reviewedCatCorrection.ReviewerUserId = deletedUserId; + context.UpdateRange(reviewedCatCorrections); + await context.SaveChangesAsync(); + var reportedComments = await context.GanjoorReportedComments.Where(r => r.ReportedById == userId).ToListAsync(); foreach (var reportedComment in reportedComments) reportedComment.ReportedById = deletedUserId;