Import a single Trello card (and its comments)
Brought to you by:
wekan
Originally created by: xavierpriour
This is step 1 of [#113]
We import a single card, with its title, description, comments, and labels.
Limitations (to be fixed in future PRs):
Originally posted by: xavierpriour
Oops forgot to eslint - will fix!
Originally posted by: xavierpriour
merged with core wekan/devel + fixed an eslint issue in one of the new files - now passing :)
Originally posted by: mquandalle
Hi Xavier,
Thank you for the PR! The code looks good to me. Apart from my tiny inline comments there is one bigger change I would like to consider with you before merging this PR. I don’t know how much you are familiar with Meteor, but basically there are two paths to mutate the database, one is using
Meteor.methodsthat are basically RPC (but with potential optimistic update on the client) and the other is using minimongo operations (like we everywhere in Wekan). The thing is that with minimongo.insertwe enforce some constants, for instance we ensure that thecreatedAtdate is correct (here) but in the case of the card import it is probably better to trust the data we are importing (or at least ensure a set of different rules that we would normally do). So I propose to do the import in a Meteor Method, because it makes it easy to chose which validation rule we want to enforce.Does that makes sense?
Originally posted by: xavierpriour
Perfect sense, and addresses some of my concerns mentioned in [#113]
What file should I put my method definition in, though?
Originally posted by: mquandalle
I guess
models/cards.js— but we’ll probably want to split this file later on.Originally posted by: xavierpriour
Well, I'm going to start work on importing boards next - so mind if I create a models/trello.js right now and put the method in it?
Originally posted by: mquandalle
Ok, but name if
import.jsbecause at some point we’ll be able to import data exported from Wekan as well :-)Originally posted by: xavierpriour
Sure!
Originally posted by: mquandalle
(Or even [#152] :-))
Originally posted by: xavierpriour
When generating activities for the card import itself, should it generate an 'importCard' only, or an 'importCard' + a 'createCard' (with same date)?
Originally posted by: mquandalle
I think only “importCard” will be less confusing.
Originally posted by: xavierpriour
@mquandalle it should be good now
Originally posted by: mquandalle
Tested and it works well! Thank you Xavier, I’m ready to merge. Maybe could you just
git rebase -i 21dcd16and squashes some of the commits (for instance “fix eslint style”) andgit push -fso we get a cleaner git history?Originally posted by: xavierpriour
ok, did some squashing.
Originally posted by: xavierpriour
ok, something seems wrong, rebase brought your commits in my PR... how do I get them out?
Originally posted by: mquandalle
Yep something went wrong, I'll fix and merge.
Originally posted by: mquandalle
Merged in b670a1ab36fcf514751e4b356487a96088dbbd24, thanks!
Ticket changed by: mquandalle