feat: comments
fix: use select instead of dropdown for filter on /market
This commit is contained in:
parent
800b5d1a09
commit
bd05b269fe
22 changed files with 2715 additions and 97 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { pgTable, text, timestamp, boolean, decimal, serial, varchar, integer, primaryKey, pgEnum } from "drizzle-orm/pg-core";
|
||||
import { pgTable, text, timestamp, boolean, decimal, serial, varchar, integer, primaryKey, pgEnum, index } from "drizzle-orm/pg-core";
|
||||
|
||||
export const transactionTypeEnum = pgEnum('transaction_type', ['BUY', 'SELL']);
|
||||
|
||||
|
|
@ -106,3 +106,29 @@ export const priceHistory = pgTable("price_history", {
|
|||
price: decimal("price", { precision: 20, scale: 8 }).notNull(),
|
||||
timestamp: timestamp("timestamp", { withTimezone: true }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
export const comment = pgTable("comment", {
|
||||
id: serial("id").primaryKey(),
|
||||
userId: integer("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
||||
coinId: integer("coin_id").notNull().references(() => coin.id, { onDelete: "cascade" }),
|
||||
content: varchar("content", { length: 500 }).notNull(),
|
||||
likesCount: integer("likes_count").notNull().default(0),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
isDeleted: boolean("is_deleted").default(false).notNull(),
|
||||
}, (table) => {
|
||||
return {
|
||||
userIdIdx: index("comment_user_id_idx").on(table.userId),
|
||||
coinIdIdx: index("comment_coin_id_idx").on(table.coinId),
|
||||
};
|
||||
});
|
||||
|
||||
export const commentLike = pgTable("comment_like", {
|
||||
userId: integer("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
||||
commentId: integer("comment_id").notNull().references(() => comment.id, { onDelete: "cascade" }),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (table) => {
|
||||
return {
|
||||
pk: primaryKey({ columns: [table.userId, table.commentId] }),
|
||||
};
|
||||
});
|
||||
|
|
|
|||
Reference in a new issue