Skip to content

Conversation

@WenInCode
Copy link
Contributor

What's in this PR?

  • Adds the task-list model
  • Updates project & task models
  • Updates related mirage config

References

Fixes #855

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far! 👍

@WenInCode
Copy link
Contributor Author

This is my first time working with mirage, so I mostly just based it off of the other models. Ready for code review though.

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some notes here. Can discuss further if needed.


export default Model.extend({
name: attr('string'),
position: attr('number'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just do attr() on both without arguments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to wait on naming convention until this settles in code-corps/code-corps-api#557

@green-arrow are discussing rank vs order.

One thing that is missing here, though, is the distinction, which will require some manual work in the mirage routes for the task. We'll need to make it so that position can be set on the model, but it's a virtual attribute on the server that then gets turned into rank or order, which is a completely different number.

This is a little odd but setting and getting are not the same thing, or even the same property.

insertedAt: attr('date'),
markdown: attr(),
number: attr('number'),
position: attr('number'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@WenInCode
Copy link
Contributor Author

@joshsmith updated, not sure if these were the changes you were looking for

Copy link
Contributor

@joshsmith joshsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple minor comments.

export default Factory.extend({
order() {
return (this.position || 0) * 3;
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would make this multiplier significantly larger, like 100.

number: attr('number'),
position: attr('number'),
order: attr(),
position: attr(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would set position below the others separately (see stripe-platform-card) and write that it is a virtual, write-only attribute. Would also document that order is read-only.

@joshsmith
Copy link
Contributor

@WenInCode LGTM!

@WenInCode
Copy link
Contributor Author

great - thanks @joshsmith

@WenInCode WenInCode merged commit 9b98633 into develop Dec 15, 2016
@WenInCode WenInCode deleted the add-task-list-model branch December 15, 2016 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants