mirror of
https://github.com/plankanban/planka.git
synced 2025-07-24 15:49:46 +02:00
Project managers, board members, auto-update after reconnection, refactoring
This commit is contained in:
parent
d6cb1f6683
commit
b39119ace4
478 changed files with 21226 additions and 19495 deletions
41
server/api/helpers/boards/get-cards.js
Normal file
41
server/api/helpers/boards/get-cards.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
const LIMIT = 10;
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
recordOrIdOrIds: {
|
||||
type: 'ref',
|
||||
custom: (value) => _.isObjectLike(value) || _.isString(value) || _.every(value, _.isString),
|
||||
required: true,
|
||||
},
|
||||
beforeId: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs) {
|
||||
const criteria = {};
|
||||
|
||||
let sort;
|
||||
let limit;
|
||||
|
||||
if (_.isObjectLike(inputs.recordOrIdOrIds)) {
|
||||
criteria.boardId = inputs.recordOrIdOrIds.id;
|
||||
|
||||
if (inputs.recordOrIdOrIds.type === Board.Types.KANBAN) {
|
||||
sort = 'position';
|
||||
} else if (inputs.recordOrIdOrIds.type === Board.Types.COLLECTION) {
|
||||
if (inputs.beforeId) {
|
||||
criteria.id = {
|
||||
'<': inputs.beforeId,
|
||||
};
|
||||
}
|
||||
|
||||
limit = LIMIT;
|
||||
}
|
||||
} else {
|
||||
criteria.boardId = inputs.recordOrIdOrIds;
|
||||
}
|
||||
|
||||
return sails.helpers.cards.getMany(criteria, sort, limit);
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue