Replaces every em-dash and en-dash with regular ASCII hyphens across comments, JSX strings, and dev-facing logs. Mostly cosmetic but stops the inconsistent mix that crept in over the last few months (some files used em-dashes in comments, others didn't, some used both). Bundles two small dashboard-layout tweaks that touch a couple of already-modified files: - (dashboard)/layout.tsx main padding goes from p-6 to pt-3 px-6 pb-6 so page content sits closer to the topbar. - Sidebar now receives the ports list it needs for the footer port switcher. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
57 lines
2.2 KiB
TypeScript
57 lines
2.2 KiB
TypeScript
/**
|
|
* GDPR client-data export tracking.
|
|
*
|
|
* Each row is one export request. The actual bundle (a ZIP holding
|
|
* `client.json` + `client.html` and a copy of every attached file)
|
|
* lives in MinIO; we keep the storage key here plus the lifecycle
|
|
* markers needed for audit + the "download history" UI.
|
|
*/
|
|
|
|
import { pgTable, text, timestamp, integer, index } from 'drizzle-orm/pg-core';
|
|
|
|
import { ports } from './ports';
|
|
import { clients } from './clients';
|
|
import { user } from './users';
|
|
|
|
export const gdprExports = pgTable(
|
|
'gdpr_exports',
|
|
{
|
|
id: text('id')
|
|
.primaryKey()
|
|
.$defaultFn(() => crypto.randomUUID()),
|
|
portId: text('port_id')
|
|
.notNull()
|
|
.references(() => ports.id, { onDelete: 'cascade' }),
|
|
clientId: text('client_id')
|
|
.notNull()
|
|
.references(() => clients.id, { onDelete: 'cascade' }),
|
|
/** Staff member who requested the export. */
|
|
requestedBy: text('requested_by')
|
|
.notNull()
|
|
.references(() => user.id, { onDelete: 'restrict' }),
|
|
/** 'pending' | 'building' | 'ready' | 'sent' | 'failed' */
|
|
status: text('status').notNull().default('pending'),
|
|
/** MinIO path under the configured bucket - null until the worker uploads. */
|
|
storageKey: text('storage_key'),
|
|
sizeBytes: integer('size_bytes'),
|
|
/** When status='failed', the truncated error message. */
|
|
error: text('error'),
|
|
/** Email recipient if the bundle was emailed (typically the client's primary). */
|
|
sentTo: text('sent_to'),
|
|
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
|
readyAt: timestamp('ready_at', { withTimezone: true }),
|
|
sentAt: timestamp('sent_at', { withTimezone: true }),
|
|
/** Cleanup target - bundles are removed from MinIO after this. */
|
|
expiresAt: timestamp('expires_at', { withTimezone: true }),
|
|
},
|
|
(table) => [
|
|
index('idx_gdpr_exports_client').on(table.clientId),
|
|
index('idx_gdpr_exports_port_created').on(table.portId, table.createdAt),
|
|
],
|
|
);
|
|
|
|
export type GdprExport = typeof gdprExports.$inferSelect;
|
|
export type NewGdprExport = typeof gdprExports.$inferInsert;
|
|
|
|
export type GdprExportStatus = 'pending' | 'building' | 'ready' | 'sent' | 'failed';
|