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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user