优化结构

This commit is contained in:
Yvan
2026-08-28 16:23:52 +08:00
parent 9b1daaf3f6
commit 295ee5c49e
24 changed files with 128 additions and 145 deletions
+6 -3
View File
@@ -9,17 +9,20 @@ agents must follow when changing the template.
cmd/ Entrypoint, Wire injector, main.go.
configs/ Runtime config (config.yaml). No secrets.
internal/config/ Viper config models, loading, snapshots, and reloads.
internal/server/ Gin/Kratos handlers, middleware, routers, static files.
internal/logging/ Structured logging sinks and source metadata.
internal/server/ Gin handlers, middleware, routers, static files.
internal/service/dto/ Hand-written request and response DTOs.
internal/service/ DTO/DO transport adapters.
internal/biz/ Domain models, usecases, repo interfaces, errors.
internal/data/ Repo implementations, database clients, migrations.
internal/initialize/ First-install and configuration orchestration.
internal/integration/ External I/O adapters (cache, email, payment, storage).
internal/paymentkit/ Shared payment normalization, signing, and JSON helpers.
internal/modules/ Built-in module schema, seed, menu, API, and task contributions.
internal/routecatalog/ HTTP route metadata and runtime policies.
internal/worker/ Timed-task runtime and scheduler.
internal/utils/ Stateless internal helpers.
docs/ Review notes and operational documentation.
pkg/ Reusable infrastructure packages.
web/ Vue administration frontend.
```
@@ -75,7 +78,7 @@ design rather than add the import.
- Owns the DO (`type <Resource> struct` — no proto, no storage tags),
the usecase, and the repo interface (`type <Resource>Repo interface`).
- Owns typed errors built with `errors.NotFound` / `errors.BadRequest`
plus the API error reason enum.
plus stable reason strings.
- Owns `ListOption` helpers — `ListFilter`, `ListOrderBy`, `ListOffset`,
`ListLimit` — so callers compose queries without leaking storage
primitives.
@@ -99,7 +102,7 @@ design rather than add the import.
**server**
- Construct HTTP/gRPC servers, apply middleware, register services. No
- Construct HTTP servers, apply middleware, register services. No
translation, no business logic.
### Add-a-resource checklist