Adds unit 1 functional design and answered nfr requirements questions and plan
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
# 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.
|
||||
|
||||
```ts
|
||||
// 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), never `naam`.
|
||||
- `accessToken` lives only in memory (AuthContext), not persisted.
|
||||
- `ProblemDetails` maps 1:1 to backend RFC 9457 responses and includes `traceId` as an extension.
|
||||
Reference in New Issue
Block a user