mirror of
https://github.com/wekan/wekan.git
synced 2026-02-03 07:01:47 +01:00
Merge branch 'master' of https://github.com/Emile840/wekan into Emile840-master
This commit is contained in:
commit
72fa32151d
6 changed files with 128 additions and 81 deletions
|
|
@ -36,11 +36,19 @@ Org.attachSchema(
|
|||
optional: true,
|
||||
max: 255,
|
||||
},
|
||||
orgIsActive: {
|
||||
/**
|
||||
* status of the organization
|
||||
*/
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
createdAt: {
|
||||
/**
|
||||
* creation date of the organization
|
||||
*/
|
||||
type: Date,
|
||||
denyUpdate: false,
|
||||
// eslint-disable-next-line consistent-return
|
||||
autoValue() {
|
||||
if (this.isInsert) {
|
||||
|
|
@ -81,7 +89,7 @@ if (Meteor.isServer) {
|
|||
check(orgDesc, String);
|
||||
check(orgShortName, String);
|
||||
check(orgWebsite, String);
|
||||
check(orgIsActive, String);
|
||||
check(orgIsActive, Boolean);
|
||||
|
||||
const nOrgNames = Org.find({ orgShortName }).count();
|
||||
if (nOrgNames > 0) {
|
||||
|
|
@ -100,17 +108,17 @@ if (Meteor.isServer) {
|
|||
|
||||
setOrgDisplayName(org, orgDisplayName) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(org, String);
|
||||
check(org, Object);
|
||||
check(orgDisplayName, String);
|
||||
Org.update(org, {
|
||||
$set: { orgDisplayName: orgDisplayName },
|
||||
$set: { orgDisplayName: orgDisplayNameorgShortName},
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setOrgDesc(org, orgDesc) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(org, String);
|
||||
check(org, Object);
|
||||
check(orgDesc, String);
|
||||
Org.update(org, {
|
||||
$set: { orgDesc: orgDesc },
|
||||
|
|
@ -120,7 +128,7 @@ if (Meteor.isServer) {
|
|||
|
||||
setOrgShortName(org, orgShortName) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(org, String);
|
||||
check(org, Object);
|
||||
check(orgShortName, String);
|
||||
Org.update(org, {
|
||||
$set: { orgShortName: orgShortName },
|
||||
|
|
@ -130,20 +138,35 @@ if (Meteor.isServer) {
|
|||
|
||||
setOrgIsActive(org, orgIsActive) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(org, String);
|
||||
check(orgIsActive, String);
|
||||
check(org, Object);
|
||||
check(orgIsActive, Boolean);
|
||||
Org.update(org, {
|
||||
$set: { orgIsActive: orgIsActive },
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setOrgAllFields(org, orgDisplayName, orgDesc, orgShortName, orgWebsite, orgIsActive) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(org, Object);
|
||||
check(orgDisplayName, String);
|
||||
check(orgDesc, String);
|
||||
check(orgShortName, String);
|
||||
check(orgWebsite, String);
|
||||
check(orgIsActive, Boolean);
|
||||
Org.update(org, {
|
||||
$set: { orgDisplayName : orgDisplayName, orgDesc : orgDesc, orgShortName : orgShortName, orgWebsite : orgWebsite, orgIsActive: orgIsActive },
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// Index for Organization name.
|
||||
Meteor.startup(() => {
|
||||
Org._collection._ensureIndex({ name: -1 });
|
||||
// Org._collection._ensureIndex({ name: -1 });
|
||||
Org._collection._ensureIndex({ orgDisplayName: -1 });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@ Team.attachSchema(
|
|||
optional: true,
|
||||
max: 255,
|
||||
},
|
||||
teamIsActive: {
|
||||
/**
|
||||
* status of the team
|
||||
*/
|
||||
type: Boolean,
|
||||
optional: true,
|
||||
},
|
||||
createdAt: {
|
||||
/**
|
||||
* creation date of the team
|
||||
|
|
@ -81,7 +88,7 @@ if (Meteor.isServer) {
|
|||
check(teamDesc, String);
|
||||
check(teamShortName, String);
|
||||
check(teamWebsite, String);
|
||||
check(teamIsActive, String);
|
||||
check(teamIsActive, Boolean);
|
||||
|
||||
const nTeamNames = Team.find({ teamShortName }).count();
|
||||
if (nTeamNames > 0) {
|
||||
|
|
@ -100,7 +107,7 @@ if (Meteor.isServer) {
|
|||
|
||||
setTeamDisplayName(team, teamDisplayName) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(team, String);
|
||||
check(team, Object);
|
||||
check(teamDisplayName, String);
|
||||
Team.update(team, {
|
||||
$set: { teamDisplayName: teamDisplayName },
|
||||
|
|
@ -110,7 +117,7 @@ if (Meteor.isServer) {
|
|||
|
||||
setTeamDesc(team, teamDesc) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(team, String);
|
||||
check(team, Object);
|
||||
check(teamDesc, String);
|
||||
Team.update(team, {
|
||||
$set: { teamDesc: teamDesc },
|
||||
|
|
@ -120,7 +127,7 @@ if (Meteor.isServer) {
|
|||
|
||||
setTeamShortName(team, teamShortName) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(team, String);
|
||||
check(team, Object);
|
||||
check(teamShortName, String);
|
||||
Team.update(team, {
|
||||
$set: { teamShortName: teamShortName },
|
||||
|
|
@ -130,20 +137,34 @@ if (Meteor.isServer) {
|
|||
|
||||
setTeamIsActive(team, teamIsActive) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(team, String);
|
||||
check(teamIsActive, String);
|
||||
check(team, Object);
|
||||
check(teamIsActive, Boolean);
|
||||
Team.update(team, {
|
||||
$set: { teamIsActive: teamIsActive },
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
setTeamAllFields(team, teamDisplayName, teamDesc, teamShortName, teamWebsite, teamIsActive) {
|
||||
if (Meteor.user() && Meteor.user().isAdmin) {
|
||||
check(team, Object);
|
||||
check(teamDisplayName, String);
|
||||
check(teamDesc, String);
|
||||
check(teamShortName, String);
|
||||
check(teamWebsite, String);
|
||||
check(teamIsActive, Boolean);
|
||||
Team.update(team, {
|
||||
$set: { teamDisplayName: teamDisplayName, teamDesc: teamDesc, teamShortName: teamShortName, teamWebsite: teamWebsite, teamIsActive: teamIsActive },
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// Index for Team name.
|
||||
Meteor.startup(() => {
|
||||
Team._collection._ensureIndex({ name: -1 });
|
||||
Team._collection._ensureIndex({ teamDisplayName: -1 });
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue