Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read-only props #153

Open
1 of 3 tasks
isBatak opened this issue Jan 7, 2020 · 2 comments
Open
1 of 3 tasks

Read-only props #153

isBatak opened this issue Jan 7, 2020 · 2 comments
Assignees
Labels
Milestone

Comments

@isBatak
Copy link
Contributor

isBatak commented Jan 7, 2020

Submitting a:

  • Bug report
  • Feature suggestion
  • Support request

Props could be marked read-only, so they are never sent to the server on save.

@prop({ persist: false }) createdAt: string;
@prop({ persist: false }) updatedAt: string;
@DarkoKukovec
Copy link
Member

I agree this could be useful. The problem right now is that @prop is very tightly coupled with datx and therefore it's tricky to add some jsonapi specific things. In datx 2, the decorator will be more flexible, so it should be simpler to add this feature. Until then, you can override the toJsonApi method on the model and remove the properties from the payload.

@DarkoKukovec DarkoKukovec added this to the v2.0 milestone Jan 8, 2020
@DarkoKukovec DarkoKukovec self-assigned this Jan 8, 2020
@DarkoKukovec DarkoKukovec added has workaround A bug that has a known workaround jsonapi new feature labels Jan 8, 2020
@DarkoKukovec DarkoKukovec mentioned this issue Jan 8, 2020
18 tasks
@DarkoKukovec DarkoKukovec modified the milestones: v2.0, 2.x Jan 31, 2020
@DarkoKukovec
Copy link
Member

Until this is implemented, #154 can be used as a workaround:

@Attribute({ serialize: () => undefined })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants