import { Entity , Column , PrimaryGeneratedColumn } from 'typeorm' ; @ Entity ( ) export class File { @ PrimaryGeneratedColumn ( 'uuid' ) private id : string ; @ Column ( { type : 'varchar' , nullable : false } ) private name : string ; @ Column ( { type : 'integer' , nullable : false } ) private size : number ; @ Column ( { type : 'varchar' , nullable : false } ) private mimeType : string ; @ Column ( { type : 'timestamp' , default : ( ) => 'CURRENT_TIMESTAMP' } ) private uploadedAt : Date ; constructor ( name , size , mimeType ) { this . name = name ; this . size = size ; this . mimeType = mimeType ; } public getId ( ) { return this . id ; } public getName ( ) { return this . name ; } public getSize ( ) { return this . size ; } public getMimeType ( ) { return this . mimeType ; } public getUploadedAt ( ) { return this . uploadedAt ; } public getOriginalName ( ) { return this . name . split ( '_' ) . splice ( 1 ) . join ( '_' ) ; } }