Enhance audit logging: add new audit types for password reset and prospect image actions, and update related services to log these events

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
a.beging@eas-solutions.de
2026-04-29 15:57:30 +02:00
parent 0dd0c1bf4c
commit 6807f2b6e6
7 changed files with 71 additions and 3 deletions

View File

@@ -290,6 +290,8 @@ namespace FoodsharingSiegen.Server.Data.Service
await Context.ProspectImages!.AddAsync(image);
await Context.SaveChangesAsync();
await AuditService.Insert(AuditType.UploadProspectImage, prospect.Name);
return new();
}
catch (Exception e)
@@ -308,6 +310,16 @@ namespace FoodsharingSiegen.Server.Data.Service
.OrderBy(x => x.Created)
.ToListAsync();
var prospectName = await Context.Prospects!
.Where(x => x.Id == prospectId)
.Select(x => x.Name)
.FirstOrDefaultAsync();
if (!string.IsNullOrEmpty(prospectName))
{
await AuditService.Insert(AuditType.ViewProspectImages, prospectName);
}
return new(images);
}
catch (Exception e)
@@ -329,6 +341,7 @@ namespace FoodsharingSiegen.Server.Data.Service
if (prospect != null)
{
prospect.VerificationToken = null; // Clear token when images are deleted
await AuditService.Insert(AuditType.DeleteProspectImages, prospect.Name);
}
await Context.SaveChangesAsync();