fix: use new assignData method for default data
This commit is contained in:
@ -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',
|
||||
|
Reference in New Issue
Block a user