fix(rd21): guard career and job saves with durable revisions

This commit is contained in:
cesnimda
2026-10-23 08:07:23 +02:00
parent 8f2cad67f7
commit 12f342c09c
32 changed files with 1185 additions and 277 deletions
@@ -47,7 +47,7 @@ public sealed class CareerProfileControllerTests
{
var (controller, _, user) = Build();
var put = await controller.Put(new CareerProfileSaveRequest(Sample(), null), CancellationToken.None);
var put = await controller.Put(new CareerProfileSaveRequest(Sample(), null, 0), CancellationToken.None);
Assert.IsType<OkObjectResult>(put.Result);
// The derived blob projection is kept in sync for legacy readers.
@@ -78,7 +78,7 @@ public sealed class CareerProfileControllerTests
Notes = "Used with distributed teams",
});
var put = await controller.Put(new CareerProfileSaveRequest(profile, null), CancellationToken.None);
var put = await controller.Put(new CareerProfileSaveRequest(profile, null, 0), CancellationToken.None);
var saved = Assert.IsType<CareerProfileDto>(Assert.IsType<OkObjectResult>(put.Result).Value).Profile;
var get = await controller.Get(CancellationToken.None);
var reloaded = Assert.IsType<CareerProfileDto>(Assert.IsType<OkObjectResult>(get.Result).Value).Profile;
@@ -104,7 +104,7 @@ public sealed class CareerProfileControllerTests
public async Task Get_reports_completeness_with_missing_sections()
{
var (controller, _, _) = Build();
await controller.Put(new CareerProfileSaveRequest(Sample(), null), CancellationToken.None); // has personal + experience + skills
await controller.Put(new CareerProfileSaveRequest(Sample(), null, 0), CancellationToken.None); // has personal + experience + skills
var get = await controller.Get(CancellationToken.None);
var dto = Assert.IsType<CareerProfileDto>(Assert.IsType<OkObjectResult>(get.Result).Value);
@@ -121,7 +121,7 @@ public sealed class CareerProfileControllerTests
var huge = new StructuredCvProfile();
for (var i = 0; i < 500; i++) huge.Skills.Add($"skill-{i}");
var put = await controller.Put(new CareerProfileSaveRequest(huge, null), CancellationToken.None);
var put = await controller.Put(new CareerProfileSaveRequest(huge, null, 0), CancellationToken.None);
Assert.IsType<BadRequestObjectResult>(put.Result);
}
@@ -133,7 +133,7 @@ public sealed class CareerProfileControllerTests
var profile = Sample();
profile.Contact.Website = $"https://example.test/{new string('a', 600)}";
var put = await controller.Put(new CareerProfileSaveRequest(profile, null), CancellationToken.None);
var put = await controller.Put(new CareerProfileSaveRequest(profile, null, 0), CancellationToken.None);
var badRequest = Assert.IsType<BadRequestObjectResult>(put.Result);
Assert.Equal("A contact field exceeds the allowed length.", badRequest.Value);
@@ -144,7 +144,7 @@ public sealed class CareerProfileControllerTests
{
var (controller, _, _) = Build();
var put = await controller.Put(new CareerProfileSaveRequest(new StructuredCvProfile(), null), CancellationToken.None);
var put = await controller.Put(new CareerProfileSaveRequest(new StructuredCvProfile(), null, 0), CancellationToken.None);
// Completeness, not validation, is what flags an incomplete profile — an empty profile saves.
Assert.IsType<OkObjectResult>(put.Result);