2022-02-11 03:40:11 +01:00
|
|
|
import { Column, Entity, JoinColumn, OneToOne, PrimaryColumn, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
|
|
|
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')
|
|
|
|
id: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
deviceAssetId: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
userId: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
deviceId: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
type: AssetType;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
originalPath: string;
|
|
|
|
|
|
|
|
@Column({ nullable: true })
|
|
|
|
resizePath: string;
|
|
|
|
|
2022-05-22 13:56:36 +02:00
|
|
|
@Column({ nullable: true })
|
|
|
|
webpPath: string;
|
|
|
|
|
2022-06-05 01:34:11 +02:00
|
|
|
@Column({ nullable: true })
|
|
|
|
encodedVideoPath: string;
|
|
|
|
|
2022-02-03 17:06:44 +01:00
|
|
|
@Column()
|
|
|
|
createdAt: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
modifiedAt: string;
|
|
|
|
|
|
|
|
@Column({ type: 'boolean', default: false })
|
|
|
|
isFavorite: boolean;
|
|
|
|
|
|
|
|
@Column({ nullable: true })
|
2022-02-06 07:07:56 +01:00
|
|
|
mimeType: string;
|
2022-02-03 17:06:44 +01:00
|
|
|
|
|
|
|
@Column({ nullable: true })
|
2022-02-06 07:07:56 +01:00
|
|
|
duration: string;
|
2022-02-11 03:40:11 +01:00
|
|
|
|
|
|
|
@OneToOne(() => ExifEntity, (exifEntity) => exifEntity.asset)
|
|
|
|
exifInfo: ExifEntity;
|
2022-02-20 05:42:10 +01:00
|
|
|
|
|
|
|
@OneToOne(() => SmartInfoEntity, (smartInfoEntity) => smartInfoEntity.asset)
|
|
|
|
smartInfo: SmartInfoEntity;
|
2022-02-03 17:06:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export enum AssetType {
|
|
|
|
IMAGE = 'IMAGE',
|
|
|
|
VIDEO = 'VIDEO',
|
|
|
|
AUDIO = 'AUDIO',
|
|
|
|
OTHER = 'OTHER',
|
|
|
|
}
|