# graduation-team-2027/backend architecture

> Architecture diagram of the GitHub repository graduation-team-2027/backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/graduation-team-2027/backend
- Repository: https://github.com/graduation-team-2027/backend

## Overview

This repository provides a backend API for smoking-detection operations: staff authentication and administration, participant enrollment, camera/location management, and face-reference uploads. The runtime path is an API request routed to a controller, which uses the EF Core context to read or change SQL-backed records; face uploads also write image files to local storage. Startup configures the API and seeds demo records. The tree and excerpts show no detection/inference or review-result pipeline, so none is represented. Camera controller behavior is only partially evidenced by the source index.

Main entry points: [`AISmokingDetection/Data/AppDbContext.cs`](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Data/AppDbContext.cs) (EF context), [`AISmokingDetection/Program.cs`](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Program.cs) (API runtime), [`AISmokingDetection/Controllers/FaceReferenceController.cs`](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/FaceReferenceController.cs) (Face references), [`AISmokingDetection/Controllers/StaffController.cs`](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/StaffController.cs) (Staff accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api_runtime["API runtime<br/>[Program.cs]"]
  node_staff_api["Staff accounts<br/>[StaffController.cs]"]
  node_participant_api["Participants"]
  node_camera_api["Cameras"]
  node_face_api["Face references"]
end

subgraph group_domain["Operational records"]
  node_staff_model["Staff record<br/>[Staff.cs]"]
  node_participant_model["Participant record<br/>[Participant.cs]"]
  node_face_metadata["Face metadata"]
  node_camera_model["Camera record<br/>[Camera.cs]"]
  node_location_model["Location record<br/>[Location.cs]"]
end

subgraph group_persistence["Persistence"]
  node_db_context["EF context<br/>[AppDbContext.cs]"]
  node_seed_data["Demo seeding<br/>[DbInitializer.cs]"]
  node_sql_db[("SQL database")]
  node_face_files[("Local image files")]
end

node_staff_user(("Staff"))

node_staff_user -->|"sends requests"| node_api_runtime
node_api_runtime -->|"routes controllers"| node_staff_api
node_api_runtime -->|"routes controllers"| node_participant_api
node_api_runtime -->|"routes controllers"| node_camera_api
node_api_runtime -->|"routes controllers"| node_face_api
node_staff_api -->|"queries and saves"| node_db_context
node_participant_api -->|"queries and saves"| node_db_context
node_camera_api -->|"uses context"| node_db_context
node_face_api -->|"checks and saves metadata"| node_db_context
node_face_api -->|"writes images"| node_face_files
node_api_runtime -->|"registers context"| node_db_context
node_api_runtime -->|"runs seeding"| node_seed_data
node_api_runtime -->|"configures SQL Server"| node_sql_db
node_db_context -.->|"persists records"| node_sql_db
node_db_context -->|"maps records"| node_staff_model
node_db_context -->|"maps records"| node_participant_model
node_db_context -->|"maps records"| node_face_metadata
node_db_context -->|"maps records"| node_camera_model
node_db_context -->|"maps records"| node_location_model
node_seed_data -->|"seeds records"| node_db_context
node_face_metadata -->|"belongs to"| node_participant_model
node_camera_model -->|"belongs to"| node_location_model

click node_api_runtime "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Program.cs"
click node_staff_api "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/StaffController.cs"
click node_participant_api "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/ParticipantController.cs"
click node_camera_api "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/CameraController.cs"
click node_face_api "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/FaceReferenceController.cs"
click node_staff_model "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Staff.cs"
click node_participant_model "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Participant.cs"
click node_face_metadata "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/FaceReferenceMetadata.cs"
click node_camera_model "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Camera.cs"
click node_location_model "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Location.cs"
click node_db_context "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Data/AppDbContext.cs"
click node_seed_data "https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Data/DbInitializer.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api_runtime,node_staff_api,node_participant_api,node_camera_api,node_face_api toneBlue
class node_staff_model,node_participant_model,node_face_metadata,node_camera_model,node_location_model toneAmber
class node_db_context,node_seed_data,node_sql_db,node_face_files toneMint
class node_staff_user toneIndigo
```

## Components

### API and access

- [API runtime](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Program.cs): `AISmokingDetection/Program.cs`
- [Staff accounts](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/StaffController.cs): `AISmokingDetection/Controllers/StaffController.cs`
- [Participants](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/ParticipantController.cs): `AISmokingDetection/Controllers/ParticipantController.cs`
- [Cameras](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/CameraController.cs): `AISmokingDetection/Controllers/CameraController.cs`
- [Face references](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Controllers/FaceReferenceController.cs): `AISmokingDetection/Controllers/FaceReferenceController.cs`

### Operational records

- [Staff record](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Staff.cs): `AISmokingDetection/Entities/Staff.cs`
- [Participant record](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Participant.cs): `AISmokingDetection/Entities/Participant.cs`
- [Face metadata](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/FaceReferenceMetadata.cs): `AISmokingDetection/Entities/FaceReferenceMetadata.cs`
- [Camera record](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Camera.cs): `AISmokingDetection/Entities/Camera.cs`
- [Location record](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Entities/Location.cs): `AISmokingDetection/Entities/Location.cs`

### Persistence

- [EF context](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Data/AppDbContext.cs): `AISmokingDetection/Data/AppDbContext.cs`
- [Demo seeding](https://github.com/graduation-team-2027/backend/blob/master/AISmokingDetection/Data/DbInitializer.cs): `AISmokingDetection/Data/DbInitializer.cs`
- **SQL database**
- **Local image files**

### Other components

- **Staff**

## Connections

- Staff → API runtime: sends requests (evidence: `AISmokingDetection/Program.cs`)
- API runtime → Staff accounts: routes controllers (evidence: `AISmokingDetection/Program.cs`)
- API runtime → Participants: routes controllers (evidence: `AISmokingDetection/Program.cs`)
- API runtime → Cameras: routes controllers (evidence: `AISmokingDetection/Program.cs`)
- API runtime → Face references: routes controllers (evidence: `AISmokingDetection/Program.cs`)
- Staff accounts → EF context: queries and saves (evidence: `AISmokingDetection/Controllers/StaffController.cs`)
- Participants → EF context: queries and saves (evidence: `AISmokingDetection/Controllers/ParticipantController.cs`)
- Cameras → EF context: uses context (evidence: `AISmokingDetection/Controllers/CameraController.cs`)
- Face references → EF context: checks and saves metadata (evidence: `AISmokingDetection/Controllers/FaceReferenceController.cs`)
- Face references → Local image files: writes images (evidence: `AISmokingDetection/Controllers/FaceReferenceController.cs`)
- API runtime → EF context: registers context (evidence: `AISmokingDetection/Program.cs`)
- API runtime → Demo seeding: runs seeding (evidence: `AISmokingDetection/Program.cs`)
- API runtime → SQL database: configures SQL Server (evidence: `AISmokingDetection/Program.cs`)
- EF context → SQL database: persists records
- EF context → Staff record: maps records (evidence: `AISmokingDetection/Data/AppDbContext.cs`)
- EF context → Participant record: maps records (evidence: `AISmokingDetection/Data/AppDbContext.cs`)
- EF context → Face metadata: maps records (evidence: `AISmokingDetection/Data/AppDbContext.cs`)
- EF context → Camera record: maps records (evidence: `AISmokingDetection/Data/AppDbContext.cs`)
- EF context → Location record: maps records (evidence: `AISmokingDetection/Data/AppDbContext.cs`)
- Demo seeding → EF context: seeds records (evidence: `AISmokingDetection/Data/DbInitializer.cs`)
- Face metadata → Participant record: belongs to (evidence: `AISmokingDetection/Entities/FaceReferenceMetadata.cs`)
- Camera record → Location record: belongs to (evidence: `AISmokingDetection/Entities/Camera.cs`)
