1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-20 13:49:43 +02:00

feat: Trello board JSON import (#352)

Closes #27, closes #105
This commit is contained in:
Christoph Enne 2022-12-16 23:48:06 +01:00 committed by GitHub
parent 9ce8b2ab9c
commit 738ed19e7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 537 additions and 89 deletions

View file

@ -5,6 +5,13 @@ module.exports = {
custom: (value) => _.isPlainObject(value) && _.isFinite(value.position),
required: true,
},
import: {
type: 'json',
custom: (value) =>
value.type &&
Object.values(Board.ImportTypes).includes(value.type) &&
_.isPlainObject(value.board),
},
user: {
type: 'ref',
required: true,
@ -13,6 +20,10 @@ module.exports = {
type: 'ref',
required: true,
},
requestId: {
type: 'string',
isNotEmptyString: true,
},
request: {
type: 'ref',
},
@ -54,6 +65,10 @@ module.exports = {
projectId: inputs.project.id,
}).fetch();
if (inputs.import && inputs.import.type === Board.ImportTypes.TRELLO) {
await sails.helpers.boards.importFromTrello(inputs.user, board, inputs.import.board);
}
const boardMembership = await BoardMembership.create({
boardId: board.id,
userId: inputs.user.id,
@ -66,6 +81,7 @@ module.exports = {
'boardCreate',
{
item: board,
requestId: inputs.requestId,
},
inputs.request,
);