fix: feature face update ignores soft-deleted faces (#31533)
This commit is contained in:
@@ -616,6 +616,7 @@ from
|
||||
where
|
||||
"asset_face"."assetId" = $2
|
||||
and "asset_face"."personGroupId" = $3
|
||||
and "asset_face"."deletedAt" is null
|
||||
|
||||
-- PersonRepository.getForMergePerson
|
||||
select
|
||||
|
||||
@@ -767,6 +767,7 @@ export class PersonRepository {
|
||||
.select('asset_face.id')
|
||||
.where('asset_face.assetId', '=', assetId)
|
||||
.where('asset_face.personGroupId', '=', personGroupId)
|
||||
.where('asset_face.deletedAt', 'is', null)
|
||||
.innerJoin('asset', (join) => join.onRef('asset.id', '=', 'asset_face.assetId').on('asset.isOffline', '=', false))
|
||||
.executeTakeFirst();
|
||||
}
|
||||
|
||||
@@ -228,4 +228,18 @@ describe(PersonRepository.name, () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getForFeatureFaceUpdate', () => {
|
||||
it('should ignore soft deleted faces', async () => {
|
||||
const { ctx, sut } = setup();
|
||||
const { user } = await ctx.newUser();
|
||||
const { asset } = await ctx.newAsset({ ownerId: user.id });
|
||||
const { person } = await ctx.newPerson({ ownerId: user.id });
|
||||
await ctx.newAssetFace({ assetId: asset.id, deletedAt: new Date(), personGroupId: person.personGroupId });
|
||||
|
||||
await expect(
|
||||
sut.getForFeatureFaceUpdate({ personGroupId: person.personGroupId, assetId: asset.id }),
|
||||
).resolves.toEqual(undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user