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://dashboard.planpostai.com",
|
||||||
"https://dev.dashboard.planpostai.com",
|
"https://dev.dashboard.planpostai.com",
|
||||||
"https://canvas.planpostai.com",
|
"https://canvas.planpostai.com",
|
||||||
|
"https://canvasdev.planpostai.com",
|
||||||
],
|
],
|
||||||
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"],
|
methods: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"],
|
||||||
allowedHeaders: [
|
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", {
|
export const users = pgTable("users", {
|
||||||
id: text("user_id").primaryKey().notNull(),
|
id: text("user_id").primaryKey().notNull(),
|
||||||
email: text("email").notNull(),
|
email: text("email").notNull(),
|
||||||
lastName: text("last_name"),
|
lastName: text("last_name"),
|
||||||
firstName: text("first_name"),
|
firstName: text("first_name"),
|
||||||
image: text("image"),
|
image: text("image"),
|
||||||
paid_status: text("paid_status"),
|
paid_status: text("paid_status"),
|
||||||
expires_in: text("expires_in"),
|
expires_in: text("expires_in"),
|
||||||
refresh_token: text("refresh_token"),
|
refresh_token: text("refresh_token"),
|
||||||
download_limit: integer("download_limit").notNull().default(10),
|
download_limit: integer("download_limit").notNull().default(10),
|
||||||
downloads_today: jsonb("downloads_today").default({ date: null, count: 0 }),
|
downloads_today: jsonb("downloads_today").default({ date: null, count: 0 }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const projects = pgTable("projects", {
|
export const projects = pgTable("projects", {
|
||||||
id: uuid("project_id").defaultRandom().primaryKey(),
|
id: uuid("project_id").defaultRandom().primaryKey(),
|
||||||
userId: text("user_id").references(() => users.id),
|
userId: text("user_id").references(() => users.id),
|
||||||
object: json(),
|
object: json(),
|
||||||
name: text("name"),
|
name: text("name"),
|
||||||
description: text("description"),
|
description: text("description"),
|
||||||
is_public: boolean("is_active").notNull().default(false),
|
is_public: boolean("is_active").notNull().default(false),
|
||||||
preview_url: text("preview_url"),
|
preview_url: text("preview_url"),
|
||||||
created_at: timestamp("created_at").defaultNow(),
|
created_at: timestamp("created_at").defaultNow(),
|
||||||
updated_at: timestamp("updated_at").defaultNow(),
|
updated_at: timestamp("updated_at").defaultNow(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const uploads = pgTable("uploads", {
|
export const uploads = pgTable("uploads", {
|
||||||
id: uuid().defaultRandom().primaryKey(),
|
id: uuid().defaultRandom().primaryKey(),
|
||||||
filename: text("filename").notNull(),
|
filename: text("filename").notNull(),
|
||||||
url: text("url").notNull(),
|
url: text("url").notNull(),
|
||||||
projectId: uuid().references(() => projects.id),
|
projectId: uuid().references(() => projects.id),
|
||||||
created_at: timestamp("created_at").defaultNow(),
|
created_at: timestamp("created_at").defaultNow(),
|
||||||
updated_at: timestamp("updated_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