- Add Tailwind CSS for styling and custom theme variables. - Create HTML structure for the dashboard with dark mode support. - Implement database schema for bug reports and associated files using Drizzle ORM. - Set up database connection with MySQL and environment variables. - Create utility functions for class names, byte formatting, and date formatting. - Develop error handling page for the dashboard. - Implement layout and routing for the dashboard, including pagination and filtering for bug reports. - Create API endpoints for downloading reports and files. - Add functionality for viewing, updating, and deleting bug reports. - Set up Docker configuration for the dashboard service. - Include TypeScript configuration and Vite setup for the project.
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import {
|
|
mysqlTable,
|
|
int,
|
|
varchar,
|
|
text,
|
|
json,
|
|
mysqlEnum,
|
|
timestamp,
|
|
customType
|
|
} from 'drizzle-orm/mysql-core';
|
|
|
|
const longblob = customType<{ data: Buffer }>({
|
|
dataType() {
|
|
return 'longblob';
|
|
}
|
|
});
|
|
|
|
export const bugReports = mysqlTable('bug_reports', {
|
|
id: int('id').autoincrement().primaryKey(),
|
|
name: varchar('name', { length: 255 }).notNull(),
|
|
email: varchar('email', { length: 255 }).notNull(),
|
|
description: text('description').notNull(),
|
|
hwid: varchar('hwid', { length: 255 }).notNull().default(''),
|
|
hostname: varchar('hostname', { length: 255 }).notNull().default(''),
|
|
os_user: varchar('os_user', { length: 255 }).notNull().default(''),
|
|
submitter_ip: varchar('submitter_ip', { length: 45 }).notNull().default(''),
|
|
system_info: json('system_info'),
|
|
status: mysqlEnum('status', ['new', 'in_review', 'resolved', 'closed']).notNull().default('new'),
|
|
created_at: timestamp('created_at').notNull().defaultNow(),
|
|
updated_at: timestamp('updated_at').notNull().defaultNow().onUpdateNow()
|
|
});
|
|
|
|
export const bugReportFiles = mysqlTable('bug_report_files', {
|
|
id: int('id').autoincrement().primaryKey(),
|
|
report_id: int('report_id')
|
|
.notNull()
|
|
.references(() => bugReports.id, { onDelete: 'cascade' }),
|
|
file_role: mysqlEnum('file_role', [
|
|
'screenshot',
|
|
'mail_file',
|
|
'localstorage',
|
|
'config',
|
|
'system_info'
|
|
]).notNull(),
|
|
filename: varchar('filename', { length: 255 }).notNull(),
|
|
mime_type: varchar('mime_type', { length: 127 }).notNull().default('application/octet-stream'),
|
|
file_size: int('file_size').notNull().default(0),
|
|
data: longblob('data').notNull(),
|
|
created_at: timestamp('created_at').notNull().defaultNow()
|
|
});
|
|
|
|
export type BugReport = typeof bugReports.$inferSelect;
|
|
export type BugReportFile = typeof bugReportFiles.$inferSelect;
|
|
export type BugReportStatus = BugReport['status'];
|