119 lines
2.6 KiB
Markdown
119 lines
2.6 KiB
Markdown
# OAFlow — Fullstack Project
|
|
|
|
> 一款支持审批流、考勤管理、部门协作的企业办公自动化系统。
|
|
|
|
## Architecture
|
|
|
|
```
|
|
apps/
|
|
├── web/ # Next.js 15 + TypeScript + Tailwind CSS
|
|
└── api/ # Fastify 5 + TypeScript + SQLite (sql.js)
|
|
|
|
packages/
|
|
├── shared-types/ # @shared/types — shared TypeScript interfaces
|
|
└── shared-config/ # @shared/config — shared configuration
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Install all dependencies (root + workspaces)
|
|
npm install
|
|
|
|
# Start both frontend and backend in dev mode
|
|
npm run dev
|
|
|
|
# Or start individually
|
|
npm run dev:web # http://localhost:3000
|
|
npm run dev:api # http://localhost:3001
|
|
```
|
|
|
|
## Build
|
|
|
|
```bash
|
|
# Build everything
|
|
npm run build
|
|
|
|
# Or individually
|
|
npm run build:web
|
|
npm run build:api
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
# Run API tests
|
|
npm test
|
|
```
|
|
|
|
## API Endpoints
|
|
|
|
### Auth
|
|
- `POST /api/auth/register`
|
|
- `POST /api/auth/login`
|
|
- `GET /api/auth/me`
|
|
|
|
### Resources
|
|
#### users
|
|
- `GET /api/users` — List
|
|
- `GET /api/users/:id` — Get
|
|
- `POST /api/users` — Create
|
|
- `PUT /api/users/:id` — Update
|
|
- `DELETE /api/users/:id` — Delete
|
|
|
|
#### contracts
|
|
- `GET /api/contracts` — List
|
|
- `GET /api/contracts/:id` — Get
|
|
- `POST /api/contracts` — Create
|
|
- `PUT /api/contracts/:id` — Update
|
|
- `DELETE /api/contracts/:id` — Delete
|
|
|
|
#### approvals
|
|
- `GET /api/approvals` — List
|
|
- `GET /api/approvals/:id` — Get
|
|
- `POST /api/approvals` — Create
|
|
- `PUT /api/approvals/:id` — Update
|
|
- `DELETE /api/approvals/:id` — Delete
|
|
|
|
#### customers
|
|
- `GET /api/customers` — List
|
|
- `GET /api/customers/:id` — Get
|
|
- `POST /api/customers` — Create
|
|
- `PUT /api/customers/:id` — Update
|
|
- `DELETE /api/customers/:id` — Delete
|
|
|
|
#### reminders
|
|
- `GET /api/reminders` — List
|
|
- `GET /api/reminders/:id` — Get
|
|
- `POST /api/reminders` — Create
|
|
- `PUT /api/reminders/:id` — Update
|
|
- `DELETE /api/reminders/:id` — Delete
|
|
|
|
#### items
|
|
- `GET /api/items` — List
|
|
- `GET /api/items/:id` — Get
|
|
- `POST /api/items` — Create
|
|
- `PUT /api/items/:id` — Update
|
|
- `DELETE /api/items/:id` — Delete
|
|
|
|
#### clients
|
|
- `GET /api/clients` — List
|
|
- `GET /api/clients/:id` — Get
|
|
- `POST /api/clients` — Create
|
|
- `PUT /api/clients/:id` — Update
|
|
- `DELETE /api/clients/:id` — Delete
|
|
|
|
#### templates
|
|
- `GET /api/templates` — List
|
|
- `GET /api/templates/:id` — Get
|
|
- `POST /api/templates` — Create
|
|
- `PUT /api/templates/:id` — Update
|
|
- `DELETE /api/templates/:id` — Delete
|
|
|
|
### System
|
|
- `GET /api/health` — Health check
|
|
|
|
## Environment Variables
|
|
|
|
See `.env.example` for all available configuration.
|