docs: refine backend conventions and routing
Backend security / security (push) Successful in 8s
Backend verify / verify (push) Successful in 2m12s
Conventional commits / commits (pull_request) Successful in 25s
Backend security / security (pull_request) Successful in 7s
Backend verify / verify (pull_request) Successful in 2m3s
Backend security / security (push) Successful in 8s
Backend verify / verify (push) Successful in 2m12s
Conventional commits / commits (pull_request) Successful in 25s
Backend security / security (pull_request) Successful in 7s
Backend verify / verify (pull_request) Successful in 2m3s
This commit is contained in:
@@ -35,10 +35,9 @@ ValidationPipe уже настроен в `configureApp` (`transform`, `whitelis
|
||||
описывает те же required/optional/nullable/enum/range значения.
|
||||
|
||||
Используй типизированные response DTO, `ApiOkResponse`/другой фактический status
|
||||
и существующий `ApiProblemResponses`. При новых ошибках задай публичный stable
|
||||
`code`; сообщение внутреннего exception не является UI contract. Не возвращай
|
||||
raw upstream error, Prisma record с secrets или stack. Текущая форма ошибок
|
||||
описана у HTTP owner; не добавляй поля RFC только потому, что они встречаются в tutorial.
|
||||
и существующий `ApiProblemResponses`. Prisma model не является public contract:
|
||||
response выбирает поля явно. Stable codes, RFC 9457 профиль и mapping принадлежат
|
||||
[Errors](backend-error-handling.md).
|
||||
|
||||
**Безопасный путь:** используй exception и общий filter, а не локальный
|
||||
`res.status(...).json(...)`. Исключение — транспортная операция вроде cookie;
|
||||
@@ -46,6 +45,16 @@ raw upstream error, Prisma record с secrets или stack. Текущая фор
|
||||
|
||||
## Пример и проверка
|
||||
|
||||
Prefix `/api/v1` задаёт `configureApp`. Route/status/request/response/OpenAPI
|
||||
change — изменение публичного backend contract; несовместимое изменение требует
|
||||
согласованного перехода consumers, а не незаметной правки DTO. Новый API version
|
||||
не вводи для внутреннего refactor.
|
||||
|
||||
Pagination сохраняет contract endpoint: operations использует opaque cursor,
|
||||
limit и DTO bounds. Не заменяй cursor offset/page и не добавляй global pagination
|
||||
helper ради первого endpoint. Новая pagination явно определяет порядок,
|
||||
границу страницы и end-of-list; reused cursor не должен менять filters/owner.
|
||||
|
||||
[Operations controller](../../src/modules/investments/operations/presentation/brokerage-operations.controller.ts)
|
||||
показывает guard, user.sub, DTO query и service delegation.
|
||||
Для нового field обновляй canonical source и generated artifacts в определённом
|
||||
|
||||
Reference in New Issue
Block a user