2024-03-20 22:02:51 +01:00
|
|
|
import { AssetEntity } from 'src/entities/asset.entity';
|
2024-06-16 21:25:27 +02:00
|
|
|
import { FaceSearchEntity } from 'src/entities/face-search.entity';
|
2024-03-20 22:02:51 +01:00
|
|
|
import { PersonEntity } from 'src/entities/person.entity';
|
2024-06-16 21:25:27 +02:00
|
|
|
import { Column, Entity, Index, ManyToOne, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
|
2023-05-17 19:07:17 +02:00
|
|
|
|
2023-12-08 17:15:46 +01:00
|
|
|
@Entity('asset_faces', { synchronize: false })
|
2024-03-14 06:58:09 +01:00
|
|
|
@Index('IDX_asset_faces_assetId_personId', ['assetId', 'personId'])
|
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
|
|
|
|
2024-06-16 21:25:27 +02:00
|
|
|
@OneToOne(() => FaceSearchEntity, (faceSearchEntity) => faceSearchEntity.face, { cascade: ['insert'] })
|
|
|
|
faceSearch?: FaceSearchEntity;
|
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;
|
|
|
|
|
2024-01-18 06:08:48 +01:00
|
|
|
@ManyToOne(() => PersonEntity, (person) => person.faces, {
|
|
|
|
onDelete: 'SET NULL',
|
|
|
|
onUpdate: 'CASCADE',
|
|
|
|
nullable: true,
|
|
|
|
})
|
2023-10-24 15:12:42 +02:00
|
|
|
person!: PersonEntity | null;
|
2023-05-17 19:07:17 +02:00
|
|
|
}
|