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:
@@ -1,7 +1,16 @@
|
||||
import { AssetFaceEntity, PersonEntity } from '@app/infra/entities';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Transform, Type } from 'class-transformer';
|
||||
import { IsArray, IsBoolean, IsNotEmpty, IsOptional, IsString, ValidateNested } from 'class-validator';
|
||||
import {
|
||||
IsArray,
|
||||
IsBoolean,
|
||||
IsDate,
|
||||
IsNotEmpty,
|
||||
IsOptional,
|
||||
IsString,
|
||||
ValidateIf,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { toBoolean, ValidateUUID } from '../domain.util';
|
||||
|
||||
export class PersonUpdateDto {
|
||||
@@ -12,6 +21,16 @@ export class PersonUpdateDto {
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Person date of birth.
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
@ValidateIf((value) => value !== null)
|
||||
@ApiProperty({ format: 'date' })
|
||||
birthDate?: Date | null;
|
||||
|
||||
/**
|
||||
* Asset is used to get the feature face thumbnail.
|
||||
*/
|
||||
@@ -49,6 +68,15 @@ export class PeopleUpdateItem {
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Person date of birth.
|
||||
*/
|
||||
@IsOptional()
|
||||
@IsDate()
|
||||
@Type(() => Date)
|
||||
@ApiProperty({ format: 'date' })
|
||||
birthDate?: Date | null;
|
||||
|
||||
/**
|
||||
* Asset is used to get the feature face thumbnail.
|
||||
*/
|
||||
@@ -78,6 +106,8 @@ export class PersonSearchDto {
|
||||
export class PersonResponseDto {
|
||||
id!: string;
|
||||
name!: string;
|
||||
@ApiProperty({ format: 'date' })
|
||||
birthDate!: Date | null;
|
||||
thumbnailPath!: string;
|
||||
isHidden!: boolean;
|
||||
}
|
||||
@@ -96,6 +126,7 @@ export function mapPerson(person: PersonEntity): PersonResponseDto {
|
||||
return {
|
||||
id: person.id,
|
||||
name: person.name,
|
||||
birthDate: person.birthDate,
|
||||
thumbnailPath: person.thumbnailPath,
|
||||
isHidden: person.isHidden,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user