# whitecatblackhat/volunteer-hours-system architecture

> Architecture diagram of the GitHub repository whitecatblackhat/volunteer-hours-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/whitecatblackhat/volunteer-hours-system
- Repository: https://github.com/whitecatblackhat/volunteer-hours-system

## Overview

该项目是用于开发组任务登记及志愿时长统计分配的 Flask Web 应用。主要流程是管理员登录后管理任务和参与者；任务关联参与者与时长，首页汇总总时长，个人页展示任务明细。图中区分认证、业务路由、校验、数据模型与界面。关系依据已展示源码或 README；未采样的模板和其他前端文件仅按其目录及文档描述归纳。

Main entry points: [`app/auth/routes.py`](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/auth/routes.py) (登录与登出), [`app/routes.py`](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/routes.py) (业务路由), [`app/models.py`](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/models.py) (管理员与业务模型), [`app/__init__.py`](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/__init__.py) (应用工厂)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["认证与访问控制"]
  node_appfactory["应用工厂<br/>[__init__.py]"]
  node_extensions["Flask 扩展<br/>[extensions.py]"]
  node_loginform["登录表单<br/>[forms.py]"]
  node_authroutes["登录与登出<br/>[routes.py]"]
  node_access["写入访问闸门<br/>[__init__.py]"]
end

subgraph group_work["任务与参与者"]
  node_mainroutes["业务路由<br/>[routes.py]"]
  node_validation["输入校验<br/>[validate.py]"]
  node_hours["时长汇总<br/>[routes.py]"]
end

subgraph group_presentation["Web 界面"]
  node_taskui["任务界面"]
  node_taskclient["任务编辑客户端<br/>[task_edit.js]"]
  node_participantui["参与者界面"]
end

subgraph group_persistence["数据与模型"]
  node_models["管理员与业务模型<br/>[models.py]"]
  node_database[("SQLite 数据库")]
end

node_admin(("管理员"))
node_web(("Web 浏览器"))

node_admin -->|"使用"| node_web
node_web -->|"登录"| node_authroutes
node_authroutes -->|"校验表单"| node_loginform
node_authroutes -->|"查询管理员"| node_models
node_appfactory -->|"初始化扩展"| node_extensions
node_appfactory -->|"注册蓝图"| node_authroutes
node_appfactory -->|"注册蓝图"| node_mainroutes
node_web -->|"查看与管理"| node_taskui
node_taskui -->|"编辑任务"| node_taskclient
node_taskclient -->|"提交编辑"| node_mainroutes
node_web -->|"管理与查询"| node_participantui
node_mainroutes -->|"校验输入"| node_validation
node_mainroutes -->|"读写记录"| node_models
node_hours -->|"读取任务关系"| node_models
node_models -.->|"持久化"| node_database
node_access -->|"未登录时跳转"| node_authroutes
node_access -->|"限制写入"| node_web

click node_appfactory "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/__init__.py"
click node_extensions "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/extensions.py"
click node_loginform "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/auth/forms.py"
click node_authroutes "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/auth/routes.py"
click node_access "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/__init__.py"
click node_taskui "https://github.com/whitecatblackhat/volunteer-hours-system/tree/main/app/templates"
click node_taskclient "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/static/task_edit.js"
click node_participantui "https://github.com/whitecatblackhat/volunteer-hours-system/tree/main/app/templates"
click node_mainroutes "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/routes.py"
click node_validation "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/validate.py"
click node_hours "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/routes.py"
click node_models "https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/models.py"

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_appfactory,node_extensions,node_loginform,node_authroutes,node_access toneBlue
class node_mainroutes,node_validation,node_hours toneAmber
class node_taskui,node_taskclient,node_participantui toneMint
class node_models,node_database toneRose
class node_admin,node_web toneIndigo
```

## Components

### 认证与访问控制

- [应用工厂](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/__init__.py): `app/__init__.py`
- [Flask 扩展](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/extensions.py): `app/extensions.py`
- [登录表单](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/auth/forms.py): `app/auth/forms.py`
- [登录与登出](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/auth/routes.py): `app/auth/routes.py`
- [写入访问闸门](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/__init__.py): `app/__init__.py`

### 任务与参与者

- [业务路由](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/routes.py): `app/routes.py`
- [输入校验](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/validate.py): `app/validate.py`
- [时长汇总](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/routes.py): `app/routes.py`

### Web 界面

- [任务界面](https://github.com/whitecatblackhat/volunteer-hours-system/tree/main/app/templates): `app/templates`
- [任务编辑客户端](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/static/task_edit.js): `app/static/task_edit.js`
- [参与者界面](https://github.com/whitecatblackhat/volunteer-hours-system/tree/main/app/templates): `app/templates`

### 数据与模型

- [管理员与业务模型](https://github.com/whitecatblackhat/volunteer-hours-system/blob/main/app/models.py): `app/models.py`
- **SQLite 数据库**

### Other components

- **管理员**
- **Web 浏览器**

## Connections

- 管理员 → Web 浏览器: 使用 (evidence: `README.md`)
- Web 浏览器 → 登录与登出: 登录 (evidence: `README.md`)
- 登录与登出 → 登录表单: 校验表单 (evidence: `app/auth/routes.py`)
- 登录与登出 → 管理员与业务模型: 查询管理员 (evidence: `app/auth/routes.py`)
- 应用工厂 → Flask 扩展: 初始化扩展 (evidence: `app/__init__.py`)
- 应用工厂 → 登录与登出: 注册蓝图 (evidence: `app/__init__.py`)
- 应用工厂 → 业务路由: 注册蓝图 (evidence: `app/__init__.py`)
- Web 浏览器 → 任务界面: 查看与管理 (evidence: `README.md`)
- 任务界面 → 任务编辑客户端: 编辑任务 (evidence: `app/static/task_edit.js`)
- 任务编辑客户端 → 业务路由: 提交编辑 (evidence: `app/static/task_edit.js`)
- Web 浏览器 → 参与者界面: 管理与查询 (evidence: `README.md`)
- 业务路由 → 输入校验: 校验输入 (evidence: `app/routes.py`)
- 业务路由 → 管理员与业务模型: 读写记录 (evidence: `app/routes.py`)
- 时长汇总 → 管理员与业务模型: 读取任务关系 (evidence: `app/routes.py`)
- 管理员与业务模型 → SQLite 数据库: 持久化
- 写入访问闸门 → 登录与登出: 未登录时跳转 (evidence: `app/__init__.py`)
- 写入访问闸门 → Web 浏览器: 限制写入 (evidence: `app/__init__.py`)
