Adds profile and settings pages
This commit is contained in:
+105
@@ -0,0 +1,105 @@
|
||||
# Domain Entities — Unit 6: Profile, Settings & CMS Placeholder
|
||||
|
||||
## Overview
|
||||
|
||||
Unit 6 introduces profile editing and password management. It reuses the existing `AvailabilityStatus` entity from Unit 4 for the Settings page, and introduces new request/response shapes for profile and password operations.
|
||||
|
||||
---
|
||||
|
||||
## Entity Diagram
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
AuthUser["AuthUser"]
|
||||
UpdateProfileRequest["UpdateProfileRequest"]
|
||||
UpdateProfileResponse["UpdateProfileResponse"]
|
||||
ChangePasswordRequest["ChangePasswordRequest"]
|
||||
AvailabilityStatus["AvailabilityStatus"]
|
||||
UpdateAvailabilityRequest["UpdateAvailabilityRequest"]
|
||||
|
||||
AuthUser -->|"provides data for"| UpdateProfileRequest
|
||||
UpdateProfileRequest -->|"produces"| UpdateProfileResponse
|
||||
UpdateProfileResponse -->|"refreshed into"| AuthUser
|
||||
AvailabilityStatus -->|"changed by"| UpdateAvailabilityRequest
|
||||
|
||||
classDef user fill:#2196F3,stroke:#0d47a1,color:#000
|
||||
classDef request fill:#FF9800,stroke:#e65100,color:#000
|
||||
classDef response fill:#4CAF50,stroke:#2e7d32,color:#000
|
||||
classDef availability fill:#9C27B0,stroke:#4a148c,color:#000
|
||||
|
||||
class AuthUser user
|
||||
class UpdateProfileRequest,ChangePasswordRequest,UpdateAvailabilityRequest request
|
||||
class UpdateProfileResponse response
|
||||
class AvailabilityStatus availability
|
||||
```
|
||||
|
||||
Text alternative: AuthUser provides data for UpdateProfileRequest; saving produces UpdateProfileResponse which refreshes AuthContext. AvailabilityStatus is changed via UpdateAvailabilityRequest. ChangePasswordRequest is standalone.
|
||||
|
||||
---
|
||||
|
||||
## Entity Descriptions
|
||||
|
||||
### AuthUser
|
||||
Represents the currently logged-in user. Sourced from `AuthContext` (populated at login and after token refresh). Displayed on ProfilePage; updated indirectly via token refresh after a profile save.
|
||||
|
||||
| Field | Type | Editable | Source |
|
||||
|-------|------|----------|--------|
|
||||
| id | string (GUID) | No | AuthContext |
|
||||
| email | string | Yes (via PUT /Users/me) | AuthContext |
|
||||
| name | string | Yes (via PUT /Users/me) | AuthContext |
|
||||
| role | string | No (read-only) | AuthContext |
|
||||
| isActive | boolean | No | AuthContext |
|
||||
|
||||
---
|
||||
|
||||
### UpdateProfileRequest
|
||||
Sent to `PUT /api/v1/Users/me` when the user saves their profile edits.
|
||||
|
||||
| Field | Type | Required | Validation |
|
||||
|-------|------|----------|------------|
|
||||
| name | string | Yes | Non-empty, max 100 chars |
|
||||
| email | string | Yes | Valid email format |
|
||||
|
||||
---
|
||||
|
||||
### UpdateProfileResponse
|
||||
Response from `PUT /api/v1/Users/me`. Contains the updated user data. After receiving this, the frontend calls `POST /api/v1/Auth/refresh` to sync AuthContext with the new values.
|
||||
|
||||
| Field | Type | Notes |
|
||||
|-------|------|-------|
|
||||
| id | string | GUID |
|
||||
| email | string | Updated value |
|
||||
| name | string | Updated value |
|
||||
| role | string | Unchanged |
|
||||
| isActive | boolean | Unchanged |
|
||||
|
||||
---
|
||||
|
||||
### ChangePasswordRequest
|
||||
Sent to `POST /api/v1/Auth/change-password`. Requires current password for verification.
|
||||
|
||||
| Field | Type | Required | Validation |
|
||||
|-------|------|----------|------------|
|
||||
| currentPassword | string | Yes | Must match current stored password |
|
||||
| newPassword | string | Yes | Must satisfy backend password policy (≥8 chars, upper, lower, digit, special char) |
|
||||
|
||||
---
|
||||
|
||||
### AvailabilityStatus (reused from Unit 4)
|
||||
Retrieved via `GET /api/v1/Availability/status`. Displayed on SettingsPage with controls to change it.
|
||||
|
||||
| Field | Type | Notes |
|
||||
|-------|------|-------|
|
||||
| status | string | "Available" \| "Maintenance" \| "Unavailable" |
|
||||
| message | string | Optional custom message |
|
||||
| checkedAt | datetime | Timestamp of last check |
|
||||
|
||||
---
|
||||
|
||||
### UpdateAvailabilityRequest
|
||||
Sent to `POST /api/v1/Availability/admin/status` (OwnerOnly policy — already exists in backend).
|
||||
|
||||
| Field | Type | Required | Allowed values |
|
||||
|-------|------|----------|----------------|
|
||||
| newStatus | string | Yes | "Available" \| "Maintenance" \| "Unavailable" |
|
||||
| reason | string | No | Free-form message shown to users |
|
||||
Reference in New Issue
Block a user