mirror of
https://github.com/immich-app/immich.git
synced 2025-01-09 21:36:46 +01:00
434bcec5cc
* fix(server): correct person birth date across timezones * fix test * update e2e tests * use Optional decorator
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { AssetFaceEntity } from 'src/entities/asset-face.entity';
|
|
import { UserEntity } from 'src/entities/user.entity';
|
|
import {
|
|
Check,
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
|
|
@Entity('person')
|
|
@Check(`"birthDate" <= CURRENT_DATE`)
|
|
export class PersonEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id!: string;
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
|
createdAt!: Date;
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
updatedAt!: Date;
|
|
|
|
@Column()
|
|
ownerId!: string;
|
|
|
|
@ManyToOne(() => UserEntity, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: false })
|
|
owner!: UserEntity;
|
|
|
|
@Column({ default: '' })
|
|
name!: string;
|
|
|
|
@Column({ type: 'date', nullable: true })
|
|
birthDate!: string | null;
|
|
|
|
@Column({ default: '' })
|
|
thumbnailPath!: string;
|
|
|
|
@Column({ nullable: true })
|
|
faceAssetId!: string | null;
|
|
|
|
@ManyToOne(() => AssetFaceEntity, { onDelete: 'SET NULL', nullable: true })
|
|
faceAsset!: AssetFaceEntity | null;
|
|
|
|
@OneToMany(() => AssetFaceEntity, (assetFace) => assetFace.person)
|
|
faces!: AssetFaceEntity[];
|
|
|
|
@Column({ default: false })
|
|
isHidden!: boolean;
|
|
}
|