From 93a51a376c7152e6bb963b0196cfd3bd371b63c0 Mon Sep 17 00:00:00 2001 From: Rogee Date: Mon, 29 Dec 2025 10:25:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(llm):=20=E6=9B=B4=E6=96=B0=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E8=A7=84=E5=88=99=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=85=B3?= =?UTF-8?q?=E4=BA=8EDTO=E5=92=8C=E5=88=86=E9=A1=B5=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E7=9A=84JSON=E6=A0=87=E7=AD=BE=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/llm.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/llm.txt b/backend/llm.txt index e32139a..550461a 100644 --- a/backend/llm.txt +++ b/backend/llm.txt @@ -8,6 +8,9 @@ This file condenses `backend/docs/dev/http_api.md` + `backend/docs/dev/model.md` - DO follow existing module layout under `backend/app/http//`. - MUST: HTTP module folder name MUST be `snake_case` (e.g. `tenant_public`), not `camelCase`/`mixedCase`. +- MUST: JSON tags in DTOs and all response/request structs MUST use `snake_case` (e.g., `json:"user_id"`), never `camelCase` (e.g., `json:"userId"`). +- MUST: Paginated list endpoints MUST return `*requests.Pager` and use the shared `requests.Pagination` types defined in `backend/app/requests/pagination.go`; DO NOT redefine pagination or pager structs in local DTOs. +- MUST: The JSON response for paginated data MUST follow the `requests.Pager` layout: `{ "page": 1, "limit": 10, "total": 100, "items": [...] }`. - DO keep controller methods thin: parse/bind → call `services.*` → return result/error. - DO regenerate code after changes (routes/docs/models). - MUST: in `backend/app/services`, prefer the generated GORM-Gen DAO (`backend/database/models/*`) for DB access; treat raw `*gorm.DB` usage as a last resort. @@ -64,7 +67,7 @@ Place above the handler function: Common `@Success` patterns: -- Paginated list: `requests.Pager{items=dto.Item}` +- Paginated list: `requests.Pager{items=[]dto.Item}` - Single object: `dto.Item` - Array: `{array} dto.Item` @@ -205,7 +208,7 @@ In this case: ### Job(一次性任务) - `Kind() string`:任务类型标识(job kind);改名会导致“新旧任务类型不一致”。 -- `InsertOpts() river.InsertOpts`:默认入队参数(队列、优先级、最大重试、唯一任务策略等)。 +- `InsertOpts() river.InsertOpts` : 默认入队参数(队列、优先级、最大重试、唯一任务策略等)。 - `UniqueID() string`(项目约定):周期任务 handle 的稳定 key;通常 `return Kind()`。 ### Worker(执行器) @@ -456,4 +459,4 @@ func (s *XxxTestSuite) Test_Method() { So(got, ShouldBeNil) }) } -``` +``` \ No newline at end of file