This repository has been archived on 2025-10-28. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
vikunja-frontend/src/models/attachment.ts
2022-09-05 17:43:56 +02:00

36 lines
714 B
TypeScript

import AbstractModel from './abstractModel'
import UserModel, {type IUser} from './user'
import FileModel, {type IFile} from './file'
export interface IAttachment extends AbstractModel {
id: number
taskId: number
createdBy: IUser
file: IFile
created: Date
}
export default class AttachmentModel extends AbstractModel implements IAttachment {
id!: number
taskId!: number
createdBy: IUser
file: IFile
created: Date
constructor(data) {
super(data)
this.createdBy = new UserModel(this.createdBy)
this.file = new FileModel(this.file)
this.created = new Date(this.created)
}
defaults() {
return {
id: 0,
taskId: 0,
createdBy: UserModel,
file: FileModel,
created: null,
}
}
}