1
0

fix: use new assignData method for default data

This commit is contained in:
Dominik Pschenitschni
2022-08-14 12:15:45 +02:00
parent 8be1f81848
commit 8416b1f448
34 changed files with 317 additions and 615 deletions

View File

@ -9,27 +9,19 @@ export interface IFile extends IAbstract {
}
export default class FileModel extends AbstractModel implements IFile {
id!: number
mime!: string
name!: string
size!: number
created: Date
id = 0
mime = ''
name = ''
size = 0
created: Date = null
constructor(data: Partial<IFile>) {
super()
this.assignData(data)
constructor(data) {
super(data)
this.created = new Date(this.created)
}
defaults() {
return {
id: 0,
mime: '',
name: '',
size: 0,
created: null,
}
}
getHumanSize() {
const sizes = {
0: 'B',