mirror of
https://github.com/KevinMidboe/immich.git
synced 2026-01-07 09:45:50 +00:00
feat: set person birth date (web only) (#3721)
* Person birth date (data layer) * Person birth date (data layer) * Person birth date (service layer) * Person birth date (service layer, API) * Person birth date (service layer, API) * Person birth date (UI) (wip) * Person birth date (UI) (wip) * Person birth date (UI) (wip) * Person birth date (UI) (wip) * UI: Use "date of birth" everywhere * UI: better modal dialog Similar to the API key modal. * UI: set date of birth from people page * Use typed events for modal dispatcher * Date of birth tests (wip) * Regenerate API * Code formatting * Fix Svelte typing * Fix Svelte typing * Fix person model [skip ci] * Minor refactoring [skip ci] * Typed event dispatcher [skip ci] * Refactor typed event dispatcher [skip ci] * Fix unchanged birthdate check [skip ci] * Remove unnecessary custom transformer [skip ci] * PersonUpdate: call search index update job only when needed * Regenerate API * Code formatting * Fix tests * Fix DTO * Regenerate API * chore: verbiage and view mode * feat: show current age * test: person e2e * fix: show name for birth date selection --------- Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import { PersonService } from './person.service';
|
||||
const responseDto: PersonResponseDto = {
|
||||
id: 'person-1',
|
||||
name: 'Person 1',
|
||||
birthDate: null,
|
||||
thumbnailPath: '/path/to/thumbnail.jpg',
|
||||
isHidden: false,
|
||||
};
|
||||
@@ -68,6 +69,7 @@ describe(PersonService.name, () => {
|
||||
{
|
||||
id: 'person-1',
|
||||
name: '',
|
||||
birthDate: null,
|
||||
thumbnailPath: '/path/to/thumbnail.jpg',
|
||||
isHidden: true,
|
||||
},
|
||||
@@ -142,6 +144,24 @@ describe(PersonService.name, () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("should update a person's date of birth", async () => {
|
||||
personMock.getById.mockResolvedValue(personStub.noBirthDate);
|
||||
personMock.update.mockResolvedValue(personStub.withBirthDate);
|
||||
personMock.getAssets.mockResolvedValue([assetStub.image]);
|
||||
|
||||
await expect(sut.update(authStub.admin, 'person-1', { birthDate: new Date('1976-06-30') })).resolves.toEqual({
|
||||
id: 'person-1',
|
||||
name: 'Person 1',
|
||||
birthDate: new Date('1976-06-30'),
|
||||
thumbnailPath: '/path/to/thumbnail.jpg',
|
||||
isHidden: false,
|
||||
});
|
||||
|
||||
expect(personMock.getById).toHaveBeenCalledWith('admin_id', 'person-1');
|
||||
expect(personMock.update).toHaveBeenCalledWith({ id: 'person-1', birthDate: new Date('1976-06-30') });
|
||||
expect(jobMock.queue).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should update a person visibility', async () => {
|
||||
personMock.getById.mockResolvedValue(personStub.hidden);
|
||||
personMock.update.mockResolvedValue(personStub.withName);
|
||||
|
||||
Reference in New Issue
Block a user