2023-02-20 01:50:27 +00:00
|
|
|
import { Index, JoinColumn, OneToOne, PrimaryColumn } from 'typeorm';
|
2022-02-10 20:40:11 -06:00
|
|
|
import { Column } from 'typeorm/decorator/columns/Column';
|
|
|
|
|
import { Entity } from 'typeorm/decorator/entity/Entity';
|
|
|
|
|
import { AssetEntity } from './asset.entity';
|
|
|
|
|
|
|
|
|
|
@Entity('exif')
|
|
|
|
|
export class ExifEntity {
|
2023-02-20 01:50:27 +00:00
|
|
|
@OneToOne(() => AssetEntity, { onDelete: 'CASCADE', nullable: true })
|
|
|
|
|
@JoinColumn()
|
|
|
|
|
asset?: AssetEntity;
|
2022-02-10 20:40:11 -06:00
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
@PrimaryColumn()
|
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 */
|
2023-02-20 01:50:27 +00:00
|
|
|
@Column({ type: 'text', default: '' })
|
2022-08-21 06:31:37 +07:00
|
|
|
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
|
|
|
|
2023-04-02 21:11:24 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
timeZone!: string | null;
|
|
|
|
|
|
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;
|
|
|
|
|
|
2023-02-16 02:41:51 -05:00
|
|
|
@Index('IDX_live_photo_cid')
|
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
livePhotoCID!: string | null;
|
|
|
|
|
|
2022-08-21 06:31:37 +07:00
|
|
|
@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;
|
|
|
|
|
|
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
|
|
|
|
2023-01-26 13:14:05 -06:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
|
exposureTime!: string | 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-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", '') || ' ' ||
|
|
|
|
|
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
|
|
|
}
|