57 lines
1.0 KiB
TypeScript
57 lines
1.0 KiB
TypeScript
import { MetaEntity } from '@freeblox/shared';
|
|
import { Exclude, Expose } from 'class-transformer';
|
|
import {
|
|
Column,
|
|
DeleteDateColumn,
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
} from 'typeorm';
|
|
|
|
@Entity('assets')
|
|
@Expose()
|
|
export class AssetEntity extends MetaEntity {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column({ nullable: true, name: 'user_id' })
|
|
userId: string;
|
|
|
|
@Column({ nullable: true, name: 'asset_tag' })
|
|
assetTag: string;
|
|
|
|
@Column({ name: 'source_uri' })
|
|
@Exclude()
|
|
sourceUri: string;
|
|
|
|
@Column({ nullable: true })
|
|
@Exclude()
|
|
source: string;
|
|
|
|
@Column()
|
|
@Exclude()
|
|
originalname: string;
|
|
|
|
@Column({ default: 'application/octet-stream' })
|
|
mimetype: string;
|
|
|
|
@Column({ unsigned: true })
|
|
filesize: number;
|
|
|
|
@Column({ default: false })
|
|
@Exclude()
|
|
public: boolean;
|
|
|
|
@Column({ nullable: true, name: 'upload_ip' })
|
|
@Exclude()
|
|
uploadIp: string;
|
|
|
|
@DeleteDateColumn({ name: 'deleted_at' })
|
|
@Exclude()
|
|
deletedAt: Date;
|
|
|
|
@Expose()
|
|
get extension() {
|
|
return this.originalname.split('.').at(-1);
|
|
}
|
|
}
|