mirror of
https://github.com/wekan/wekan.git
synced 2026-01-04 16:48:49 +01:00
add cardNumber handling to card and board model
This commit is contained in:
parent
36c2cb9573
commit
b57eae14d4
3 changed files with 72 additions and 0 deletions
|
|
@ -375,6 +375,14 @@ Boards.attachSchema(
|
|||
defaultValue: true,
|
||||
},
|
||||
|
||||
allowsCardNumber: {
|
||||
/**
|
||||
* Does the board allows card numbers?
|
||||
*/
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
|
||||
allowsActivities: {
|
||||
/**
|
||||
* Does the board allows comments?
|
||||
|
|
@ -1056,6 +1064,16 @@ Boards.helpers({
|
|||
return result;
|
||||
},
|
||||
|
||||
getNextCardNumber() {
|
||||
const boardCards = Cards.find({ boardId: this._id }).fetch();
|
||||
if (boardCards.length == 0) {
|
||||
return 1;
|
||||
}
|
||||
const maxCardNumber = Math.max(...boardCards
|
||||
.map(c => c.cardNumber ? c.cardNumber : 0));
|
||||
return maxCardNumber + 1;
|
||||
},
|
||||
|
||||
cardsDueInBetween(start, end) {
|
||||
return Cards.find({
|
||||
boardId: this._id,
|
||||
|
|
@ -1285,6 +1303,10 @@ Boards.mutations({
|
|||
return { $set: { allowsDescriptionTitle } };
|
||||
},
|
||||
|
||||
setAllowsCardNumber(allowsCardNumber) {
|
||||
return { $set: { allowsCardNumber } };
|
||||
},
|
||||
|
||||
setAllowsDescriptionText(allowsDescriptionText) {
|
||||
return { $set: { allowsDescriptionText } };
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue