2017-07-08 13:23:33 +01:00
|
|
|
import { TrelloCreator } from './trelloCreator';
|
|
|
|
|
import { WekanCreator } from './wekanCreator';
|
2015-10-17 19:29:25 +02:00
|
|
|
|
2015-10-14 17:57:58 +02:00
|
|
|
Meteor.methods({
|
2017-07-24 23:56:51 +01:00
|
|
|
importBoard(board, data, importSource, currentBoard) {
|
2018-11-08 22:49:08 +02:00
|
|
|
//check(board, Object);
|
|
|
|
|
//check(data, Object);
|
|
|
|
|
//check(importSource, String);
|
|
|
|
|
//check(currentBoard, Match.Maybe(String));
|
2017-07-08 13:23:33 +01:00
|
|
|
let creator;
|
|
|
|
|
switch (importSource) {
|
|
|
|
|
case 'trello':
|
|
|
|
|
creator = new TrelloCreator(data);
|
|
|
|
|
break;
|
|
|
|
|
case 'wekan':
|
|
|
|
|
creator = new WekanCreator(data);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-10-19 20:14:29 +02:00
|
|
|
|
2015-10-19 12:41:56 +02:00
|
|
|
// 1. check all parameters are ok from a syntax point of view
|
2018-11-08 22:49:08 +02:00
|
|
|
//creator.check(board);
|
2015-10-14 17:57:58 +02:00
|
|
|
|
2015-10-20 20:02:12 +02:00
|
|
|
// 2. check parameters are ok from a business point of view (exist &
|
|
|
|
|
// authorized) nothing to check, everyone can import boards in their account
|
2015-10-19 20:14:29 +02:00
|
|
|
|
2015-10-19 00:59:50 +02:00
|
|
|
// 3. create all elements
|
2017-07-24 23:56:51 +01:00
|
|
|
return creator.create(board, currentBoard);
|
2015-10-19 00:59:50 +02:00
|
|
|
},
|
2015-10-14 17:57:58 +02:00
|
|
|
});
|