feat: add question bank schema
Made-with: Cursor
This commit is contained in:
21
src/db/schema/questionReports.ts
Normal file
21
src/db/schema/questionReports.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { pgTable, uuid, text, timestamp } from 'drizzle-orm/pg-core';
|
||||
import { reportStatusEnum } from './enums.js';
|
||||
import { questionBank } from './questionBank.js';
|
||||
import { users } from './users.js';
|
||||
|
||||
export const questionReports = pgTable('question_reports', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
questionBankId: uuid('question_bank_id')
|
||||
.notNull()
|
||||
.references(() => questionBank.id, { onDelete: 'cascade' }),
|
||||
userId: uuid('user_id')
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: 'cascade' }),
|
||||
reason: text('reason').notNull(),
|
||||
status: reportStatusEnum('status').notNull().default('open'),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
resolvedAt: timestamp('resolved_at', { withTimezone: true }),
|
||||
});
|
||||
|
||||
export type QuestionReport = typeof questionReports.$inferSelect;
|
||||
export type NewQuestionReport = typeof questionReports.$inferInsert;
|
||||
Reference in New Issue
Block a user