added schema
This commit is contained in:
parent
38b514f3a9
commit
f3416f86f6
2 changed files with 51 additions and 26 deletions
|
|
@ -13,6 +13,7 @@ const app = new Elysia()
|
|||
"https://dashboard.planpostai.com",
|
||||
"https://dev.dashboard.planpostai.com",
|
||||
"https://canvas.planpostai.com",
|
||||
"https://canvasdev.planpostai.com",
|
||||
],
|
||||
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"],
|
||||
allowedHeaders: [
|
||||
|
|
|
|||
|
|
@ -1,35 +1,59 @@
|
|||
import { boolean, integer, json, pgTable, text, timestamp, uuid, jsonb } from "drizzle-orm/pg-core";
|
||||
import {
|
||||
boolean,
|
||||
integer,
|
||||
json,
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
uuid,
|
||||
jsonb,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: text("user_id").primaryKey().notNull(),
|
||||
email: text("email").notNull(),
|
||||
lastName: text("last_name"),
|
||||
firstName: text("first_name"),
|
||||
image: text("image"),
|
||||
paid_status: text("paid_status"),
|
||||
expires_in: text("expires_in"),
|
||||
refresh_token: text("refresh_token"),
|
||||
download_limit: integer("download_limit").notNull().default(10),
|
||||
downloads_today: jsonb("downloads_today").default({ date: null, count: 0 }),
|
||||
id: text("user_id").primaryKey().notNull(),
|
||||
email: text("email").notNull(),
|
||||
lastName: text("last_name"),
|
||||
firstName: text("first_name"),
|
||||
image: text("image"),
|
||||
paid_status: text("paid_status"),
|
||||
expires_in: text("expires_in"),
|
||||
refresh_token: text("refresh_token"),
|
||||
download_limit: integer("download_limit").notNull().default(10),
|
||||
downloads_today: jsonb("downloads_today").default({ date: null, count: 0 }),
|
||||
});
|
||||
|
||||
export const projects = pgTable("projects", {
|
||||
id: uuid("project_id").defaultRandom().primaryKey(),
|
||||
userId: text("user_id").references(() => users.id),
|
||||
object: json(),
|
||||
name: text("name"),
|
||||
description: text("description"),
|
||||
is_public: boolean("is_active").notNull().default(false),
|
||||
preview_url: text("preview_url"),
|
||||
created_at: timestamp("created_at").defaultNow(),
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
id: uuid("project_id").defaultRandom().primaryKey(),
|
||||
userId: text("user_id").references(() => users.id),
|
||||
object: json(),
|
||||
name: text("name"),
|
||||
description: text("description"),
|
||||
is_public: boolean("is_active").notNull().default(false),
|
||||
preview_url: text("preview_url"),
|
||||
created_at: timestamp("created_at").defaultNow(),
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const uploads = pgTable("uploads", {
|
||||
id: uuid().defaultRandom().primaryKey(),
|
||||
filename: text("filename").notNull(),
|
||||
url: text("url").notNull(),
|
||||
projectId: uuid().references(() => projects.id),
|
||||
created_at: timestamp("created_at").defaultNow(),
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
id: uuid().defaultRandom().primaryKey(),
|
||||
filename: text("filename").notNull(),
|
||||
url: text("url").notNull(),
|
||||
projectId: uuid().references(() => projects.id),
|
||||
created_at: timestamp("created_at").defaultNow(),
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const shapes = pgTable("shapes", {
|
||||
id: uuid("shape_id").defaultRandom().primaryKey(),
|
||||
shapes: text("shapes").notNull(),
|
||||
created_at: timestamp("created_at").defaultNow(),
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
||||
export const category = pgTable("project_category", {
|
||||
id: uuid("category_id").defaultRandom().primaryKey(),
|
||||
user_id: uuid().references(() => users.id),
|
||||
category: text("category").notNull(),
|
||||
created_at: timestamp("created_at").defaultNow(),
|
||||
updated_at: timestamp("updated_at").defaultNow(),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue