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

feat: add config option persistOptions to handle relation data #121

Merged
merged 1 commit into from
May 5, 2020

Conversation

cuebit
Copy link
Member

@cuebit cuebit commented May 5, 2020

Resolves #120

Type of PR:

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Documentation
  • Other, please describe:

Breaking changes:

  • No
  • Yes

Details

This PR adds a new configuration option persistOptions to constrain relation persistence. It's a by-product of #119 and works seamlessly with, but not limited to, the persistBy option.

The option simply attaches the existing Vuex ORM persist options:

User.api().get('/api/users', {
  persistOptions: {
    insert: ['posts']
  }
})

And compliments the persistBy option when used in combination:

User.api().get('/api/users', {
  persistBy: 'create',
  persistOptions: {
    insert: ['posts'],
    insertOrUpdate: ['roles']
  }
})

See also: Vuex ORM – Insert Method for Relationships

@codecov
Copy link

codecov bot commented May 5, 2020

Codecov Report

Merging #121 into dev will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               dev      #121   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines           91        92    +1     
  Branches        13        14    +1     
=========================================
+ Hits            91        92    +1     
Impacted Files Coverage Δ
src/api/Request.ts 100.00% <ø> (ø)
src/api/Response.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 253285a...b149c9f. Read the comment docs.

@cuebit cuebit merged commit 4345c98 into dev May 5, 2020
@cuebit cuebit changed the title feat(response): add config option persistOptions to handle relation data feat: add config option persistOptions to handle relation data May 5, 2020
@cuebit cuebit self-assigned this May 5, 2020
@cuebit cuebit added the enhancement New feature or request label May 5, 2020
@cuebit cuebit deleted the feature-persist-options branch May 7, 2020 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant