fix(app): RegisterFaceHandler adds to both person.Faces and DbContext Set for test compatibility
- Added person.AddFace(face) to maintain in-memory consistency for domain logic - Also added _db.GetSet<KnownFace>().Add(face) to avoid EF Core phantom UPDATE - Both Application.Tests and IntegrationTests pass
This commit is contained in:
1 parent
833f31ffad
commit
e704877f24
1 file changed
+4
-1
@@ -32,7 +32,10 @@ public async Task<ServiceResult<KnownFaceResponse>> Handle(RegisterFaceCommand r
|
||||
var face = new KnownFace(request.PersonId, request.Embedding,
|
||||
request.ThumbnailUrl, request.SourceEventId);
|
||||
|
||||
// Add directly to DbContext to avoid EF Core change tracking confusion
|
||||
// Add to person's navigation for in-memory consistency (tests, domain logic)
|
||||
person.AddFace(face);
|
||||
|
||||
// Also add directly to DbContext to avoid EF Core change tracking confusion
|
||||
// when adding to a collection navigation property
|
||||
_db.GetSet<KnownFace>().Add(face);
|
||||
|
||||
|
||||
Reference in new issue
Block a user