2023-11-24 15:38:54 +01:00
|
|
|
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 })
|
2023-11-24 15:38:54 +01:00
|
|
|
@Index(['personId', 'assetId'])
|
2023-05-17 19:07:17 +02:00
|
|
|
export class AssetFaceEntity {
|
2023-10-24 15:12:42 +02:00
|
|
|
@PrimaryGeneratedColumn('uuid')
|
|
|
|
id!: string;
|
|
|
|
|
|
|
|
@Column()
|
2023-05-17 19:07:17 +02:00
|
|
|
assetId!: string;
|
|
|
|
|
2023-10-24 15:12:42 +02:00
|
|
|
@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
|
|
|
|
2023-07-03 00:46:20 +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;
|
|
|
|
|
2023-10-24 15:12:42 +02:00
|
|
|
@ManyToOne(() => PersonEntity, (person) => person.faces, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: true })
|
|
|
|
person!: PersonEntity | null;
|
2023-05-17 19:07:17 +02:00
|
|
|
}
|