mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
* Regenerate missing person thumbnails * Check for empty string instead of zero length * Remember asset used as person face * Define entity relation between person and asset via faceAssetId * Typo * Fix entity relation * Tests * Tests * Fix code formatting * Fix import path * Fix migration * format * Fix entity and migration * Linting * Remove unneeded cast * Conventions * Simplify queries * Simplify queries * Remove unneeded typings from entity * Remove unneeded cast --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
OneToMany,
|
|
PrimaryGeneratedColumn,
|
|
UpdateDateColumn,
|
|
} from 'typeorm';
|
|
import { AssetFaceEntity } from './asset-face.entity';
|
|
import { AssetEntity } from './asset.entity';
|
|
import { UserEntity } from './user.entity';
|
|
|
|
@Entity('person')
|
|
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!: Date | null;
|
|
|
|
@Column({ default: '' })
|
|
thumbnailPath!: string;
|
|
|
|
@Column({ nullable: true })
|
|
faceAssetId!: string | null;
|
|
|
|
@ManyToOne(() => AssetEntity, { onDelete: 'SET NULL', nullable: true })
|
|
faceAsset!: AssetEntity | null;
|
|
|
|
@OneToMany(() => AssetFaceEntity, (assetFace) => assetFace.person)
|
|
faces!: AssetFaceEntity[];
|
|
|
|
@Column({ default: false })
|
|
isHidden!: boolean;
|
|
}
|