1.4 KiB
1.4 KiB
Domain Entities — Unit 1: Project Scaffold & Infrastructure
TypeScript interfaces to be used in the frontend scaffold. Indentation shown with 4 spaces to match ESLint/Prettier baseline.
// src/api/types.ts
// Roles aligned with backend authorization
export type UserRole = 'Owner' | 'Administrator' | 'User';
export interface User {
id: string; // UUID
email: string;
name: string;
role: UserRole;
isActive: boolean;
}
export interface AuthResponse {
accessToken: string; // JWT access token
expiresAt: string; // ISO timestamp
user: User;
}
// RFC 9457 ProblemDetails for standardized error handling
export interface ProblemDetails {
type?: string;
title?: string;
status?: number;
detail?: string;
instance?: string;
[extension: string]: unknown; // includes traceId
}
// Convenience wrapper for API results (optional usage)
export type ApiResult<T> = {
ok: true;
data: T;
} | {
ok: false;
error: ProblemDetails;
};
// Setup status (used by guards during bootstrap)
export interface SetupStatus {
initialized: boolean;
}
Notes:
- Names align with backend payloads: property is
name(English), nevernaam. accessTokenlives only in memory (AuthContext), not persisted.ProblemDetailsmaps 1:1 to backend RFC 9457 responses and includestraceIdas an extension.