fix(documents): reject profile changes during submitted CV rendering

This commit is contained in:
cesnimda
2026-11-11 18:31:58 +01:00
parent dbae196291
commit 2cd561d71d
2 changed files with 64 additions and 0 deletions
@@ -81,6 +81,10 @@ public sealed class SubmittedApplicationPackageService : ISubmittedApplicationPa
.Select(v => new { v.Version, v.SettingsJson }).SingleOrDefaultAsync(ct);
if (render is null || current is null || current.Version != variant.Version || current.SettingsJson != variant.SettingsJson)
throw new DbUpdateConcurrencyException("The selected CV changed before the submitted package could be captured.");
var currentProfile = await _db.CareerProfiles.AsNoTracking().Where(p => p.OwnerUserId == ownerUserId)
.Select(p => new { p.Version, p.ProfileJson }).FirstOrDefaultAsync(ct);
if (currentProfile?.Version != profile?.Version || currentProfile?.ProfileJson != profile?.ProfileJson)
throw new DbUpdateConcurrencyException("The Career Profile changed before the submitted package could be captured.");
}
var version = (await _db.SubmittedApplicationPackages.AsNoTracking()
.Where(x => x.OwnerUserId == ownerUserId && x.JobApplicationId == jobApplicationId)