81 lines
1.6 KiB
JavaScript
81 lines
1.6 KiB
JavaScript
import { Mongo } from 'meteor/mongo';
|
|
import { ReactiveCache } from '/imports/reactiveCache';
|
|
const { SimpleSchema } = require('/imports/simpleSchema');
|
|
|
|
const Team = new Mongo.Collection('team');
|
|
|
|
/**
|
|
* A Team in Wekan. Organization in Trello.
|
|
*/
|
|
Team.attachSchema(
|
|
new SimpleSchema({
|
|
teamDisplayName: {
|
|
/**
|
|
* the name to display for the team
|
|
*/
|
|
type: String,
|
|
optional: true,
|
|
},
|
|
teamDesc: {
|
|
/**
|
|
* the description the team
|
|
*/
|
|
type: String,
|
|
optional: true,
|
|
max: 190,
|
|
},
|
|
teamShortName: {
|
|
/**
|
|
* short name of the team
|
|
*/
|
|
type: String,
|
|
optional: true,
|
|
max: 255,
|
|
},
|
|
teamWebsite: {
|
|
/**
|
|
* website of the team
|
|
*/
|
|
type: String,
|
|
optional: true,
|
|
max: 255,
|
|
},
|
|
teamIsActive: {
|
|
/**
|
|
* status of the team
|
|
*/
|
|
type: Boolean,
|
|
optional: true,
|
|
},
|
|
createdAt: {
|
|
/**
|
|
* creation date of the team
|
|
*/
|
|
type: Date,
|
|
// eslint-disable-next-line consistent-return
|
|
autoValue() {
|
|
if (this.isInsert) {
|
|
return new Date();
|
|
} else if (this.isUpsert) {
|
|
return { $setOnInsert: new Date() };
|
|
} else {
|
|
this.unset();
|
|
}
|
|
},
|
|
},
|
|
modifiedAt: {
|
|
type: Date,
|
|
// eslint-disable-next-line consistent-return
|
|
autoValue() {
|
|
if (this.isInsert || this.isUpsert || this.isUpdate) {
|
|
return new Date();
|
|
} else {
|
|
this.unset();
|
|
}
|
|
},
|
|
},
|
|
}),
|
|
);
|
|
|
|
export default Team;
|