-
Notifications
You must be signed in to change notification settings - Fork 164
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
Adding metadata to application CRUD group #705
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
svix-gabriel
force-pushed
the
gabriel/add-metadata
branch
3 times, most recently
from
November 16, 2022 18:57
7393b91
to
558b2ab
Compare
svix-gabriel
force-pushed
the
gabriel/add-metadata
branch
from
November 16, 2022 19:15
558b2ab
to
150df64
Compare
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
tasn
reviewed
Nov 16, 2022
svix-gabriel
force-pushed
the
gabriel/add-metadata
branch
6 times, most recently
from
November 17, 2022 14:29
f836f4c
to
0678eff
Compare
tasn
reviewed
Nov 17, 2022
tasn
reviewed
Nov 17, 2022
tasn
reviewed
Nov 17, 2022
tasn
reviewed
Nov 17, 2022
tasn
reviewed
Nov 17, 2022
svix-gabriel
force-pushed
the
gabriel/add-metadata
branch
from
November 17, 2022 17:18
0678eff
to
bd571b0
Compare
tasn
approved these changes
Nov 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds the
metadata
field to the application CRUD group.Motivation
The
metadata
field is just a JSON dictionary with string only values. This field was added to our public API, but never to our open source solution. This PR corrects that.Solution
We add the field to our
/apps
CRUD group.Metadata
itself is a separate joined table, instead of a column on the apps field, because metadata can be quite large (up to 4096 bytes).Because it's a separate model, the sea_orm queries end up being pretty tedious. I tried to keep things efficient and query for both records in a single round trip where possible, but in some places we needed two roundtrips.
A side effect is that the endpoints were starting to get fairly complicated, so I tried to offload a lot of the logic to the relevant
db::models
where appropriate to offset this.Finally, the
metadata
field is entirely optional, but we default to rendering{}
if it's unspecified. Additionally, we don't create emptymetadata
records. It ended up being much simpler to just pass around anapplicationmetadata::[Model|ActiveModel]
around, and intelligently upsert only IFF the underlying data wasn't empty.