wekanCreator.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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. isCommentOnly: false,
  150. swimlaneId: false,
  151. }],
  152. // Standalone Export has modifiedAt missing, adding modifiedAt to fix it
  153. modifiedAt: this._now(boardToImport.modifiedAt),
  154. permission: boardToImport.permission,
  155. slug: getSlug(boardToImport.title) || 'board',
  156. stars: 0,
  157. title: boardToImport.title,
  158. };
  159. // now add other members
  160. if(boardToImport.members) {
  161. boardToImport.members.forEach((wekanMember) => {
  162. // do we already have it in our list?
  163. if(!boardToCreate.members.some((member) => member.wekanId === wekanMember.wekanId))
  164. boardToCreate.members.push({
  165. ... wekanMember,
  166. userId: wekanMember.wekanId,
  167. });
  168. });
  169. }
  170. boardToImport.labels.forEach((label) => {
  171. const labelToCreate = {
  172. _id: Random.id(6),
  173. color: label.color,
  174. name: label.name,
  175. };
  176. // We need to remember them by Wekan ID, as this is the only ref we have
  177. // when importing cards.
  178. this.labels[label._id] = labelToCreate._id;
  179. boardToCreate.labels.push(labelToCreate);
  180. });
  181. const boardId = Boards.direct.insert(boardToCreate);
  182. Boards.direct.update(boardId, {$set: {modifiedAt: this._now()}});
  183. // log activity
  184. Activities.direct.insert({
  185. activityType: 'importBoard',
  186. boardId,
  187. createdAt: this._now(),
  188. source: {
  189. id: boardToImport.id,
  190. system: 'Wekan',
  191. },
  192. // We attribute the import to current user,
  193. // not the author from the original object.
  194. userId: this._user(),
  195. });
  196. return boardId;
  197. }
  198. /**
  199. * Create the Wekan cards corresponding to the supplied Wekan cards,
  200. * as well as all linked data: activities, comments, and attachments
  201. * @param wekanCards
  202. * @param boardId
  203. * @returns {Array}
  204. */
  205. createCards(wekanCards, boardId) {
  206. const result = [];
  207. wekanCards.forEach((card) => {
  208. const cardToCreate = {
  209. archived: card.archived,
  210. boardId,
  211. // very old boards won't have a creation activity so no creation date
  212. createdAt: this._now(this.createdAt.cards[card._id]),
  213. dateLastActivity: this._now(),
  214. description: card.description,
  215. listId: this.lists[card.listId],
  216. swimlaneId: this.swimlanes[card.swimlaneId],
  217. sort: card.sort,
  218. title: card.title,
  219. // we attribute the card to its creator if available
  220. userId: this._user(this.createdBy.cards[card._id]),
  221. isOvertime: card.isOvertime || false,
  222. startAt: card.startAt ? this._now(card.startAt) : null,
  223. dueAt: card.dueAt ? this._now(card.dueAt) : null,
  224. spentTime: card.spentTime || null,
  225. };
  226. // add labels
  227. if (card.labelIds) {
  228. cardToCreate.labelIds = card.labelIds.map((wekanId) => {
  229. return this.labels[wekanId];
  230. });
  231. }
  232. // add members {
  233. if(card.members) {
  234. const wekanMembers = [];
  235. // we can't just map, as some members may not have been mapped
  236. card.members.forEach((sourceMemberId) => {
  237. if(this.members[sourceMemberId]) {
  238. const wekanId = this.members[sourceMemberId];
  239. // we may map multiple Wekan members to the same wekan user
  240. // in which case we risk adding the same user multiple times
  241. if(!wekanMembers.find((wId) => wId === wekanId)){
  242. wekanMembers.push(wekanId);
  243. }
  244. }
  245. return true;
  246. });
  247. if(wekanMembers.length>0) {
  248. cardToCreate.members = wekanMembers;
  249. }
  250. }
  251. // insert card
  252. const cardId = Cards.direct.insert(cardToCreate);
  253. // keep track of Wekan id => WeKan id
  254. this.cards[card._id] = cardId;
  255. // // log activity
  256. // Activities.direct.insert({
  257. // activityType: 'importCard',
  258. // boardId,
  259. // cardId,
  260. // createdAt: this._now(),
  261. // listId: cardToCreate.listId,
  262. // source: {
  263. // id: card._id,
  264. // system: 'Wekan',
  265. // },
  266. // // we attribute the import to current user,
  267. // // not the author of the original card
  268. // userId: this._user(),
  269. // });
  270. // add comments
  271. const comments = this.comments[card._id];
  272. if (comments) {
  273. comments.forEach((comment) => {
  274. const commentToCreate = {
  275. boardId,
  276. cardId,
  277. createdAt: this._now(comment.createdAt),
  278. text: comment.text,
  279. // we attribute the comment to the original author, default to current user
  280. userId: this._user(comment.userId),
  281. };
  282. // dateLastActivity will be set from activity insert, no need to
  283. // update it ourselves
  284. const commentId = CardComments.direct.insert(commentToCreate);
  285. this.commentIds[comment._id] = commentId;
  286. // Activities.direct.insert({
  287. // activityType: 'addComment',
  288. // boardId: commentToCreate.boardId,
  289. // cardId: commentToCreate.cardId,
  290. // commentId,
  291. // createdAt: this._now(commentToCreate.createdAt),
  292. // // we attribute the addComment (not the import)
  293. // // to the original author - it is needed by some UI elements.
  294. // userId: commentToCreate.userId,
  295. // });
  296. });
  297. }
  298. const attachments = this.attachments[card._id];
  299. const wekanCoverId = card.coverId;
  300. if (attachments) {
  301. attachments.forEach((att) => {
  302. const file = new FS.File();
  303. // Simulating file.attachData on the client generates multiple errors
  304. // - HEAD returns null, which causes exception down the line
  305. // - the template then tries to display the url to the attachment which causes other errors
  306. // so we make it server only, and let UI catch up once it is done, forget about latency comp.
  307. const self = this;
  308. if(Meteor.isServer) {
  309. if (att.url) {
  310. file.attachData(att.url, function (error) {
  311. file.boardId = boardId;
  312. file.cardId = cardId;
  313. file.userId = self._user(att.userId);
  314. // The field source will only be used to prevent adding
  315. // attachments' related activities automatically
  316. file.source = 'import';
  317. if (error) {
  318. throw(error);
  319. } else {
  320. const wekanAtt = Attachments.insert(file, () => {
  321. // we do nothing
  322. });
  323. self.attachmentIds[att._id] = wekanAtt._id;
  324. //
  325. if(wekanCoverId === att._id) {
  326. Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
  327. }
  328. }
  329. });
  330. } else if (att.file) {
  331. file.attachData(new Buffer(att.file, 'base64'), {type: att.type}, (error) => {
  332. file.name(att.name);
  333. file.boardId = boardId;
  334. file.cardId = cardId;
  335. file.userId = self._user(att.userId);
  336. // The field source will only be used to prevent adding
  337. // attachments' related activities automatically
  338. file.source = 'import';
  339. if (error) {
  340. throw(error);
  341. } else {
  342. const wekanAtt = Attachments.insert(file, () => {
  343. // we do nothing
  344. });
  345. this.attachmentIds[att._id] = wekanAtt._id;
  346. //
  347. if(wekanCoverId === att._id) {
  348. Cards.direct.update(cardId, { $set: {coverId: wekanAtt._id}});
  349. }
  350. }
  351. });
  352. }
  353. }
  354. // todo XXX set cover - if need be
  355. });
  356. }
  357. result.push(cardId);
  358. });
  359. return result;
  360. }
  361. // Create labels if they do not exist and load this.labels.
  362. createLabels(wekanLabels, board) {
  363. wekanLabels.forEach((label) => {
  364. const color = label.color;
  365. const name = label.name;
  366. const existingLabel = board.getLabel(name, color);
  367. if (existingLabel) {
  368. this.labels[label.id] = existingLabel._id;
  369. } else {
  370. const idLabelCreated = board.pushLabel(name, color);
  371. this.labels[label.id] = idLabelCreated;
  372. }
  373. });
  374. }
  375. createLists(wekanLists, boardId) {
  376. wekanLists.forEach((list) => {
  377. const listToCreate = {
  378. archived: list.archived,
  379. boardId,
  380. // We are being defensing here by providing a default date (now) if the
  381. // creation date wasn't found on the action log. This happen on old
  382. // Wekan boards (eg from 2013) that didn't log the 'createList' action
  383. // we require.
  384. createdAt: this._now(this.createdAt.lists[list.id]),
  385. title: list.title,
  386. };
  387. const listId = Lists.direct.insert(listToCreate);
  388. Lists.direct.update(listId, {$set: {'updatedAt': this._now()}});
  389. this.lists[list._id] = listId;
  390. // // log activity
  391. // Activities.direct.insert({
  392. // activityType: 'importList',
  393. // boardId,
  394. // createdAt: this._now(),
  395. // listId,
  396. // source: {
  397. // id: list._id,
  398. // system: 'Wekan',
  399. // },
  400. // // We attribute the import to current user,
  401. // // not the creator of the original object
  402. // userId: this._user(),
  403. // });
  404. });
  405. }
  406. createSwimlanes(wekanSwimlanes, boardId) {
  407. wekanSwimlanes.forEach((swimlane) => {
  408. const swimlaneToCreate = {
  409. archived: swimlane.archived,
  410. boardId,
  411. // We are being defensing here by providing a default date (now) if the
  412. // creation date wasn't found on the action log. This happen on old
  413. // Wekan boards (eg from 2013) that didn't log the 'createList' action
  414. // we require.
  415. createdAt: this._now(this.createdAt.swimlanes[swimlane._id]),
  416. title: swimlane.title,
  417. };
  418. const swimlaneId = Swimlanes.direct.insert(swimlaneToCreate);
  419. Swimlanes.direct.update(swimlaneId, {$set: {'updatedAt': this._now()}});
  420. this.swimlanes[swimlane._id] = swimlaneId;
  421. });
  422. }
  423. createChecklists(wekanChecklists) {
  424. const result = [];
  425. wekanChecklists.forEach((checklist, checklistIndex) => {
  426. // Create the checklist
  427. const checklistToCreate = {
  428. cardId: this.cards[checklist.cardId],
  429. title: checklist.title,
  430. createdAt: checklist.createdAt,
  431. sort: checklist.sort ? checklist.sort : checklistIndex,
  432. };
  433. const checklistId = Checklists.direct.insert(checklistToCreate);
  434. this.checklists[checklist._id] = checklistId;
  435. result.push(checklistId);
  436. });
  437. return result;
  438. }
  439. createChecklistItems(wekanChecklistItems) {
  440. wekanChecklistItems.forEach((checklistitem, checklistitemIndex) => {
  441. // Create the checklistItem
  442. const checklistItemTocreate = {
  443. title: checklistitem.title,
  444. checklistId: this.checklists[checklistitem.checklistId],
  445. cardId: this.cards[checklistitem.cardId],
  446. sort: checklistitem.sort ? checklistitem.sort : checklistitemIndex,
  447. isFinished: checklistitem.isFinished,
  448. };
  449. const checklistItemId = ChecklistItems.direct.insert(checklistItemTocreate);
  450. this.checklistItems[checklistitem._id] = checklistItemId;
  451. });
  452. }
  453. parseActivities(wekanBoard) {
  454. wekanBoard.activities.forEach((activity) => {
  455. switch (activity.activityType) {
  456. case 'addAttachment': {
  457. // We have to be cautious, because the attachment could have been removed later.
  458. // In that case Wekan still reports its addition, but removes its 'url' field.
  459. // So we test for that
  460. const wekanAttachment = wekanBoard.attachments.filter((attachment) => {
  461. return attachment._id === activity.attachmentId;
  462. })[0];
  463. if ( typeof wekanAttachment !== 'undefined' && wekanAttachment ) {
  464. if(wekanAttachment.url || wekanAttachment.file) {
  465. // we cannot actually create the Wekan attachment, because we don't yet
  466. // have the cards to attach it to, so we store it in the instance variable.
  467. const wekanCardId = activity.cardId;
  468. if(!this.attachments[wekanCardId]) {
  469. this.attachments[wekanCardId] = [];
  470. }
  471. this.attachments[wekanCardId].push(wekanAttachment);
  472. }
  473. }
  474. break;
  475. }
  476. case 'addComment': {
  477. const wekanComment = wekanBoard.comments.filter((comment) => {
  478. return comment._id === activity.commentId;
  479. })[0];
  480. const id = activity.cardId;
  481. if (!this.comments[id]) {
  482. this.comments[id] = [];
  483. }
  484. this.comments[id].push(wekanComment);
  485. break;
  486. }
  487. case 'createBoard': {
  488. this.createdAt.board = activity.createdAt;
  489. break;
  490. }
  491. case 'createCard': {
  492. const cardId = activity.cardId;
  493. this.createdAt.cards[cardId] = activity.createdAt;
  494. this.createdBy.cards[cardId] = activity.userId;
  495. break;
  496. }
  497. case 'createList': {
  498. const listId = activity.listId;
  499. this.createdAt.lists[listId] = activity.createdAt;
  500. break;
  501. }
  502. case 'createSwimlane': {
  503. const swimlaneId = activity.swimlaneId;
  504. this.createdAt.swimlanes[swimlaneId] = activity.createdAt;
  505. break;
  506. }}
  507. });
  508. }
  509. importActivities(activities, boardId) {
  510. activities.forEach((activity) => {
  511. switch (activity.activityType) {
  512. // Board related activities
  513. // TODO: addBoardMember, removeBoardMember
  514. case 'createBoard': {
  515. Activities.direct.insert({
  516. userId: this._user(activity.userId),
  517. type: 'board',
  518. activityTypeId: boardId,
  519. activityType: activity.activityType,
  520. boardId,
  521. createdAt: this._now(activity.createdAt),
  522. });
  523. break;
  524. }
  525. // List related activities
  526. // TODO: removeList, archivedList
  527. case 'createList': {
  528. Activities.direct.insert({
  529. userId: this._user(activity.userId),
  530. type: 'list',
  531. activityType: activity.activityType,
  532. listId: this.lists[activity.listId],
  533. boardId,
  534. createdAt: this._now(activity.createdAt),
  535. });
  536. break;
  537. }
  538. // Card related activities
  539. // TODO: archivedCard, restoredCard, joinMember, unjoinMember
  540. case 'createCard': {
  541. Activities.direct.insert({
  542. userId: this._user(activity.userId),
  543. activityType: activity.activityType,
  544. listId: this.lists[activity.listId],
  545. cardId: this.cards[activity.cardId],
  546. boardId,
  547. createdAt: this._now(activity.createdAt),
  548. });
  549. break;
  550. }
  551. case 'moveCard': {
  552. Activities.direct.insert({
  553. userId: this._user(activity.userId),
  554. oldListId: this.lists[activity.oldListId],
  555. activityType: activity.activityType,
  556. listId: this.lists[activity.listId],
  557. cardId: this.cards[activity.cardId],
  558. boardId,
  559. createdAt: this._now(activity.createdAt),
  560. });
  561. break;
  562. }
  563. // Comment related activities
  564. case 'addComment': {
  565. Activities.direct.insert({
  566. userId: this._user(activity.userId),
  567. activityType: activity.activityType,
  568. cardId: this.cards[activity.cardId],
  569. commentId: this.commentIds[activity.commentId],
  570. boardId,
  571. createdAt: this._now(activity.createdAt),
  572. });
  573. break;
  574. }
  575. // Attachment related activities
  576. case 'addAttachment': {
  577. Activities.direct.insert({
  578. userId: this._user(activity.userId),
  579. type: 'card',
  580. activityType: activity.activityType,
  581. attachmentId: this.attachmentIds[activity.attachmentId],
  582. cardId: this.cards[activity.cardId],
  583. boardId,
  584. createdAt: this._now(activity.createdAt),
  585. });
  586. break;
  587. }
  588. // Checklist related activities
  589. case 'addChecklist': {
  590. Activities.direct.insert({
  591. userId: this._user(activity.userId),
  592. activityType: activity.activityType,
  593. cardId: this.cards[activity.cardId],
  594. checklistId: this.checklists[activity.checklistId],
  595. boardId,
  596. createdAt: this._now(activity.createdAt),
  597. });
  598. break;
  599. }
  600. case 'addChecklistItem': {
  601. Activities.direct.insert({
  602. userId: this._user(activity.userId),
  603. activityType: activity.activityType,
  604. cardId: this.cards[activity.cardId],
  605. checklistId: this.checklists[activity.checklistId],
  606. checklistItemId: activity.checklistItemId.replace(
  607. activity.checklistId,
  608. this.checklists[activity.checklistId]),
  609. boardId,
  610. createdAt: this._now(activity.createdAt),
  611. });
  612. break;
  613. }}
  614. });
  615. }
  616. check(board) {
  617. try {
  618. // check(data, {
  619. // membersMapping: Match.Optional(Object),
  620. // });
  621. this.checkActivities(board.activities);
  622. this.checkBoard(board);
  623. this.checkLabels(board.labels);
  624. this.checkLists(board.lists);
  625. this.checkSwimlanes(board.swimlanes);
  626. this.checkCards(board.cards);
  627. this.checkChecklists(board.checklists);
  628. this.checkChecklistItems(board.checklistItems);
  629. } catch (e) {
  630. throw new Meteor.Error('error-json-schema');
  631. }
  632. }
  633. create(board, currentBoardId) {
  634. // TODO : Make isSandstorm variable global
  635. const isSandstorm = Meteor.settings && Meteor.settings.public &&
  636. Meteor.settings.public.sandstorm;
  637. if (isSandstorm && currentBoardId) {
  638. const currentBoard = Boards.findOne(currentBoardId);
  639. currentBoard.archive();
  640. }
  641. this.parseActivities(board);
  642. const boardId = this.createBoardAndLabels(board);
  643. this.createLists(board.lists, boardId);
  644. this.createSwimlanes(board.swimlanes, boardId);
  645. this.createCards(board.cards, boardId);
  646. this.createChecklists(board.checklists);
  647. this.createChecklistItems(board.checklistItems);
  648. this.importActivities(board.activities, boardId);
  649. // XXX add members
  650. return boardId;
  651. }
  652. }