Sequence diagrams
Generated by antigravity
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -21,6 +21,7 @@ frontend/node_modules/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
.idea/
|
.idea/
|
||||||
|
.antigravitycli/
|
||||||
|
|
||||||
|
|
||||||
# Added by cargo
|
# Added by cargo
|
||||||
|
|||||||
100
README.md
100
README.md
@@ -44,7 +44,7 @@ The HTML code for the frontend can be generated by using `trunk build`. The resu
|
|||||||
> }
|
> }
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
## Diagramms
|
## Diagrams
|
||||||
### Class Diagramm
|
### Class Diagramm
|
||||||
```mermaid
|
```mermaid
|
||||||
classDiagram
|
classDiagram
|
||||||
@@ -283,15 +283,111 @@ classDiagram
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Sequence Diagrams
|
||||||
|
#### 1. System Initialization & Administrator Setup
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
autonumber
|
||||||
|
actor Admin as Initial Administrator
|
||||||
|
participant FE as Frontend (Yew)
|
||||||
|
participant BE as Backend (Axum)
|
||||||
|
database DB as Database (Postgres)
|
||||||
|
|
||||||
|
Note over Admin, DB: System Initialization Flow
|
||||||
|
FE->>BE: GET /api/check-admin
|
||||||
|
BE->>DB: SELECT COUNT(*) FROM users WHERE is_admin = true
|
||||||
|
DB-->>BE: 0 (No admin found)
|
||||||
|
BE-->>FE: HTTP 200 OK {"exists": false}
|
||||||
|
FE-->>Admin: Render Admin Setup Page
|
||||||
|
Admin->>FE: Input username, password, first/last name
|
||||||
|
FE->>BE: POST /api/setup-admin {username, pwd, ...}
|
||||||
|
Note over BE: Hash password using Argon2
|
||||||
|
BE->>DB: INSERT INTO users (username, pwd, is_admin, ...)
|
||||||
|
DB-->>BE: Success
|
||||||
|
BE-->>FE: HTTP 200 OK {"status": "success"}
|
||||||
|
FE-->>Admin: Redirect to Login Page
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. User Authentication Flow (Login)
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
autonumber
|
||||||
|
actor User as User / Admin
|
||||||
|
participant FE as Frontend (Yew)
|
||||||
|
participant BE as Backend (Axum)
|
||||||
|
database DB as Database (Postgres)
|
||||||
|
|
||||||
|
Note over User, DB: Authentication & Cookie Session Setup
|
||||||
|
User->>FE: Enter username & password
|
||||||
|
FE->>BE: POST /api/login {username, pwd}
|
||||||
|
BE->>DB: SELECT * FROM users WHERE username = $1
|
||||||
|
DB-->>BE: Return user record with password hash
|
||||||
|
Note over BE: Verify password using Argon2
|
||||||
|
alt Password Valid
|
||||||
|
Note over BE: Generate JWT token containing claims (sub: user_id)
|
||||||
|
Note over BE: Build HttpOnly, Secure, Lax cookie 'token'
|
||||||
|
BE-->>FE: HTTP 200 OK {"status": "success", "token": "...", "user": {...}}<br/>Header: Set-Cookie: token=...; Path=/; HttpOnly; SameSite=Lax
|
||||||
|
Note over FE: Save auth state to global context
|
||||||
|
FE-->>User: Redirect to Dashboard / Home
|
||||||
|
else Password Invalid
|
||||||
|
BE-->>FE: HTTP 400 Bad Request {"status": "error", "message": "Invalid password"}
|
||||||
|
FE-->>User: Display error message
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. Ticket Lifecycle Flow
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
sequenceDiagram
|
||||||
|
autonumber
|
||||||
|
actor User as Authenticated User
|
||||||
|
actor Admin as Administrator
|
||||||
|
participant FE as Frontend (Yew)
|
||||||
|
participant BE as Backend (Axum)
|
||||||
|
database DB as Database (Postgres)
|
||||||
|
|
||||||
|
Note over User, DB: Ticket Creation Flow (Protected Route)
|
||||||
|
User->>FE: Fill out ticket form & submit
|
||||||
|
FE->>BE: POST /api/tickets/create {category, betreff, description, room} (Includes 'token' cookie)
|
||||||
|
Note over BE: validate_token middleware decodes & verifies JWT
|
||||||
|
BE->>DB: INSERT INTO tickets (category, description, betreff, room, user_id)
|
||||||
|
DB-->>BE: Success
|
||||||
|
BE-->>FE: HTTP 200 OK {"status": "success"}
|
||||||
|
FE-->>User: Clear form & display success notification
|
||||||
|
|
||||||
|
Note over Admin, DB: Ticket Review & Resolution (Admin Only Route)
|
||||||
|
Admin->>FE: View Ticket Board
|
||||||
|
FE->>BE: GET /api/tickets (Includes 'token' cookie)
|
||||||
|
Note over BE: validate_token middleware checks JWT
|
||||||
|
BE->>DB: SELECT tickets JOIN users ...
|
||||||
|
DB-->>BE: Return list of tickets
|
||||||
|
BE-->>FE: HTTP 200 OK [tickets]
|
||||||
|
FE-->>Admin: Render Ticket List
|
||||||
|
|
||||||
|
Admin->>FE: Click "Resolve" on ticket
|
||||||
|
FE->>BE: PATCH /api/tickets/{id} {"status": "Resolved"} (Includes 'token' cookie)
|
||||||
|
Note over BE: validate_admin middleware verifies token & checks is_admin = true
|
||||||
|
BE->>DB: UPDATE tickets SET status = $1 WHERE id = $2
|
||||||
|
DB-->>BE: Success
|
||||||
|
BE-->>FE: HTTP 200 OK {"status": "success"}
|
||||||
|
FE-->>Admin: Update ticket status in UI
|
||||||
|
```
|
||||||
|
|
||||||
## Usage of AI
|
## Usage of AI
|
||||||
|
|
||||||
Github Copilot CLI was used with the model Claude Haiku 4.5 to generate most of the documentation:
|
Github Copilot CLI was used with the model Claude Haiku 4.5 to generate most of the documentation
|
||||||
|
|
||||||
|
Google Antigravity generated the Sequence Diagrams
|
||||||
|
|
||||||
### Prompt
|
### Prompt
|
||||||
Generate comments for cargo doc describing the indivilual components and create links to relevant structs, functions etc.
|
Generate comments for cargo doc describing the indivilual components and create links to relevant structs, functions etc.
|
||||||
|
|
||||||
|
Generate a sequence diagramm in @[README.md] behind the class diagramms
|
||||||
|
|
||||||
### Output
|
### Output
|
||||||
The comments with `///` or `//!`
|
The comments with `///` or `//!`
|
||||||
I've gone over most of it and modified it to my needs and opinions
|
I've gone over most of it and modified it to my needs and opinions
|
||||||
|
|
||||||
|
The sequence Diagrams above
|
||||||
|
|||||||
Reference in New Issue
Block a user