2019-03-02 11:25:10 +01:00
|
|
|
import AbstractModel from './abstractModel'
|
|
|
|
import UserModel from './user'
|
|
|
|
import TeamMemberModel from './teamMember'
|
|
|
|
|
|
|
|
export default class TeamModel extends AbstractModel {
|
|
|
|
constructor(data) {
|
|
|
|
super(data)
|
2020-09-05 22:35:52 +02:00
|
|
|
|
2019-03-02 11:25:10 +01:00
|
|
|
// Make the members to usermodels
|
|
|
|
this.members = this.members.map(m => {
|
|
|
|
return new TeamMemberModel(m)
|
|
|
|
})
|
|
|
|
this.createdBy = new UserModel(this.createdBy)
|
2020-02-08 14:16:06 +01:00
|
|
|
|
|
|
|
this.created = new Date(this.created)
|
|
|
|
this.updated = new Date(this.updated)
|
2019-03-02 11:25:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
defaults() {
|
|
|
|
return {
|
|
|
|
id: 0,
|
|
|
|
name: '',
|
|
|
|
description: '',
|
|
|
|
members: [],
|
|
|
|
right: 0,
|
|
|
|
|
|
|
|
createdBy: {},
|
2020-02-08 14:16:06 +01:00
|
|
|
created: null,
|
|
|
|
updated: null,
|
2019-03-02 11:25:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|