22 lines
923 B
TypeScript
22 lines
923 B
TypeScript
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;
|