import { serial, text, timestamp, pgTable } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import { z } from "zod";
export const users = pgTable("users", {
id: serial("id"),
name: text("name"),
email: text("email"),
password: text("password"),
role: text("role").$type<"admin" | "user">(),
createdAt: timestamp("created_at"),
updatedAt: timestamp("updated_at"),
});
export const insertUserSchema = createInsertSchema(users, {
role: z.enum(["admin", "user"])
});
//This is supposed to be what we get from the POST request, it omits ID and createdAt/updatedAt fields
export const apiInsertUserSchema = insertUserSchema.omit({ id: true, createdAt: true, updatedAt: true });
export const selectUserSchema = createSelectSchema(users);
import { serial, text, timestamp, pgTable } from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import { z } from "zod";
export const users = pgTable("users", {
id: serial("id"),
name: text("name"),
email: text("email"),
password: text("password"),
role: text("role").$type<"admin" | "user">(),
createdAt: timestamp("created_at"),
updatedAt: timestamp("updated_at"),
});
export const insertUserSchema = createInsertSchema(users, {
role: z.enum(["admin", "user"])
});
//This is supposed to be what we get from the POST request, it omits ID and createdAt/updatedAt fields
export const apiInsertUserSchema = insertUserSchema.omit({ id: true, createdAt: true, updatedAt: true });
export const selectUserSchema = createSelectSchema(users);