2022-02-10 20:40:11 -06:00
|
|
|
import { Index, JoinColumn, OneToOne } from 'typeorm';
|
|
|
|
|
import { Column } from 'typeorm/decorator/columns/Column';
|
|
|
|
|
import { PrimaryGeneratedColumn } from 'typeorm/decorator/columns/PrimaryGeneratedColumn';
|
|
|
|
|
import { Entity } from 'typeorm/decorator/entity/Entity';
|
|
|
|
|
import { AssetEntity } from './asset.entity';
|
|
|
|
|
|
|
|
|
|
@Entity('exif')
|
|
|
|
|
export class ExifEntity {
|
|
|
|
|
@PrimaryGeneratedColumn()
|
2023-01-25 11:35:28 -05:00
|
|
|
id!: number;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
|
|
|
|
@Index({ unique: true })
|
|
|
|
|
@Column({ type: 'uuid' })
|
2022-06-25 19:53:06 +02:00
|
|
|
assetId!: string;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-08-21 06:31:37 +07:00
|
|
|
/* General info */
|
|
|
|
|
@Column({ type: 'text', nullable: true, default: '' })
|
|
|
|
|
description!: string; // or caption
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'integer', nullable: true })
|
|
|
|
|
exifImageWidth!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'integer', nullable: true })
|
|
|
|
|
exifImageHeight!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-08-26 09:07:59 -07:00
|
|
|
@Column({ type: 'bigint', nullable: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
fileSizeInByte!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
orientation!: string | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
|
|
|
|
@Column({ type: 'timestamptz', nullable: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
dateTimeOriginal!: Date | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
|
|
|
|
@Column({ type: 'timestamptz', nullable: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
modifyDate!: Date | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-08-21 06:31:37 +07:00
|
|
|
@Column({ type: 'float', nullable: true })
|
|
|
|
|
latitude!: number | null;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'float', nullable: true })
|
|
|
|
|
longitude!: number | null;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
city!: string | null;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
state!: string | null;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
country!: string | null;
|
|
|
|
|
|
|
|
|
|
/* Image info */
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
make!: string | null;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
model!: string | null;
|
|
|
|
|
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
imageName!: string | null;
|
|
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
lensModel!: string | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
|
|
|
|
@Column({ type: 'float8', nullable: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
fNumber!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
|
|
|
|
@Column({ type: 'float8', nullable: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
focalLength!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'integer', nullable: true })
|
|
|
|
|
iso!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
|
|
|
|
@Column({ type: 'float', nullable: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
exposureTime!: number | null;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2022-08-21 06:31:37 +07:00
|
|
|
/* Video info */
|
|
|
|
|
@Column({ type: 'float8', nullable: true })
|
|
|
|
|
fps?: number | null;
|
2022-03-10 16:09:03 -06:00
|
|
|
|
2022-02-10 20:40:11 -06:00
|
|
|
@OneToOne(() => AssetEntity, { onDelete: 'CASCADE', nullable: true })
|
|
|
|
|
@JoinColumn({ name: 'assetId', referencedColumnName: 'id' })
|
2022-08-21 06:31:37 +07:00
|
|
|
asset?: AssetEntity;
|
2022-07-04 20:20:43 +01:00
|
|
|
|
2022-07-26 13:43:12 -05:00
|
|
|
@Index('exif_text_searchable', { synchronize: false })
|
2022-07-04 20:20:43 +01:00
|
|
|
@Column({
|
|
|
|
|
type: 'tsvector',
|
|
|
|
|
generatedType: 'STORED',
|
|
|
|
|
asExpression: `TO_TSVECTOR('english',
|
|
|
|
|
COALESCE(make, '') || ' ' ||
|
|
|
|
|
COALESCE(model, '') || ' ' ||
|
|
|
|
|
COALESCE(orientation, '') || ' ' ||
|
|
|
|
|
COALESCE("lensModel", '') || ' ' ||
|
2022-07-26 13:43:12 -05:00
|
|
|
COALESCE("imageName", '') || ' ' ||
|
2022-07-04 20:20:43 +01:00
|
|
|
COALESCE("city", '') || ' ' ||
|
|
|
|
|
COALESCE("state", '') || ' ' ||
|
2022-07-26 13:43:12 -05:00
|
|
|
COALESCE("country", ''))`,
|
2022-07-04 20:20:43 +01:00
|
|
|
})
|
2022-07-26 13:43:12 -05:00
|
|
|
exifTextSearchableColumn!: string;
|
2022-02-10 20:40:11 -06:00
|
|
|
}
|