Skip to content

Conversation

@jacobbullock
Copy link
Contributor

Fixes issue #155 by adding the meta data for a model accessible without any requirement of adding that meta data to the datastore.

@coveralls
Copy link

coveralls commented Jun 5, 2018

Coverage Status

Coverage increased (+0.02%) to 90.465% when pulling 84c9529 on jacobbullock:model-meta into a6507f9 on ghidoz:master.

constructor(private _datastore: JsonApiDatastore, data?: any) {
if (data) {
this.id = data.id;
this.meta = data.meta;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a getter would be a bit nicer solution.

get meta(): object {
  return this.data.meta;
}

It would be maybe even nicer to do the same for id property.

@jacobbullock What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@safo6m I think I agree with you on this, but currently the model object isn't persisting the entire data object. It just dumps the attributes into the object. Should we refactor the model object?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need for any refactoring (at least not regarding this topic).
Making data in the constructor private should be enough. Then you can access data as this.data.

...
 constructor(private _datastore: JsonApiDatastore, private data?: any) 
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yah, we can do it that way. Do you want me to update this PR to include that edit for id you mention above?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sure. Thanks.

@bekopharm
Copy link

I'd like to add a second thumbs up but since this is not possible I just add this lame comment :)

@jacobbullock
Copy link
Contributor Author

@safo6m do i need to write tests for this?

jatorresdev added a commit to jatorresdev/angular2-jsonapi that referenced this pull request Mar 14, 2019
@MarkCorneth
Copy link

What is still blocking this feature from getting into master?

@safo6m
Copy link
Collaborator

safo6m commented Jul 18, 2019

@jacobbullock can you please resolve the conflicts?

@jacobbullock
Copy link
Contributor Author

@safo6m Sorry,been distracted with other things. i'll get to it this weekend.

@lukasz-gawrys
Copy link

@jacobbullock Hi! Any chance that this is going to be merged?

@tegola
Copy link

tegola commented Mar 19, 2021

I second the request to get this merged.

@GertjanJ
Copy link

I'd also like this merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants