mirror of
https://github.com/immich-app/immich.git
synced 2026-03-02 02:28:50 +03:00
feat(api): set person color (#15937)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user