idea-toolbox
Version:
IDEA's utility functions
30 lines (29 loc) • 929 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Team = void 0;
const resource_model_1 = require("./resource.model");
/**
* Table: `idea_teams`.
*/
class Team extends resource_model_1.Resource {
load(x) {
super.load(x);
this.teamId = this.clean(x.teamId, String);
this.name = this.clean(x.name, String);
this.createdAt = this.clean(x.createdAt, d => new Date(d).getTime(), Date.now());
this.activeInProjects = this.cleanArray(x.activeInProjects, String);
}
safeLoad(newData, safeData) {
super.safeLoad(newData, safeData);
this.teamId = safeData.teamId;
this.createdAt = safeData.createdAt;
this.activeInProjects = safeData.activeInProjects;
}
validate() {
const e = super.validate();
if (this.iE(this.name))
e.push('name');
return e;
}
}
exports.Team = Team;