first commit
This commit is contained in:
30
myteamwallet_backend/src/files/entities/file.entity.ts
Normal file
30
myteamwallet_backend/src/files/entities/file.entity.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
AfterLoad,
|
||||
AfterInsert,
|
||||
} from 'typeorm';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Allow } from 'class-validator';
|
||||
import { EntityHelper } from 'src/utils/entity-helper';
|
||||
import appConfig from '../../config/app.config';
|
||||
|
||||
@Entity({ name: 'file' })
|
||||
export class FileEntity extends EntityHelper {
|
||||
@ApiProperty({ example: 'cbcfa8b8-3a25-4adb-a9c6-e325f0d0f3ae' })
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Allow()
|
||||
@Column()
|
||||
path: string;
|
||||
|
||||
@AfterLoad()
|
||||
@AfterInsert()
|
||||
updatePath() {
|
||||
if (this.path.indexOf('/') === 0) {
|
||||
this.path = appConfig().backendDomain + this.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user