fix(web): new feature photo (#9443)

* fix: new feature photo

* fix: use updatedAt
This commit is contained in:
martin 2024-06-28 02:16:26 +02:00 committed by GitHub
parent 325aa1d392
commit 37b5d92110
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 89 additions and 31 deletions

View file

@ -1,6 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsNotEmpty, IsString, MaxDate, ValidateNested } from 'class-validator';
import { PropertyLifecycle } from 'src/decorators';
import { AuthDto } from 'src/dtos/auth.dto';
import { AssetFaceEntity } from 'src/entities/asset-face.entity';
import { PersonEntity } from 'src/entities/person.entity';
@ -71,6 +72,8 @@ export class PersonResponseDto {
birthDate!: Date | null;
thumbnailPath!: string;
isHidden!: boolean;
@PropertyLifecycle({ addedAt: 'v1.107.0' })
updatedAt?: Date;
}
export class PersonWithFacesResponseDto extends PersonResponseDto {
@ -138,6 +141,7 @@ export function mapPerson(person: PersonEntity): PersonResponseDto {
birthDate: person.birthDate,
thumbnailPath: person.thumbnailPath,
isHidden: person.isHidden,
updatedAt: person.updatedAt,
};
}

View file

@ -42,6 +42,7 @@ const responseDto: PersonResponseDto = {
birthDate: null,
thumbnailPath: '/path/to/thumbnail.jpg',
isHidden: false,
updatedAt: expect.any(Date),
};
const statistics = { assets: 3 };
@ -126,6 +127,7 @@ describe(PersonService.name, () => {
birthDate: null,
thumbnailPath: '/path/to/thumbnail.jpg',
isHidden: true,
updatedAt: expect.any(Date),
},
],
});
@ -255,6 +257,7 @@ describe(PersonService.name, () => {
birthDate: new Date('1976-06-30'),
thumbnailPath: '/path/to/thumbnail.jpg',
isHidden: false,
updatedAt: expect.any(Date),
});
expect(personMock.update).toHaveBeenCalledWith({ id: 'person-1', birthDate: new Date('1976-06-30') });
expect(jobMock.queue).not.toHaveBeenCalled();
@ -407,6 +410,7 @@ describe(PersonService.name, () => {
id: personStub.noName.id,
name: personStub.noName.name,
thumbnailPath: personStub.noName.thumbnailPath,
updatedAt: expect.any(Date),
});
expect(jobMock.queue).not.toHaveBeenCalledWith();