feat:admin
This commit is contained in:
23
packages/db/src/schema/admin-requests.ts
Normal file
23
packages/db/src/schema/admin-requests.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
|
||||
export const adminRequest = sqliteTable(
|
||||
"admin_request",
|
||||
{
|
||||
id: text("id").primaryKey(),
|
||||
userId: text("user_id").notNull().unique(),
|
||||
status: text("status").default("pending").notNull(), // pending, approved, rejected
|
||||
requestedAt: integer("requested_at", { mode: "timestamp_ms" })
|
||||
.default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)
|
||||
.notNull(),
|
||||
reviewedAt: integer("reviewed_at", { mode: "timestamp_ms" }),
|
||||
reviewedBy: text("reviewed_by"),
|
||||
},
|
||||
(table) => [
|
||||
index("admin_request_userId_idx").on(table.userId),
|
||||
index("admin_request_status_idx").on(table.status),
|
||||
],
|
||||
);
|
||||
|
||||
export type AdminRequest = typeof adminRequest.$inferSelect;
|
||||
export type NewAdminRequest = typeof adminRequest.$inferInsert;
|
||||
@@ -9,6 +9,7 @@ export const user = sqliteTable("user", {
|
||||
.default(false)
|
||||
.notNull(),
|
||||
image: text("image"),
|
||||
role: text("role").default("user").notNull(),
|
||||
createdAt: integer("created_at", { mode: "timestamp_ms" })
|
||||
.default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)
|
||||
.notNull(),
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
export * from "./admin-requests";
|
||||
export * from "./auth";
|
||||
export * from "./registrations";
|
||||
|
||||
23
packages/db/src/schema/registrations.ts
Normal file
23
packages/db/src/schema/registrations.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { sql } from "drizzle-orm";
|
||||
import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
|
||||
export const registration = sqliteTable(
|
||||
"registration",
|
||||
{
|
||||
id: text("id").primaryKey(),
|
||||
firstName: text("first_name").notNull(),
|
||||
lastName: text("last_name").notNull(),
|
||||
email: text("email").notNull(),
|
||||
phone: text("phone"),
|
||||
artForm: text("art_form").notNull(),
|
||||
experience: text("experience"),
|
||||
createdAt: integer("created_at", { mode: "timestamp_ms" })
|
||||
.default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)
|
||||
.notNull(),
|
||||
},
|
||||
(table) => [
|
||||
index("registration_email_idx").on(table.email),
|
||||
index("registration_artForm_idx").on(table.artForm),
|
||||
index("registration_createdAt_idx").on(table.createdAt),
|
||||
],
|
||||
);
|
||||
Reference in New Issue
Block a user