Phase 1a: shared schemas, service layer, server tooling
- shared/schemas/: move Zod schemas out of routes so client + server share them - shared/types.ts: inferred types and enums for cross-package use - server tsconfig rootDir raised to ".." so shared/ compiles in-tree - server/src/services/: ticket, comment, cti, user, auth, notification (stub), search (stub) - Routes thinned to validate-delegate-return; business logic now testable in isolation - server/src/lib/httpError.ts: typed HttpError replaces ad-hoc throw shapes - server/src/lib/logger.ts: pino structured logging replaces console.log - autoClose job delegates to ticketService.closeStale() - express-rate-limit on /api/auth/login (10 / 15min / IP) - vitest + vitest-mock-extended; 20 service-level tests cover auth, ticket, comment, user flows - CI: lint + test jobs before docker builds Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
import type { Role, TicketStatus } from './schemas/enums';
|
||||
|
||||
export type { Role, TicketStatus };
|
||||
|
||||
export interface UserSummary {
|
||||
id: string;
|
||||
username: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export interface User extends UserSummary {
|
||||
email: string;
|
||||
role: Role;
|
||||
apiKey?: string | null;
|
||||
createdAt?: string;
|
||||
}
|
||||
|
||||
export interface Category {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CTIType {
|
||||
id: string;
|
||||
name: string;
|
||||
categoryId: string;
|
||||
category?: Category;
|
||||
}
|
||||
|
||||
export interface Item {
|
||||
id: string;
|
||||
name: string;
|
||||
typeId: string;
|
||||
type?: CTIType & { category?: Category };
|
||||
}
|
||||
|
||||
export interface Comment {
|
||||
id: string;
|
||||
body: string;
|
||||
ticketId: string;
|
||||
authorId: string;
|
||||
author: UserSummary;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface AuditLog {
|
||||
id: string;
|
||||
ticketId: string;
|
||||
userId: string;
|
||||
action: string;
|
||||
detail: string | null;
|
||||
createdAt: string;
|
||||
user: UserSummary;
|
||||
}
|
||||
|
||||
export interface Ticket {
|
||||
id: string;
|
||||
displayId: string;
|
||||
title: string;
|
||||
overview: string;
|
||||
severity: number;
|
||||
status: TicketStatus;
|
||||
categoryId: string;
|
||||
typeId: string;
|
||||
itemId: string;
|
||||
assigneeId: string | null;
|
||||
createdById: string;
|
||||
resolvedAt: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
category: Category;
|
||||
type: CTIType;
|
||||
item: Item;
|
||||
assignee: UserSummary | null;
|
||||
createdBy: UserSummary;
|
||||
comments?: Comment[];
|
||||
_count?: { comments: number };
|
||||
}
|
||||
Reference in New Issue
Block a user