feat(api): set person color (#15937)

This commit is contained in:
Jason Rasmussen
2025-02-07 10:06:58 -05:00
committed by GitHub
parent 2e5007adef
commit 23014c263b
18 changed files with 182 additions and 21 deletions

View File

@@ -104,7 +104,7 @@ export class PersonService extends BaseService {
await this.personRepository.reassignFace(face.id, personId);
}
result.push(person);
result.push(mapPerson(person));
}
if (changeFeaturePhoto.length > 0) {
// Remove duplicates
@@ -178,20 +178,23 @@ export class PersonService extends BaseService {
});
}
create(auth: AuthDto, dto: PersonCreateDto): Promise<PersonResponseDto> {
return this.personRepository.create({
async create(auth: AuthDto, dto: PersonCreateDto): Promise<PersonResponseDto> {
const person = await this.personRepository.create({
ownerId: auth.user.id,
name: dto.name,
birthDate: dto.birthDate,
isHidden: dto.isHidden,
isFavorite: dto.isFavorite,
color: dto.color,
});
return mapPerson(person);
}
async update(auth: AuthDto, id: string, dto: PersonUpdateDto): Promise<PersonResponseDto> {
await this.requireAccess({ auth, permission: Permission.PERSON_UPDATE, ids: [id] });
const { name, birthDate, isHidden, featureFaceAssetId: assetId, isFavorite } = dto;
const { name, birthDate, isHidden, featureFaceAssetId: assetId, isFavorite, color } = dto;
// TODO: set by faceId directly
let faceId: string | undefined = undefined;
if (assetId) {
@@ -211,6 +214,7 @@ export class PersonService extends BaseService {
birthDate,
isHidden,
isFavorite,
color,
});
if (assetId) {