diff --git a/src/app.ts b/src/app.ts index ba18f0a..e29c80a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -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: [ diff --git a/src/db/schema.ts b/src/db/schema.ts index 5d76d61..55b1b20 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -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(), });