1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-09 05:16:47 +01:00
immich/server/src/infra/entities/asset-face.entity.ts

45 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Column, Entity, Index, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
2023-05-17 19:07:17 +02:00
import { AssetEntity } from './asset.entity';
import { PersonEntity } from './person.entity';
2023-12-08 17:15:46 +01:00
@Entity('asset_faces', { synchronize: false })
@Index(['personId', 'assetId'])
2023-05-17 19:07:17 +02:00
export class AssetFaceEntity {
@PrimaryGeneratedColumn('uuid')
id!: string;
@Column()
2023-05-17 19:07:17 +02:00
assetId!: string;
@Column({ nullable: true, type: 'uuid' })
personId!: string | null;
2023-05-17 19:07:17 +02:00
2023-12-08 17:15:46 +01:00
@Index('face_index', { synchronize: false })
@Column({ type: 'float4', array: true, select: false })
embedding!: number[];
2023-05-17 19:07:17 +02:00
@Column({ default: 0, type: 'int' })
imageWidth!: number;
@Column({ default: 0, type: 'int' })
imageHeight!: number;
@Column({ default: 0, type: 'int' })
boundingBoxX1!: number;
@Column({ default: 0, type: 'int' })
boundingBoxY1!: number;
@Column({ default: 0, type: 'int' })
boundingBoxX2!: number;
@Column({ default: 0, type: 'int' })
boundingBoxY2!: number;
2023-05-17 19:07:17 +02:00
@ManyToOne(() => AssetEntity, (asset) => asset.faces, { onDelete: 'CASCADE', onUpdate: 'CASCADE' })
asset!: AssetEntity;
@ManyToOne(() => PersonEntity, (person) => person.faces, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: true })
person!: PersonEntity | null;
2023-05-17 19:07:17 +02:00
}