-
Notifications
You must be signed in to change notification settings - Fork 0
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
Default Values #249
Labels
Comments
MrSwitch
added a commit
that referenced
this issue
Oct 17, 2022
MrSwitch
added a commit
that referenced
this issue
Oct 17, 2022
MrSwitch
added a commit
that referenced
this issue
Oct 17, 2022
MrSwitch
added a commit
that referenced
this issue
Oct 18, 2022
MrSwitch
added a commit
that referenced
this issue
Oct 18, 2022
MrSwitch
added a commit
that referenced
this issue
Oct 19, 2022
MrSwitch
added a commit
that referenced
this issue
Oct 19, 2022
…handler fix(defaultValue): defaultValue in validateInput handler, fixes #249
5app-Machine
added a commit
that referenced
this issue
Oct 19, 2022
## [0.68.1](v0.68.0...v0.68.1) (2022-10-19) ### Bug Fixes * **defaultValue:** defaultValue in validateInput handler, fixes [#249](#249) ([392ecc8](392ecc8))
🎉 This issue has been resolved in version 0.68.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A Default value would automatically add an insert value and filter condition when inserting and matching records respectively.
How this differs from SQL Schema Field Attributes
DEFAULT [value]
Defined on the dare model, rather than the DB Schema, so:
Example
e.g. Below the
active
status on a members model is used to enforce the condition on queriesThe condition would also be enforced on other operations
patch
:WHERE ... AND status = 'active'
del
:WHERE ... AND status = 'active'
Whilst POST operation automatically appends it to the insert
post
:INSERT (..., status) VALUES (...'active')
Overriding this behaviour per query
Simply set the value e.g.
TODO: should we permit a value of
undefined
to remove the condition altogether? e.g. (status: undefined
)Defining per method default rules
When it's not appropriate to have the rule applied to a particular method (or at all). It can be set using an object where the properties pertain to the name of the method.
For example: Where we want to restrict the
del
operation of a member record with a'disabled'
state.The above settings would result in the following rules being applied depending on the operation.
get
:WHERE ... AND status = 'active'
del
:WHERE ... AND status = 'disabled'
Whilst POST operation automatically appends it to the insert
post
:INSERT (..., status) VALUES (...'active')
Whilst PATCH operation would not be filtered at all
patch
:WHERE ...
// no condition added because it's not definedThe text was updated successfully, but these errors were encountered: