wekanCreator.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. const DateString = Match.Where(function (dateAsString) {
  2. check(dateAsString, String);
  3. return moment(dateAsString, moment.ISO_8601).isValid();
  4. });
  5. export class WekanCreator {
  6. constructor(data) {
  7. // we log current date, to use the same timestamp for all our actions.
  8. // this helps to retrieve all elements performed by the same import.
  9. this._nowDate = new Date();
  10. // The object creation dates, indexed by Wekan id
  11. // (so we only parse actions once!)
  12. this.createdAt = {
  13. board: null,
  14. cards: {},
  15. lists: {},
  16. swimlanes: {},
  17. };
  18. // The object creator Wekan Id, indexed by the object Wekan id
  19. // (so we only parse actions once!)
  20. this.createdBy = {
  21. cards: {}, // only cards have a field for that
  22. };
  23. // Map of labels Wekan ID => Wekan ID
  24. this.labels = {};
  25. // Map of swimlanes Wekan ID => Wekan ID
  26. this.swimlanes = {};
  27. // Map of lists Wekan ID => Wekan ID
  28. this.lists = {};
  29. // Map of cards Wekan ID => Wekan ID
  30. this.cards = {};
  31. // Map of comments Wekan ID => Wekan ID
  32. this.commentIds = {};
  33. // Map of attachments Wekan ID => Wekan ID
  34. this.attachmentIds = {};
  35. // Map of checklists Wekan ID => Wekan ID
  36. this.checklists = {};
  37. // Map of checklistItems Wekan ID => Wekan ID
  38. this.checklistItems = {};
  39. // The comments, indexed by Wekan card id (to map when importing cards)
  40. this.comments = {};
  41. // the members, indexed by Wekan member id => Wekan user ID
  42. this.members = data.membersMapping ? data.membersMapping : {};
  43. // maps a wekanCardId to an array of wekanAttachments
  44. this.attachments = {};
  45. }
  46. /**
  47. * If dateString is provided,
  48. * return the Date it represents.
  49. * If not, will return the date when it was first called.
  50. * This is useful for us, as we want all import operations to
  51. * have the exact same date for easier later retrieval.
  52. *
  53. * @param {String} dateString a properly formatted Date
  54. */
  55. _now(dateString) {
  56. if(dateString) {
  57. return new Date(dateString);
  58. }
  59. if(!this._nowDate) {
  60. this._nowDate = new Date();
  61. }
  62. return this._nowDate;
  63. }
  64. /**
  65. * if wekanUserId is provided and we have a mapping,
  66. * return it.
  67. * Otherwise return current logged user.
  68. * @param wekanUserId
  69. * @private
  70. */
  71. _user(wekanUserId) {
  72. if(wekanUserId && this.members[wekanUserId]) {
  73. return this.members[wekanUserId];
  74. }
  75. return Meteor.userId();
  76. }
  77. checkActivities(wekanActivities) {
  78. check(wekanActivities, [Match.ObjectIncluding({
  79. activityType: String,
  80. createdAt: DateString,
  81. })]);
  82. // XXX we could perform more thorough checks based on action type
  83. }
  84. checkBoard(wekanBoard) {
  85. check(wekanBoard, Match.ObjectIncluding({
  86. archived: Boolean,
  87. title: String,
  88. // XXX refine control by validating 'color' against a list of
  89. // allowed values (is it worth the maintenance?)
  90. color: String,
  91. permission: Match.Where((value) => {
  92. return ['private', 'public'].indexOf(value)>= 0;
  93. }),
  94. }));
  95. }
  96. checkCards(wekanCards) {
  97. check(wekanCards, [Match.ObjectIncluding({
  98. archived: Boolean,
  99. dateLastActivity: DateString,
  100. labelIds: [String],
  101. title: String,
  102. sort: Number,
  103. })]);
  104. }
  105. checkLabels(wekanLabels) {
  106. check(wekanLabels, [Match.ObjectIncluding({
  107. // XXX refine control by validating 'color' against a list of allowed
  108. // values (is it worth the maintenance?)
  109. color: String,
  110. })]);
  111. }
  112. checkLists(wekanLists) {
  113. check(wekanLists, [Match.ObjectIncluding({
  114. archived: Boolean,
  115. title: String,
  116. })]);
  117. }
  118. checkSwimlanes(wekanSwimlanes) {
  119. check(wekanSwimlanes, [Match.ObjectIncluding({
  120. archived: Boolean,
  121. title: String,
  122. })]);
  123. }
  124. checkChecklists(wekanChecklists) {
  125. check(wekanChecklists, [Match.ObjectIncluding({
  126. cardId: String,
  127. title: String,
  128. })]);
  129. }
  130. checkChecklistItems(wekanChecklistItems) {
  131. check(wekanChecklistItems, [Match.ObjectIncluding({
  132. cardId: String,
  133. title: String,
  134. })]);
  135. }
  136. // You must call parseActions before calling this one.
  137. createBoardAndLabels(boardToImport) {
  138. const boardToCreate = {
  139. archived: boardToImport.archived,
  140. color: boardToImport.color,
  141. // very old boards won't have a creation activity so no creation date
  142. createdAt: this._now(boardToImport.createdAt),
  143. labels: [],
  144. members: [{
  145. userId: Meteor.userId(),
  146. wekanId: Meteor.userId(),
  147. isActive: true,
  148. isAdmin: true,
  149. isNoComments: false,
  150. isCommentOnly: false,
  151. swimlaneId: false,
  152. }],
  153. // Standalone Export has modifiedAt missing, adding modifiedAt to fix it
  154. modifiedAt: this._now(boardToImport.modifiedAt),
  155. permission: boardToImport.permission,
  156. slug: getSlug(boardToImport.title) || 'board',
  157. stars: 0,
  158. title: boardToImport.title,
  159. };
  160. // now add other members
  161. if(boardToImport.members) {
  162. boardToImport.members.forEach((wekanMember) => {
  163. // do we already have it in our list?
  164. if(!boardToCreate.members.some((member) => member.wekanId === wekanMember.wekanId))
  165. boardToCreate.members.push({
  166. ... wekanMember,
  167. userId: wekanMember.wekanId,
  168. });
  169. });
  170. }
  171. boardToImport.labels.forEach((label) => {
  172. const labelToCreate = {
  173. _id: Random.id(6),
  174. color: label.color,
  175. name: label.name,
  176. };
  177. // We need to remember them by Wekan ID, as this is the only ref we have
  178. // when importing cards.
  179. this.labels[label._id] = labelToCreate._id;
  180. boardToCreate.labels.push(labelToCreate);
  181. });
  182. const boardId = Boards.direct.insert(boardToCreate);
  183. Boards.direct.update(boardId, {$set: {modifiedAt: this._now()}});
  184. // log activity
  185. Activities.direct.insert({
  186. activityType: 'importBoard',
  187. boardId,
  188. createdAt: this._now(),
  189. source: {
  190. id: boardToImport.id,
  191. system: 'Wekan',
  192. },
  193. // We attribute the import to current user,
  194. // not the author from the original object.
  195. userId: this._user(),
  196. });
  197. return boardId;
  198. }
  199. /**
  200. * Create the Wekan cards corresponding to the supplied Wekan cards,
  201. * as well as all linked data: activities, comments, and attachments
  202. * @param wekanCards
  203. * @param boardId
  204. * @returns {Array}
  205. */
  206. createCards(wekanCards, boardId) {
  207. const result = [];
  208. wekanCards.forEach((card) => {
  209. const cardToCreate = {
  210. archived: card.archived,
  211. boardId,
  212. // very old boards won't have a creation activity so no creation date
  213. createdAt: this._now(this.createdAt.cards[card._id]),
  214. dateLastActivity: this._now(),
  215. description: card.description,
  216. listId: this.lists[card.listId],
  217. swimlaneId: this.swimlanes[card.swimlaneId],
  218. sort: card.sort,
  219. title: card.title,
  220. // we attribute the card to its creator if available
  221. userId: this._user(this.createdBy.cards[card._id]),
  222. isOvertime: card.isOvertime || false,
  223. startAt: card.startAt ? this._now(card.startAt) : null,
  224. dueAt: card.dueAt ? this._now(card.dueAt) : null,
  225. spentTime: card.spentTime || null,
  226. };
  227. // add labels
  228. if (card.labelIds) {
  229. cardToCreate.labelIds = card.labelIds.map((wekanId) => {
  230. return this.labels[wekanId];
  231. });
  232. }
  233. // add members {
  234. if(card.members) {
  235. const wekanMembers = [];
  236. // we can't just map, as some members may not have been mapped
  237. card.members.forEach((sourceMemberId) => {
  238. if(this.members[sourceMemberId]) {
  239. const wekanId = this.members[sourceMemberId];
  240. // we may map multiple Wekan members to the same wekan user
  241. // in which case we risk adding the same user multiple times
  242. if(!wekanMembers.find((wId) => wId === wekanId)){
  243. wekanMembers.push(wekanId);
  244. }
  245. }
  246. return true;
  247. });
  248. if(wekanMembers.length>0) {
  249. cardToCreate.members = wekanMembers;
  250. }
  251. }
  252. // insert card
  253. const cardId = Cards.direct.insert(cardToCreate);
  254. // keep track of Wekan id => WeKan id
  255. this.cards[card._id] = cardId;
  256. // // log activity
  257. // Activities.direct.insert({
  258. // activityType: 'importCard',
  259. // boardId,
  260. // cardId,
  261. // createdAt: this._now(),
  262. // listId: cardToCreate.listId,
  263. // source: {
  264. // id: card._id,
  265. // system: 'Wekan',
  266. // },
  267. // // we attribute the import to current user,
  268. // // not the author of the original card
  269. // userId: this._user(),
  270. // });
  271. // add comments
  272. const comments = this.comments[card._id];
  273. if (comments) {
  274. comments.forEach((comment) => {
  275. const commentToCreate = {
  276. boardId,
  277. cardId,
  278. createdAt: this._now(comment.createdAt),
  279. text: comment.text,
  280. // we attribute the comment to the original author, default to current user
  281. userId: this._user(comment.userId),
  282. };
  283. // dateLastActivity will be set from activity insert, no need to
  284. // update it ourselves
  285. const commentId = CardComments.direct.insert(commentToCreate);
  286. this.commentIds[comment._id] = commentId;
  287. // Activities.direct.insert({
  288. // activityType: 'addComment',
  289. // boardId: commentToCreate.boardId,
  290. // cardId: commentToCreate.cardId,
  291. // commentId,
  292. // createdAt: this._now(commentToCreate.createdAt),
  293. // // we attribute the addComment (not the import)
  294. // // to the original author - it is needed by some UI elements.
  295. // userId: commentToCreate.userId,
  296. // });
  297. });
  298. }
  299. const attachments = this.attachments[card._id];
  300. const wekanCoverId = card.coverId;
  301. if (attachments) {
  302. attachments.forEach((att) => {
  303. const file = new FS.File();
  304. // Simulating file.attachData on the client generates multiple errors
  305. // - HEAD returns null, which causes exception down the line
  306. // - the template then tries to display the url to the attachment which causes other errors
  307. // so we make it server only, and let UI catch up once it is done, forget about latency comp.
  308. const self = this;
  309. if(Meteor.isServer) {
  310. if (att.url) {
  311. file.attachData(att.url, function (error) {
  312. file.boardId = boardId;
  313. file.cardId = cardId;
  314. file.userId = self._user(att.userId);
  315. // The field source will only be used to prevent adding
  316. // attachments' related activities automatically
  317. file.source = 'import';
  318. if (error) {
  319. throw(error);
  320. } else {
  321. const wekanAtt = Attachments.insert(file, () => {
  322. // we do nothing
  323. });
  324. self.attachmentIds[att._id] = wekanAtt._id;
  325. //
  326. if(wekanCoverId === att._id) {
  327. Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
  328. }
  329. }
  330. });
  331. } else if (att.file) {
  332. file.attachData(new Buffer(att.file, 'base64'), {type: att.type}, (error) => {
  333. file.name(att.name);
  334. file.boardId = boardId;
  335. file.cardId = cardId;
  336. file.userId = self._user(att.userId);
  337. // The field source will only be used to prevent adding
  338. // attachments' related activities automatically
  339. file.source = 'import';
  340. if (error) {
  341. throw(error);
  342. } else {
  343. const wekanAtt = Attachments.insert(file, () => {
  344. // we do nothing
  345. });
  346. this.attachmentIds[att._id] = wekanAtt._id;
  347. //
  348. if(wekanCoverId === att._id) {
  349. Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
  350. }
  351. }
  352. });
  353. }
  354. }
  355. // todo XXX set cover - if need be
  356. });
  357. }
  358. result.push(cardId);
  359. });
  360. return result;
  361. }
  362. // Create labels if they do not exist and load this.labels.
  363. createLabels(wekanLabels, board) {
  364. wekanLabels.forEach((label) => {
  365. const color = label.color;
  366. const name = label.name;
  367. const existingLabel = board.getLabel(name, color);
  368. if (existingLabel) {
  369. this.labels[label.id] = existingLabel._id;
  370. } else {
  371. const idLabelCreated = board.pushLabel(name, color);
  372. this.labels[label.id] = idLabelCreated;
  373. }
  374. });
  375. }
  376. createLists(wekanLists, boardId) {
  377. wekanLists.forEach((list, listIndex) => {
  378. const listToCreate = {
  379. archived: list.archived,
  380. boardId,
  381. // We are being defensing here by providing a default date (now) if the
  382. // creation date wasn't found on the action log. This happen on old
  383. // Wekan boards (eg from 2013) that didn't log the 'createList' action
  384. // we require.
  385. createdAt: this._now(this.createdAt.lists[list.id]),
  386. title: list.title,
  387. sort: list.sort ? list.sort : listIndex,
  388. };
  389. const listId = Lists.direct.insert(listToCreate);
  390. Lists.direct.update(listId, {$set: {'updatedAt': this._now()}});
  391. this.lists[list._id] = listId;
  392. // // log activity
  393. // Activities.direct.insert({
  394. // activityType: 'importList',
  395. // boardId,
  396. // createdAt: this._now(),
  397. // listId,
  398. // source: {
  399. // id: list._id,
  400. // system: 'Wekan',
  401. // },
  402. // // We attribute the import to current user,
  403. // // not the creator of the original object
  404. // userId: this._user(),
  405. // });
  406. });
  407. }
  408. createSwimlanes(wekanSwimlanes, boardId) {
  409. wekanSwimlanes.forEach((swimlane, swimlaneIndex) => {
  410. const swimlaneToCreate = {
  411. archived: swimlane.archived,
  412. boardId,
  413. // We are being defensing here by providing a default date (now) if the
  414. // creation date wasn't found on the action log. This happen on old
  415. // Wekan boards (eg from 2013) that didn't log the 'createList' action
  416. // we require.
  417. createdAt: this._now(this.createdAt.swimlanes[swimlane._id]),
  418. title: swimlane.title,
  419. sort: swimlane.sort ? swimlane.sort : swimlaneIndex,
  420. };
  421. const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
  422. Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});
  423. this.swimlanes[swimlane._id] = swimlaneId;
  424. });
  425. }
  426. createChecklists(wekanChecklists) {
  427. const result = [];
  428. wekanChecklists.forEach((checklist, checklistIndex) => {
  429. // Create the checklist
  430. const checklistToCreate = {
  431. cardId: this.cards[checklist.cardId],
  432. title: checklist.title,
  433. createdAt: checklist.createdAt,
  434. sort: checklist.sort ? checklist.sort : checklistIndex,
  435. };
  436. const checklistId = Checklists.direct.insert(checklistToCreate);
  437. this.checklists[checklist._id] = checklistId;
  438. result.push(checklistId);
  439. });
  440. return result;
  441. }
  442. createChecklistItems(wekanChecklistItems) {
  443. wekanChecklistItems.forEach((checklistitem, checklistitemIndex) => {
  444. // Create the checklistItem
  445. const checklistItemTocreate = {
  446. title: checklistitem.title,
  447. checklistId: this.checklists[checklistitem.checklistId],
  448. cardId: this.cards[checklistitem.cardId],
  449. sort: checklistitem.sort ? checklistitem.sort : checklistitemIndex,
  450. isFinished: checklistitem.isFinished,
  451. };
  452. const checklistItemId = ChecklistItems.direct.insert(checklistItemTocreate);
  453. this.checklistItems[checklistitem._id] = checklistItemId;
  454. });
  455. }
  456. parseActivities(wekanBoard) {
  457. wekanBoard.activities.forEach((activity) => {
  458. switch (activity.activityType) {
  459. case 'addAttachment': {
  460. // We have to be cautious, because the attachment could have been removed later.
  461. // In that case Wekan still reports its addition, but removes its 'url' field.
  462. // So we test for that
  463. const wekanAttachment = wekanBoard.attachments.filter((attachment) => {
  464. return attachment._id === activity.attachmentId;
  465. })[0];
  466. if ( typeof wekanAttachment !== 'undefined' && wekanAttachment ) {
  467. if(wekanAttachment.url || wekanAttachment.file) {
  468. // we cannot actually create the Wekan attachment, because we don't yet
  469. // have the cards to attach it to, so we store it in the instance variable.
  470. const wekanCardId = activity.cardId;
  471. if(!this.attachments[wekanCardId]) {
  472. this.attachments[wekanCardId] = [];
  473. }
  474. this.attachments[wekanCardId].push(wekanAttachment);
  475. }
  476. }
  477. break;
  478. }
  479. case 'addComment': {
  480. const wekanComment = wekanBoard.comments.filter((comment) => {
  481. return comment._id === activity.commentId;
  482. })[0];
  483. const id = activity.cardId;
  484. if (!this.comments[id]) {
  485. this.comments[id] = [];
  486. }
  487. this.comments[id].push(wekanComment);
  488. break;
  489. }
  490. case 'createBoard': {
  491. this.createdAt.board = activity.createdAt;
  492. break;
  493. }
  494. case 'createCard': {
  495. const cardId = activity.cardId;
  496. this.createdAt.cards[cardId] = activity.createdAt;
  497. this.createdBy.cards[cardId] = activity.userId;
  498. break;
  499. }
  500. case 'createList': {
  501. const listId = activity.listId;
  502. this.createdAt.lists[listId] = activity.createdAt;
  503. break;
  504. }
  505. case 'createSwimlane': {
  506. const swimlaneId = activity.swimlaneId;
  507. this.createdAt.swimlanes[swimlaneId] = activity.createdAt;
  508. break;
  509. }}
  510. });
  511. }
  512. importActivities(activities, boardId) {
  513. activities.forEach((activity) => {
  514. switch (activity.activityType) {
  515. // Board related activities
  516. // TODO: addBoardMember, removeBoardMember
  517. case 'createBoard': {
  518. Activities.direct.insert({
  519. userId: this._user(activity.userId),
  520. type: 'board',
  521. activityTypeId: boardId,
  522. activityType: activity.activityType,
  523. boardId,
  524. createdAt: this._now(activity.createdAt),
  525. });
  526. break;
  527. }
  528. // List related activities
  529. // TODO: removeList, archivedList
  530. case 'createList': {
  531. Activities.direct.insert({
  532. userId: this._user(activity.userId),
  533. type: 'list',
  534. activityType: activity.activityType,
  535. listId: this.lists[activity.listId],
  536. boardId,
  537. createdAt: this._now(activity.createdAt),
  538. });
  539. break;
  540. }
  541. // Card related activities
  542. // TODO: archivedCard, restoredCard, joinMember, unjoinMember
  543. case 'createCard': {
  544. Activities.direct.insert({
  545. userId: this._user(activity.userId),
  546. activityType: activity.activityType,
  547. listId: this.lists[activity.listId],
  548. cardId: this.cards[activity.cardId],
  549. boardId,
  550. createdAt: this._now(activity.createdAt),
  551. });
  552. break;
  553. }
  554. case 'moveCard': {
  555. Activities.direct.insert({
  556. userId: this._user(activity.userId),
  557. oldListId: this.lists[activity.oldListId],
  558. activityType: activity.activityType,
  559. listId: this.lists[activity.listId],
  560. cardId: this.cards[activity.cardId],
  561. boardId,
  562. createdAt: this._now(activity.createdAt),
  563. });
  564. break;
  565. }
  566. // Comment related activities
  567. case 'addComment': {
  568. Activities.direct.insert({
  569. userId: this._user(activity.userId),
  570. activityType: activity.activityType,
  571. cardId: this.cards[activity.cardId],
  572. commentId: this.commentIds[activity.commentId],
  573. boardId,
  574. createdAt: this._now(activity.createdAt),
  575. });
  576. break;
  577. }
  578. // Attachment related activities
  579. case 'addAttachment': {
  580. Activities.direct.insert({
  581. userId: this._user(activity.userId),
  582. type: 'card',
  583. activityType: activity.activityType,
  584. attachmentId: this.attachmentIds[activity.attachmentId],
  585. cardId: this.cards[activity.cardId],
  586. boardId,
  587. createdAt: this._now(activity.createdAt),
  588. });
  589. break;
  590. }
  591. // Checklist related activities
  592. case 'addChecklist': {
  593. Activities.direct.insert({
  594. userId: this._user(activity.userId),
  595. activityType: activity.activityType,
  596. cardId: this.cards[activity.cardId],
  597. checklistId: this.checklists[activity.checklistId],
  598. boardId,
  599. createdAt: this._now(activity.createdAt),
  600. });
  601. break;
  602. }
  603. case 'addChecklistItem': {
  604. Activities.direct.insert({
  605. userId: this._user(activity.userId),
  606. activityType: activity.activityType,
  607. cardId: this.cards[activity.cardId],
  608. checklistId: this.checklists[activity.checklistId],
  609. checklistItemId: activity.checklistItemId.replace(
  610. activity.checklistId,
  611. this.checklists[activity.checklistId]),
  612. boardId,
  613. createdAt: this._now(activity.createdAt),
  614. });
  615. break;
  616. }}
  617. });
  618. }
  619. check(board) {
  620. try {
  621. // check(data, {
  622. // membersMapping: Match.Optional(Object),
  623. // });
  624. this.checkActivities(board.activities);
  625. this.checkBoard(board);
  626. this.checkLabels(board.labels);
  627. this.checkLists(board.lists);
  628. this.checkSwimlanes(board.swimlanes);
  629. this.checkCards(board.cards);
  630. this.checkChecklists(board.checklists);
  631. this.checkChecklistItems(board.checklistItems);
  632. } catch (e) {
  633. throw new Meteor.Error('error-json-schema');
  634. }
  635. }
  636. create(board, currentBoardId) {
  637. // TODO : Make isSandstorm variable global
  638. const isSandstorm = Meteor.settings && Meteor.settings.public &&
  639. Meteor.settings.public.sandstorm;
  640. if (isSandstorm && currentBoardId) {
  641. const currentBoard = Boards.findOne(currentBoardId);
  642. currentBoard.archive();
  643. }
  644. this.parseActivities(board);
  645. const boardId = this.createBoardAndLabels(board);
  646. this.createLists(board.lists, boardId);
  647. this.createSwimlanes(board.swimlanes, boardId);
  648. this.createCards(board.cards, boardId);
  649. this.createChecklists(board.checklists);
  650. this.createChecklistItems(board.checklistItems);
  651. this.importActivities(board.activities, boardId);
  652. // XXX add members
  653. return boardId;
  654. }
  655. }