Eine auf einem Gerät zurückgestellte Warnung stand auf den anderen weiter rot oben, weil DashboardWarningSnooze bewusst lokal gehalten war. Save löst jetzt db.OnChange aus, EventApplier übernimmt den Typ. Die Id wird aus (StudentId, WarningTag) abgeleitet, damit zwei Geräte denselben Datensatz beschreiben statt am Unique-Index ux_student_tag zu kollidieren; Schema-Migration 7 schlüsselt bestehende lokale Einträge um. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9a84bbaa38
commit
7d8deaf79c
10 files changed
+140
-11
No files matched your search
@@ -77,4 +77,26 @@ public sealed class ChangeHookTests
|
||||
Assert.Equal("Save", call.Operation);
|
||||
Assert.Same(state, call.Payload);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DashboardWarningSnoozeRepository_Save_LoestOnChangeAus()
|
||||
{
|
||||
using var db = NewInMemoryContext();
|
||||
var calls = new List<(string EntityType, string EntityId, string Operation, object? Payload)>();
|
||||
db.OnChange = (type, id, op, payload) => calls.Add((type, id, op, payload));
|
||||
var repo = new DashboardWarningSnoozeRepository(db);
|
||||
var studentId = Guid.NewGuid();
|
||||
var snooze = new DashboardWarningSnooze
|
||||
{
|
||||
StudentId = studentId, WarningTag = "Absentismus", SnoozedUntil = new DateOnly(2026, 10, 12),
|
||||
};
|
||||
|
||||
repo.Save(snooze);
|
||||
|
||||
var call = Assert.Single(calls);
|
||||
Assert.Equal(nameof(DashboardWarningSnooze), call.EntityType);
|
||||
Assert.Equal(DashboardWarningSnooze.IdFor(studentId, "Absentismus").ToString(), call.EntityId);
|
||||
Assert.Equal("Save", call.Operation);
|
||||
Assert.Same(snooze, call.Payload);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user