This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/models/team.ts

33 lines
690 B
TypeScript

import AbstractModel from './abstractModel'
import UserModel from './user'
import TeamMemberModel from './teamMember'
import {RIGHTS, type Right} from '@/models/constants/rights'
export default class TeamModel extends AbstractModel {
constructor(data) {
super(data)
// Make the members to usermodels
this.members = this.members.map(m => {
return new TeamMemberModel(m)
})
this.createdBy = new UserModel(this.createdBy)
this.created = new Date(this.created)
this.updated = new Date(this.updated)
}
defaults() {
return {
id: 0,
name: '',
description: '',
members: [],
right: RIGHTS.READ,
createdBy: {},
created: null,
updated: null,
}
}
}