-
-
Notifications
You must be signed in to change notification settings - Fork 688
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 createUpdateSchema
to drizzle-zod
#503
Comments
I think the current |
+1 |
Some sort of selection criteria (typically a key, like ID) seems like it would have to be mandatory for update, but should generally not be present for insert. Here's an example of approximately what I've landed on for CRUD, but you can imagine why you might want to separate that need and use the selection schema for an update criteria. const apiMutateUser = createInsertSchema(users, refine).omit({
created_at: true,
updated_at: true,
});
export const apiInsertUser = apiMutateUser.omit({ id: true });
export const apiUpdateUser = apiMutateUser.partial().required({ id: true });
export const apiDeleteUser = apiMutateUser.pick({ id: true });
export const apiSelectUser = createSelectSchema(users, refine)
.pick(selectableFields)
.partial(); |
This one was fixed in the latest for all validator packages |
No description provided.
The text was updated successfully, but these errors were encountered: