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

Add loadByIDNullableAsync loader method #28

Merged
merged 1 commit into from
Jun 2, 2020

Conversation

wschurman
Copy link
Member

Why

One common use case we're noticing is wanting to check if an ID corresponds to one table or another (only useful for UUID primary key tables).

Another use case is determining whether an ID that should exist truly does (loading permalink page). While this can be handled cleanly with a good error boundary, it still makes sense to have this API available when preferred.

Closes #12.

How

Add method, enforcing method, and tests. Also add test to ensure consistent API between loader and enforcing loader.

Test Plan

Run tests.

@wschurman wschurman requested review from ide and quinlanj June 1, 2020 16:45
@codecov
Copy link

codecov bot commented Jun 1, 2020

Codecov Report

Merging #28 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   88.48%   88.51%   +0.03%     
==========================================
  Files          63       63              
  Lines        1138     1141       +3     
  Branches       97       98       +1     
==========================================
+ Hits         1007     1010       +3     
  Misses         62       62              
  Partials       69       69              
Flag Coverage Δ
#integration 88.51% <100.00%> (+0.03%) ⬆️
#unittest 88.51% <100.00%> (+0.03%) ⬆️
Impacted Files Coverage Δ
packages/entity/src/EnforcingEntityLoader.ts 100.00% <100.00%> (ø)
packages/entity/src/EntityLoader.ts 85.41% <100.00%> (+0.31%) ⬆️
packages/entity/src/entityUtils.ts 86.48% <0.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 9129d74...9a7fa6a. Read the comment docs.

Copy link
Member

@quinlanj quinlanj left a comment

Choose a reason for hiding this comment

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

thanks!

@wschurman wschurman merged commit 9fb1923 into master Jun 2, 2020
@wschurman wschurman deleted the @wschurman/field-validation branch June 2, 2020 16:59
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.

Add nullable loadByID EntityLoader functionality
3 participants