2022-06-25 19:53:06 +02:00
|
|
|
import { Column, Entity, OneToOne, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
2022-02-11 03:40:11 +01:00
|
|
|
import { ExifEntity } from './exif.entity';
|
2022-02-20 05:42:10 +01:00
|
|
|
import { SmartInfoEntity } from './smart-info.entity';
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Entity('assets')
|
|
|
|
@Unique(['deviceAssetId', 'userId', 'deviceId'])
|
|
|
|
export class AssetEntity {
|
|
|
|
@PrimaryGeneratedColumn('uuid')
|
2022-06-25 19:53:06 +02:00
|
|
|
id!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
deviceAssetId!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
userId!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
deviceId!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
type!: AssetType;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
originalPath!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
resizePath!: string | null;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
2022-07-04 21:20:43 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true, default: '' })
|
2022-06-25 19:53:06 +02:00
|
|
|
webpPath!: string | null;
|
2022-05-22 13:56:36 +02:00
|
|
|
|
2022-07-04 21:20:43 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true, default: '' })
|
2022-06-25 19:53:06 +02:00
|
|
|
encodedVideoPath!: string;
|
2022-06-05 01:34:11 +02:00
|
|
|
|
2022-02-03 17:06:44 +01:00
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
createdAt!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column()
|
2022-06-25 19:53:06 +02:00
|
|
|
modifiedAt!: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column({ type: 'boolean', default: false })
|
2022-06-25 19:53:06 +02:00
|
|
|
isFavorite!: boolean;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
mimeType!: string | null;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
2022-06-25 19:53:06 +02:00
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
|
|
duration!: string | null;
|
2022-02-11 03:40:11 +01:00
|
|
|
|
|
|
|
@OneToOne(() => ExifEntity, (exifEntity) => exifEntity.asset)
|
2022-06-25 19:53:06 +02:00
|
|
|
exifInfo?: ExifEntity;
|
2022-02-20 05:42:10 +01:00
|
|
|
|
|
|
|
@OneToOne(() => SmartInfoEntity, (smartInfoEntity) => smartInfoEntity.asset)
|
2022-06-25 19:53:06 +02:00
|
|
|
smartInfo?: SmartInfoEntity;
|
2022-02-03 17:06:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum AssetType {
|
|
|
|
IMAGE = 'IMAGE',
|
|
|
|
VIDEO = 'VIDEO',
|
|
|
|
AUDIO = 'AUDIO',
|
|
|
|
OTHER = 'OTHER',
|
|
|
|
}
|