refactor(dbscheme): refactoring from opening and saving
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import {text, pgTable, numeric, index, timestamp, boolean, uuid, uniqueIndex} from "drizzle-orm/pg-core";
|
||||
import {createInsertSchema, createSelectSchema} from "drizzle-zod";
|
||||
import {z} from "zod";
|
||||
import {
|
||||
text,
|
||||
pgTable,
|
||||
numeric,
|
||||
index,
|
||||
timestamp,
|
||||
boolean,
|
||||
uuid,
|
||||
uniqueIndex,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
|
||||
export const users = pgTable(
|
||||
"users",
|
||||
@@ -27,10 +36,10 @@ export const users = pgTable(
|
||||
);
|
||||
|
||||
// Schema for inserting a user - can be used to validate API requests
|
||||
export const insertUsersSchema = createInsertSchema(users, {
|
||||
username: z.string().min(3, {message: "Username must be at least 3 characters"}),
|
||||
email: z.string().email({message: "Invalid email"}),
|
||||
password: z.string().min(8, {message: "Password must be at least 8 characters"}),
|
||||
});
|
||||
// export const insertUsersSchema = createInsertSchema(users, {
|
||||
// username: z.string().min(3, {message: "Username must be at least 3 characters"}),
|
||||
// email: z.string().email({message: "Invalid email"}),
|
||||
// password: z.string().min(8, {message: "Password must be at least 8 characters"}),
|
||||
// });
|
||||
// Schema for selecting a Expenses - can be used to validate API responses
|
||||
export const selectUsersSchema = createSelectSchema(users);
|
||||
|
||||
Reference in New Issue
Block a user