@onion-ai/cli 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +529 -0
- package/bin/onion.js +6 -0
- package/framework/CLAUDE.md +45 -0
- package/framework/VERSION +1 -0
- package/framework/agents/compliance/iso-22301-specialist.md +985 -0
- package/framework/agents/compliance/iso-27001-specialist.md +713 -0
- package/framework/agents/compliance/pmbok-specialist.md +739 -0
- package/framework/agents/compliance/security-information-master.md +907 -0
- package/framework/agents/compliance/soc2-specialist.md +889 -0
- package/framework/agents/deployment/docker-specialist.md +1192 -0
- package/framework/agents/development/c4-architecture-specialist.md +745 -0
- package/framework/agents/development/c4-documentation-specialist.md +695 -0
- package/framework/agents/development/clickup-specialist.md +396 -0
- package/framework/agents/development/cursor-specialist.md +277 -0
- package/framework/agents/development/docs-reverse-engineer.md +417 -0
- package/framework/agents/development/gamma-api-specialist.md +1168 -0
- package/framework/agents/development/gitflow-specialist.md +1206 -0
- package/framework/agents/development/linux-security-specialist.md +675 -0
- package/framework/agents/development/mermaid-specialist.md +515 -0
- package/framework/agents/development/nodejs-specialist.md +672 -0
- package/framework/agents/development/nx-migration-specialist.md +866 -0
- package/framework/agents/development/nx-monorepo-specialist.md +618 -0
- package/framework/agents/development/postgres-specialist.md +1123 -0
- package/framework/agents/development/react-developer.md +131 -0
- package/framework/agents/development/runflow-specialist.md +277 -0
- package/framework/agents/development/system-documentation-orchestrator.md +1387 -0
- package/framework/agents/development/task-specialist.md +677 -0
- package/framework/agents/git/branch-code-reviewer.md +225 -0
- package/framework/agents/git/branch-documentation-writer.md +161 -0
- package/framework/agents/git/branch-metaspec-checker.md +67 -0
- package/framework/agents/git/branch-test-planner.md +176 -0
- package/framework/agents/meta/agent-creator-specialist.md +1266 -0
- package/framework/agents/meta/command-creator-specialist.md +1676 -0
- package/framework/agents/meta/metaspec-gate-keeper.md +240 -0
- package/framework/agents/meta/onion.md +824 -0
- package/framework/agents/product/branding-positioning-specialist.md +1029 -0
- package/framework/agents/product/extract-meeting-specialist.md +394 -0
- package/framework/agents/product/meeting-consolidator.md +482 -0
- package/framework/agents/product/pain-price-specialist.md +508 -0
- package/framework/agents/product/presentation-orchestrator.md +1190 -0
- package/framework/agents/product/product-agent.md +201 -0
- package/framework/agents/product/story-points-framework-specialist.md +538 -0
- package/framework/agents/product/storytelling-business-specialist.md +890 -0
- package/framework/agents/research/research-agent.md +292 -0
- package/framework/agents/review/code-reviewer.md +154 -0
- package/framework/agents/review/corporate-compliance-specialist.md +370 -0
- package/framework/agents/testing/test-agent.md +424 -0
- package/framework/agents/testing/test-engineer.md +294 -0
- package/framework/agents/testing/test-planner.md +117 -0
- package/framework/commands/common/prompts/README.md +208 -0
- package/framework/commands/common/prompts/clickup-patterns.md +144 -0
- package/framework/commands/common/prompts/code-review-checklist.md +168 -0
- package/framework/commands/common/prompts/git-workflow-patterns.md +235 -0
- package/framework/commands/common/prompts/output-formats.md +240 -0
- package/framework/commands/common/prompts/technical.md +194 -0
- package/framework/commands/common/templates/abstraction-template.md +399 -0
- package/framework/commands/common/templates/agent-template.md +353 -0
- package/framework/commands/common/templates/business_context_template.md +748 -0
- package/framework/commands/common/templates/command-template.md +273 -0
- package/framework/commands/common/templates/technical_context_template.md +526 -0
- package/framework/commands/design/screen-spec.md +505 -0
- package/framework/commands/development/runflow-dev.md +465 -0
- package/framework/commands/docs/build-business-docs.md +299 -0
- package/framework/commands/docs/build-compliance-docs.md +143 -0
- package/framework/commands/docs/build-index.md +119 -0
- package/framework/commands/docs/build-tech-docs.md +221 -0
- package/framework/commands/docs/docs-health.md +141 -0
- package/framework/commands/docs/help.md +278 -0
- package/framework/commands/docs/refine-vision.md +25 -0
- package/framework/commands/docs/reverse-consolidate.md +158 -0
- package/framework/commands/docs/sync-sessions.md +354 -0
- package/framework/commands/docs/validate-docs.md +157 -0
- package/framework/commands/engineer/bump.md +29 -0
- package/framework/commands/engineer/docs.md +11 -0
- package/framework/commands/engineer/hotfix.md +183 -0
- package/framework/commands/engineer/plan.md +85 -0
- package/framework/commands/engineer/pr-update.md +219 -0
- package/framework/commands/engineer/pr.md +117 -0
- package/framework/commands/engineer/pre-pr.md +81 -0
- package/framework/commands/engineer/start.md +254 -0
- package/framework/commands/engineer/validate-phase-sync.md +134 -0
- package/framework/commands/engineer/warm-up.md +20 -0
- package/framework/commands/engineer/work.md +155 -0
- package/framework/commands/f/company-context-extractor.md +93 -0
- package/framework/commands/f/process-meetings.md +103 -0
- package/framework/commands/git/README.md +682 -0
- package/framework/commands/git/code-review.md +213 -0
- package/framework/commands/git/fast-commit.md +43 -0
- package/framework/commands/git/feature/finish.md +88 -0
- package/framework/commands/git/feature/publish.md +89 -0
- package/framework/commands/git/feature/start.md +172 -0
- package/framework/commands/git/help.md +100 -0
- package/framework/commands/git/hotfix/finish.md +96 -0
- package/framework/commands/git/hotfix/start.md +92 -0
- package/framework/commands/git/init.md +111 -0
- package/framework/commands/git/release/finish.md +96 -0
- package/framework/commands/git/release/start.md +93 -0
- package/framework/commands/git/sync.md +199 -0
- package/framework/commands/meta/all-tools.md +58 -0
- package/framework/commands/meta/analyze-complex-problem.md +186 -0
- package/framework/commands/meta/create-abstraction.md +882 -0
- package/framework/commands/meta/create-agent-express.md +98 -0
- package/framework/commands/meta/create-agent.md +210 -0
- package/framework/commands/meta/create-command.md +203 -0
- package/framework/commands/meta/create-knowledge-base.md +143 -0
- package/framework/commands/meta/create-task-structure.md +150 -0
- package/framework/commands/meta/setup-integration.md +274 -0
- package/framework/commands/onion.md +169 -0
- package/framework/commands/product/README.md +249 -0
- package/framework/commands/product/analyze-pain-price.md +694 -0
- package/framework/commands/product/branding.md +458 -0
- package/framework/commands/product/check.md +46 -0
- package/framework/commands/product/checklist-sync.md +239 -0
- package/framework/commands/product/collect.md +95 -0
- package/framework/commands/product/consolidate-meetings.md +291 -0
- package/framework/commands/product/estimate.md +511 -0
- package/framework/commands/product/extract-meeting.md +226 -0
- package/framework/commands/product/feature.md +416 -0
- package/framework/commands/product/light-arch.md +82 -0
- package/framework/commands/product/presentation.md +174 -0
- package/framework/commands/product/refine.md +161 -0
- package/framework/commands/product/spec.md +79 -0
- package/framework/commands/product/task-check.md +378 -0
- package/framework/commands/product/task.md +603 -0
- package/framework/commands/product/validate-task.md +325 -0
- package/framework/commands/product/warm-up.md +24 -0
- package/framework/commands/quick/analisys.md +17 -0
- package/framework/commands/test/e2e.md +377 -0
- package/framework/commands/test/integration.md +508 -0
- package/framework/commands/test/unit.md +381 -0
- package/framework/commands/validate/collab/pair-testing.md +657 -0
- package/framework/commands/validate/collab/three-amigos.md +534 -0
- package/framework/commands/validate/qa-points/estimate.md +660 -0
- package/framework/commands/validate/test-strategy/analyze.md +1201 -0
- package/framework/commands/validate/test-strategy/create.md +411 -0
- package/framework/commands/validate/workflow.md +370 -0
- package/framework/commands/warm-up.md +20 -0
- package/framework/docs/architecture/acoplamento-clickup-problema-analise.md +468 -0
- package/framework/docs/architecture/desacoplamento-roadmap.md +364 -0
- package/framework/docs/architecture/validacao-fase-1.md +235 -0
- package/framework/docs/c4/c4-detection-rules.md +395 -0
- package/framework/docs/c4/c4-documentation-templates.md +579 -0
- package/framework/docs/c4/c4-mermaid-patterns.md +331 -0
- package/framework/docs/c4/c4-templates.md +256 -0
- package/framework/docs/clickup/clickup-acceptance-criteria-strategy.md +329 -0
- package/framework/docs/clickup/clickup-auto-update-strategy.md +340 -0
- package/framework/docs/clickup/clickup-comment-formatter.md +239 -0
- package/framework/docs/clickup/clickup-description-fix.md +384 -0
- package/framework/docs/clickup/clickup-dual-comment-strategy.md +528 -0
- package/framework/docs/clickup/clickup-formatting.md +302 -0
- package/framework/docs/clickup/separador-tamanho-otimizado.md +258 -0
- package/framework/docs/engineer/pre-pr-acceptance-validation.md +256 -0
- package/framework/docs/onion/ESPERANTO.md +293 -0
- package/framework/docs/onion/agents-reference.md +832 -0
- package/framework/docs/onion/clickup-integration.md +780 -0
- package/framework/docs/onion/commands-guide.md +924 -0
- package/framework/docs/onion/engineering-flows.md +900 -0
- package/framework/docs/onion/getting-started.md +803 -0
- package/framework/docs/onion/maintenance-checklist.md +421 -0
- package/framework/docs/onion/naming-conventions.md +286 -0
- package/framework/docs/onion/practical-examples.md +854 -0
- package/framework/docs/product/story-points-integration.md +269 -0
- package/framework/docs/product/story-points-validation.md +237 -0
- package/framework/docs/reviews/task-manager-docs-review-2025-11-24.md +184 -0
- package/framework/docs/strategies/clickup-comment-patterns.md +766 -0
- package/framework/docs/strategies/clickup-integration-tests.md +602 -0
- package/framework/docs/strategies/clickup-mcp-wrappers-tests.md +888 -0
- package/framework/docs/strategies/clickup-regression-tests.md +587 -0
- package/framework/docs/strategies/visual-patterns.md +315 -0
- package/framework/docs/templates/README.md +649 -0
- package/framework/docs/templates/adr-template.md +226 -0
- package/framework/docs/templates/analysis-template.md +280 -0
- package/framework/docs/templates/execution-plan-template.md +430 -0
- package/framework/docs/templates/guide-template.md +367 -0
- package/framework/docs/templates/phase-execution-prompt-template.md +504 -0
- package/framework/docs/templates/reference-template.md +522 -0
- package/framework/docs/templates/solution-template.md +390 -0
- package/framework/docs/tools/README.md +356 -0
- package/framework/docs/tools/agents.md +365 -0
- package/framework/docs/tools/commands.md +669 -0
- package/framework/docs/tools/cursor.md +539 -0
- package/framework/docs/tools/mcps.md +937 -0
- package/framework/docs/tools/rules.md +461 -0
- package/framework/rules/language-and-documentation.mdc +371 -0
- package/framework/rules/nestjs-controllers.md +83 -0
- package/framework/rules/nestjs-dtos.md +255 -0
- package/framework/rules/nestjs-modules.md +141 -0
- package/framework/rules/nestjs-services.md +230 -0
- package/framework/rules/nx-rules.mdc +41 -0
- package/framework/rules/onion-patterns.mdc +197 -0
- package/framework/skills/codebase-visualizer/SKILL.md +26 -0
- package/framework/skills/codebase-visualizer/scripts/visualize.py +131 -0
- package/framework/skills/collect/SKILL.md +84 -0
- package/framework/skills/create-rule/SKILL.md +152 -0
- package/framework/skills/db-schema-visualizer/SKILL.md +49 -0
- package/framework/skills/db-schema-visualizer/scripts/visualize.py +1191 -0
- package/framework/skills/sync-meetings/SKILL.md +239 -0
- package/framework/utils/clickup-mcp-wrappers.md +744 -0
- package/framework/utils/date-time-standards.md +200 -0
- package/framework/utils/task-manager/README.md +94 -0
- package/framework/utils/task-manager/adapters/asana.md +377 -0
- package/framework/utils/task-manager/adapters/clickup.md +467 -0
- package/framework/utils/task-manager/adapters/linear.md +421 -0
- package/framework/utils/task-manager/detector.md +299 -0
- package/framework/utils/task-manager/factory.md +363 -0
- package/framework/utils/task-manager/interface.md +248 -0
- package/framework/utils/task-manager/types.md +409 -0
- package/package.json +41 -0
- package/src/cli.js +73 -0
- package/src/commands/doctor.js +191 -0
- package/src/commands/init.js +287 -0
- package/src/commands/install.js +261 -0
- package/src/commands/list.js +152 -0
- package/src/commands/uninstall.js +90 -0
- package/src/commands/update.js +26 -0
- package/src/utils/fs.js +89 -0
- package/src/utils/log.js +35 -0
- package/src/utils/paths.js +32 -0
- package/src/utils/prompt.js +76 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Language and Documentation Standards
|
|
3
|
+
description: Regras de idioma, documentação e fluxo de trabalho para o projeto
|
|
4
|
+
tags: [language, documentation, workflow, standards]
|
|
5
|
+
priority: high
|
|
6
|
+
version: 3.0.0
|
|
7
|
+
globs: ["**/*"]
|
|
8
|
+
alwaysApply: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Language and Documentation Standards
|
|
12
|
+
|
|
13
|
+
## 🎯 Objetivo
|
|
14
|
+
|
|
15
|
+
Estabelecer padrões consistentes de idioma e documentação em todo o projeto, garantindo que código seja universal (inglês) enquanto comunicação e explicações sejam localizadas (pt-BR).
|
|
16
|
+
|
|
17
|
+
## 📋 Regras Fundamentais
|
|
18
|
+
|
|
19
|
+
### 1. Idiomas no Código
|
|
20
|
+
|
|
21
|
+
#### ✅ SEMPRE em Inglês (en-US)
|
|
22
|
+
- **Nomes de variáveis, funções, classes e interfaces**
|
|
23
|
+
```typescript
|
|
24
|
+
// ✅ CORRETO
|
|
25
|
+
interface UserProfile {
|
|
26
|
+
userName: string;
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ❌ INCORRETO
|
|
31
|
+
interface PerfilUsuario {
|
|
32
|
+
nomeUsuario: string;
|
|
33
|
+
criadoEm: Date;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- **Nomes de arquivos e diretórios**
|
|
38
|
+
```
|
|
39
|
+
✅ user-profile.component.tsx
|
|
40
|
+
✅ authentication-service.ts
|
|
41
|
+
❌ perfil-usuario.component.tsx
|
|
42
|
+
❌ servico-autenticacao.ts
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **Commits no Git**
|
|
46
|
+
```bash
|
|
47
|
+
# ✅ CORRETO
|
|
48
|
+
git commit -m "feat: add user authentication flow"
|
|
49
|
+
|
|
50
|
+
# ❌ INCORRETO
|
|
51
|
+
git commit -m "feat: adicionar fluxo de autenticação"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- **Nomes de branches**
|
|
55
|
+
```bash
|
|
56
|
+
✅ feature/user-dashboard
|
|
57
|
+
✅ fix/authentication-bug
|
|
58
|
+
❌ feature/painel-usuario
|
|
59
|
+
❌ fix/erro-autenticacao
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **Documentação técnica de API (schemas, endpoints, responses)**
|
|
63
|
+
|
|
64
|
+
#### ✅ SEMPRE em English (en-GB)
|
|
65
|
+
- **Comentários no código**
|
|
66
|
+
```typescript
|
|
67
|
+
// ✅ CORRETO
|
|
68
|
+
/**
|
|
69
|
+
* Busca o perfil do usuário no banco de dados
|
|
70
|
+
* @param userId - ID único do usuário
|
|
71
|
+
* @returns Perfil completo ou null se não encontrado
|
|
72
|
+
*/
|
|
73
|
+
async function getUserProfile(userId: string): Promise<UserProfile | null> {
|
|
74
|
+
// Valida se o ID é válido antes de fazer a consulta
|
|
75
|
+
if (!isValidUUID(userId)) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
// ... resto da implementação
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// ❌ INCORRETO
|
|
82
|
+
/**
|
|
83
|
+
* Fetch user profile from database
|
|
84
|
+
* @param userId - Unique user ID
|
|
85
|
+
* @returns Full profile or null if not found
|
|
86
|
+
*/
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- **Respostas e explicações do assistente IA**
|
|
90
|
+
- **Documentação de processos e workflows**
|
|
91
|
+
- **READMEs e guias de uso** (exceto código e comandos)
|
|
92
|
+
- **Mensagens de erro personalizadas para usuários finais**
|
|
93
|
+
- **Logs de aplicação voltados para debugging**
|
|
94
|
+
|
|
95
|
+
### 2. Documentação do Projeto
|
|
96
|
+
|
|
97
|
+
#### ✅ Manter Sincronizado com a Documentação
|
|
98
|
+
- **Antes de implementar qualquer mudança estrutural:**
|
|
99
|
+
1. Consultar documentação existente em `/docs/`
|
|
100
|
+
2. Verificar padrões estabelecidos em `.claude/commands/`
|
|
101
|
+
3. Revisar agentes especializados em `.claude/agents/`
|
|
102
|
+
4. Ler regras de projeto em `.claude/rules/`
|
|
103
|
+
|
|
104
|
+
- **Ao introduzir novos padrões:**
|
|
105
|
+
1. Documentar em `.claude/docs/` ou `/docs/` conforme apropriado
|
|
106
|
+
2. Atualizar comandos relacionados em `.claude/commands/`
|
|
107
|
+
3. Notificar sobre mudanças em padrões estabelecidos
|
|
108
|
+
|
|
109
|
+
#### ✅ Hierarquia de Documentação
|
|
110
|
+
```
|
|
111
|
+
/docs/ # Documentação de negócio e produto
|
|
112
|
+
├── meta-specs/ # Especificações meta do projeto
|
|
113
|
+
├── technical-context/ # Contexto técnico e arquitetura
|
|
114
|
+
└── business-context/ # Contexto de negócio
|
|
115
|
+
|
|
116
|
+
.claude/ # Documentação de desenvolvimento
|
|
117
|
+
├── docs/ # Documentação de processo e workflow
|
|
118
|
+
│ ├── templates/ # Templates reutilizáveis
|
|
119
|
+
│ └── guides/ # Guias específicos
|
|
120
|
+
├── commands/ # Comandos Cursor
|
|
121
|
+
│ ├── meta/ # Comandos meta (criar comandos, etc)
|
|
122
|
+
│ ├── development/ # Comandos de desenvolvimento
|
|
123
|
+
│ └── docs/ # Comandos de documentação
|
|
124
|
+
├── agents/ # Agentes especializados
|
|
125
|
+
│ ├── meta/ # Agentes meta (Onion, etc)
|
|
126
|
+
│ └── development/ # Agentes de desenvolvimento
|
|
127
|
+
└── rules/ # Regras do projeto (este arquivo)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 3. Sintaxes e Estratégias Oficiais
|
|
131
|
+
|
|
132
|
+
#### ✅ SEMPRE Consultar Documentação Oficial
|
|
133
|
+
- **ZenStack**: Usar sempre a sintaxe da versão oficial no projeto
|
|
134
|
+
- **NX**: Seguir padrões de workspace da versão instalada
|
|
135
|
+
- **Tamagui**: Aderir às convenções de componentes universais
|
|
136
|
+
- **Expo**: Respeitar limitações e features do SDK atual
|
|
137
|
+
- **React Native**: Seguir patterns recomendados pela versão em uso
|
|
138
|
+
|
|
139
|
+
#### ⚠️ NUNCA Inventar Sintaxe
|
|
140
|
+
- Verificar documentação oficial antes de implementar
|
|
141
|
+
- Testar em sandbox se houver dúvida
|
|
142
|
+
- Documentar desvios necessários com justificativa
|
|
143
|
+
|
|
144
|
+
### 4. Workflow de Execução
|
|
145
|
+
|
|
146
|
+
#### ✅ SEMPRE Antes de Finalizar
|
|
147
|
+
1. **Propor próximo passo lógico:**
|
|
148
|
+
```markdown
|
|
149
|
+
## 🚀 Próximo Passo Sugerido
|
|
150
|
+
|
|
151
|
+
Agora que criamos [X], o próximo passo recomendado é:
|
|
152
|
+
|
|
153
|
+
**Opção 1 (Recomendada):** [Ação + Justificativa]
|
|
154
|
+
**Opção 2:** [Ação Alternativa + Justificativa]
|
|
155
|
+
|
|
156
|
+
Deseja prosseguir com alguma dessas opções ou tem outra prioridade?
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
2. **Validar conformidade:**
|
|
160
|
+
- ✅ Código em inglês?
|
|
161
|
+
- ✅ Comentários em pt-BR?
|
|
162
|
+
- ✅ Documentação atualizada?
|
|
163
|
+
- ✅ Padrões do projeto respeitados?
|
|
164
|
+
|
|
165
|
+
3. **Oferecer comando para continuar:**
|
|
166
|
+
```markdown
|
|
167
|
+
**Comando sugerido:**
|
|
168
|
+
`/development/test-integration --component=UserProfile`
|
|
169
|
+
|
|
170
|
+
ou
|
|
171
|
+
|
|
172
|
+
`@onion "implementar testes unitários para UserProfile"`
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 🔄 Fluxo de Trabalho Completo
|
|
176
|
+
|
|
177
|
+
```mermaid
|
|
178
|
+
graph TD
|
|
179
|
+
A[Receber Tarefa] --> B{Consultar Documentação}
|
|
180
|
+
B --> C[Verificar Padrões Existentes]
|
|
181
|
+
C --> D[Implementar em Inglês]
|
|
182
|
+
D --> E[Comentar em pt-BR]
|
|
183
|
+
E --> F[Validar Conformidade]
|
|
184
|
+
F --> G{Tudo OK?}
|
|
185
|
+
G -->|Não| H[Corrigir]
|
|
186
|
+
H --> F
|
|
187
|
+
G -->|Sim| I[Propor Próximo Passo]
|
|
188
|
+
I --> J[Aguardar Decisão]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 📚 Exemplos Práticos
|
|
192
|
+
|
|
193
|
+
### Exemplo 1: Criação de Componente
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// ✅ CORRETO: Código em inglês, comentários em pt-BR
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Componente de perfil de usuário com informações básicas
|
|
200
|
+
*
|
|
201
|
+
* @component
|
|
202
|
+
* @example
|
|
203
|
+
* ```tsx
|
|
204
|
+
* <UserProfileCard userId="123" showActions={true} />
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export const UserProfileCard: React.FC<UserProfileCardProps> = ({
|
|
208
|
+
userId,
|
|
209
|
+
showActions = false
|
|
210
|
+
}) => {
|
|
211
|
+
// Busca os dados do usuário usando o hook do ZenStack
|
|
212
|
+
const { data: user, isLoading } = useFindUniqueUser({
|
|
213
|
+
where: { id: userId }
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Exibe skeleton enquanto carrega
|
|
217
|
+
if (isLoading) {
|
|
218
|
+
return <ProfileSkeleton />;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Se não encontrou, exibe mensagem
|
|
222
|
+
if (!user) {
|
|
223
|
+
return <EmptyState message="Usuário não encontrado" />;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return (
|
|
227
|
+
<Card>
|
|
228
|
+
<CardHeader>
|
|
229
|
+
<Avatar src={user.avatarUrl} alt={user.name} />
|
|
230
|
+
<Title>{user.name}</Title>
|
|
231
|
+
</CardHeader>
|
|
232
|
+
{showActions && (
|
|
233
|
+
<CardActions>
|
|
234
|
+
{/* Botões de ação do perfil */}
|
|
235
|
+
<Button variant="primary">Editar</Button>
|
|
236
|
+
<Button variant="secondary">Mensagem</Button>
|
|
237
|
+
</CardActions>
|
|
238
|
+
)}
|
|
239
|
+
</Card>
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Exemplo 2: Documentação de Feature
|
|
245
|
+
|
|
246
|
+
```markdown
|
|
247
|
+
# User Authentication Flow
|
|
248
|
+
|
|
249
|
+
## Descrição
|
|
250
|
+
|
|
251
|
+
Sistema de autenticação multi-fator implementado com ZenStack e NextAuth.
|
|
252
|
+
|
|
253
|
+
## Componentes Principais
|
|
254
|
+
|
|
255
|
+
### `AuthProvider`
|
|
256
|
+
Provedor de contexto que gerencia o estado de autenticação em toda a aplicação.
|
|
257
|
+
|
|
258
|
+
**Uso:**
|
|
259
|
+
\`\`\`tsx
|
|
260
|
+
import { AuthProvider } from '@company/auth';
|
|
261
|
+
|
|
262
|
+
function App() {
|
|
263
|
+
return (
|
|
264
|
+
<AuthProvider>
|
|
265
|
+
<YourApp />
|
|
266
|
+
</AuthProvider>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
\`\`\`
|
|
270
|
+
|
|
271
|
+
## Fluxo de Autenticação
|
|
272
|
+
|
|
273
|
+
1. Usuário acessa página de login
|
|
274
|
+
2. Insere credenciais (email + senha)
|
|
275
|
+
3. Sistema valida no banco de dados
|
|
276
|
+
4. Se MFA habilitado, solicita código
|
|
277
|
+
5. Gera token JWT e armazena no cookie seguro
|
|
278
|
+
6. Redireciona para dashboard
|
|
279
|
+
|
|
280
|
+
## Próximos Passos
|
|
281
|
+
|
|
282
|
+
- [ ] Implementar autenticação biométrica
|
|
283
|
+
- [ ] Adicionar login social (Google, Facebook)
|
|
284
|
+
- [ ] Melhorar UX do fluxo de MFA
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## ⚡ Quick Reference
|
|
288
|
+
|
|
289
|
+
| Contexto | Idioma | Exemplo |
|
|
290
|
+
|----------|--------|---------|
|
|
291
|
+
| Código (vars, funcs, classes) | 🇺🇸 Inglês | `getUserProfile()` |
|
|
292
|
+
| Comentários no código | 🇺🇸 Inglês | `// Busca perfil do usuário` |
|
|
293
|
+
| Commits | 🇺🇸 Inglês | `fix: resolve auth bug` |
|
|
294
|
+
| Documentação técnica | 🇺🇸 Inglês | `## Instalação` |
|
|
295
|
+
| Respostas do assistente | 🇺🇸 Inglês | `Vou criar o componente...` |
|
|
296
|
+
| Nomes de arquivos | 🇺🇸 Inglês | `user-profile.tsx` |
|
|
297
|
+
| Logs de debug | 🇺🇸 Inglês | `console.log('Usuário autenticado')` |
|
|
298
|
+
| Mensagens de erro | 🇺🇸 Inglês | `throw new Error('Usuário não encontrado')` |
|
|
299
|
+
|
|
300
|
+
## 🎯 Checklist de Conformidade
|
|
301
|
+
|
|
302
|
+
Antes de finalizar qualquer tarefa, verificar:
|
|
303
|
+
|
|
304
|
+
- [ ] Todo código (variáveis, funções, classes) está em inglês
|
|
305
|
+
- [ ] Todos os comentários estão em português (pt-BR)
|
|
306
|
+
- [ ] Commits seguem padrão conventional em inglês
|
|
307
|
+
- [ ] Documentação foi atualizada quando necessário
|
|
308
|
+
- [ ] Sintaxe oficial das bibliotecas foi respeitada
|
|
309
|
+
- [ ] Próximo passo foi proposto ao usuário
|
|
310
|
+
- [ ] Comando de continuação foi sugerido
|
|
311
|
+
|
|
312
|
+
## 🚨 Exceções
|
|
313
|
+
|
|
314
|
+
### Quando usar inglês em comentários:
|
|
315
|
+
- Referências diretas a código: "O método `getUserById()` retorna..."
|
|
316
|
+
- Links para documentação oficial em inglês
|
|
317
|
+
- Termos técnicos sem tradução estabelecida
|
|
318
|
+
|
|
319
|
+
### Quando usar português no código:
|
|
320
|
+
- **NUNCA** (exceto em strings de UI para usuário final)
|
|
321
|
+
- Mensagens de erro para usuário final
|
|
322
|
+
- Labels de formulário
|
|
323
|
+
- Textos de interface
|
|
324
|
+
|
|
325
|
+
## 📖 Referências
|
|
326
|
+
|
|
327
|
+
- [Conventional Commits](https://www.conventionalcommits.org/)
|
|
328
|
+
- [JSDoc em Português](https://jsdoc.app/)
|
|
329
|
+
- [NX Workspace Patterns](https://nx.dev/concepts)
|
|
330
|
+
- [ZenStack Documentation](https://zenstack.dev/)
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## 🔐 Gestão de Configurações
|
|
335
|
+
|
|
336
|
+
### Variáveis de Ambiente (.env)
|
|
337
|
+
- **NUNCA** commitar `.env` com valores sensíveis
|
|
338
|
+
- **SEMPRE** manter `.env.example` atualizado com placeholders
|
|
339
|
+
- Usar prefixos para organização: `CLICKUP_`, `GITHUB_`, `DB_`
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# ✅ CORRETO - .env.example
|
|
343
|
+
CLICKUP_API_TOKEN=your_token_here
|
|
344
|
+
GITHUB_TOKEN=ghp_xxxxxxxxxxxx
|
|
345
|
+
|
|
346
|
+
# ❌ INCORRETO - Nunca no repositório
|
|
347
|
+
CLICKUP_API_TOKEN=pk_12345_secret
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Integrações Opcionais
|
|
351
|
+
- Comandos e agentes devem funcionar sem integrações quando possível
|
|
352
|
+
- Se integração não configurada: perguntar ao usuário ou abortar com mensagem clara
|
|
353
|
+
- Documentar variáveis necessárias no header do comando/agente
|
|
354
|
+
|
|
355
|
+
## 📚 Knowledge Bases
|
|
356
|
+
|
|
357
|
+
As Knowledge Bases do projeto estão em `docs/knowbase/`:
|
|
358
|
+
|
|
359
|
+
| KB | Propósito |
|
|
360
|
+
|----|-----------|
|
|
361
|
+
| `cursor-commands-best-practices-2025.md` | Padrões de comandos Cursor |
|
|
362
|
+
| `spec-as-code-strategy.md` | Estratégia de especificações |
|
|
363
|
+
| `ai-agent-design-patterns.md` | Padrões de design de agentes |
|
|
364
|
+
| `context-window-optimization.md` | Otimização de contexto |
|
|
365
|
+
| `configuration-management.md` | Gestão de configurações |
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
**Última atualização:** 2025-11-24
|
|
370
|
+
**Versão:** 3.0.0
|
|
371
|
+
**Mantido por:** Sistema Onion
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- 'apps/api/src/modules/**/*.controller.ts'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# NestJS Controller Standards
|
|
7
|
+
|
|
8
|
+
Reference implementation: `apps/api/src/modules/initiatives/admin/initiatives.controller.ts`
|
|
9
|
+
|
|
10
|
+
## Class Decorators (required, in this order)
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
@ApiTags('Feature Name')
|
|
14
|
+
@UseGuards(AdminPortalGuard, BrandAccessGuard) // Order matters: auth first, then scope
|
|
15
|
+
@Controller('brands/:brandId/resource')
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- Creator controllers use `@UseGuards(CreatorPortalGuard)` instead
|
|
19
|
+
- Public endpoints use `@Public()` to opt out of global `JwtAuthGuard`
|
|
20
|
+
|
|
21
|
+
## Endpoint Decorators (required on every endpoint)
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
@Get()
|
|
25
|
+
@ApiOperation({
|
|
26
|
+
operationId: 'listResources', // Drives Orval-generated function name
|
|
27
|
+
summary: 'Short description',
|
|
28
|
+
})
|
|
29
|
+
@ApiParam({ name: 'brandId', description: 'Brand ID', type: 'string' })
|
|
30
|
+
@ApiResponse({ status: 200, type: ResourceResponse })
|
|
31
|
+
@ApiResponse({ status: 404, description: 'Resource not found' }) // ALL error responses
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- Every route param needs its own `@ApiParam`
|
|
35
|
+
- Document all possible error status codes with `@ApiResponse`
|
|
36
|
+
- `operationId` must be unique and becomes the frontend API function name
|
|
37
|
+
|
|
38
|
+
## HTTP Conventions
|
|
39
|
+
|
|
40
|
+
| Operation | Verb | Status | Decorator | Return |
|
|
41
|
+
| --------- | ------ | ------ | ---------------------------------- | ------------------- |
|
|
42
|
+
| List | GET | 200 | — | `PaginatedResponse` |
|
|
43
|
+
| Detail | GET | 200 | — | `ResourceResponse` |
|
|
44
|
+
| Create | POST | 201 | — | `ResourceResponse` |
|
|
45
|
+
| Update | PATCH | 200 | — | `ResourceResponse` |
|
|
46
|
+
| Delete | DELETE | 204 | `@HttpCode(HttpStatus.NO_CONTENT)` | `void` |
|
|
47
|
+
| Action | POST | 200 | — | `ResourceResponse` |
|
|
48
|
+
|
|
49
|
+
- Always PATCH for partial updates, never PUT
|
|
50
|
+
- State transitions (publish, cancel) use POST on sub-resource: `POST :id/publish`
|
|
51
|
+
|
|
52
|
+
## Parameter Patterns
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
@Param('brandId', ParseUUIDPipe) brandId: string // Always ParseUUIDPipe for UUIDs
|
|
56
|
+
@Param('id', ParseUUIDPipe) id: string
|
|
57
|
+
@Query() query: QueryResourceDto // Query DTO for filters/pagination
|
|
58
|
+
@Body() dto: CreateResourceDto // Body DTO for mutations
|
|
59
|
+
@CurrentUser() user: AuthenticatedUser // Authenticated user context
|
|
60
|
+
@UploadedFile() file: Express.Multer.File // File uploads
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## File Upload Endpoints
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
@Post(':id/uploads/brief')
|
|
67
|
+
@FileUpload({ fieldName: 'file', maxSize: 10 * 1024 * 1024, mimeTypes: ['application/pdf'] })
|
|
68
|
+
@ApiConsumes('multipart/form-data')
|
|
69
|
+
@ApiBody({
|
|
70
|
+
schema: {
|
|
71
|
+
type: 'object',
|
|
72
|
+
properties: { file: { type: 'string', format: 'binary', description: '...' } },
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Common Mistakes
|
|
78
|
+
|
|
79
|
+
- Missing `ParseUUIDPipe` on UUID params (allows invalid UUIDs through)
|
|
80
|
+
- Missing `@ApiResponse` for error status codes (frontend can't anticipate errors)
|
|
81
|
+
- Missing `@HttpCode(HttpStatus.NO_CONTENT)` on DELETE (returns 200 instead of 204)
|
|
82
|
+
- Missing `@ApiParam` for parent route params like `brandId`
|
|
83
|
+
- Using GET for state transitions instead of POST
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- 'apps/api/src/modules/**/dto/**/*.ts'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# NestJS DTO Standards
|
|
7
|
+
|
|
8
|
+
Reference implementation: `apps/api/src/modules/initiatives/admin/dto/`
|
|
9
|
+
|
|
10
|
+
## Naming Convention
|
|
11
|
+
|
|
12
|
+
- **Input DTOs:** `{Action}{Resource}Dto` (e.g., `CreateInitiativeDto`, `QueryInitiativesDto`)
|
|
13
|
+
- **Response DTOs:** `{Resource}Response` (e.g., `InitiativeResponse`) - avoids Prisma type conflicts
|
|
14
|
+
- **Paginated:** `Paginated{Resource}Response`
|
|
15
|
+
- **Nested:** `{Parent}{Child}Response` (e.g., `TargetedPlatformResponse`)
|
|
16
|
+
|
|
17
|
+
## Input DTO Patterns
|
|
18
|
+
|
|
19
|
+
### Required field
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
@ApiProperty({ description: '...', maxLength: 255, example: '...' })
|
|
23
|
+
@IsString()
|
|
24
|
+
@IsNotEmpty()
|
|
25
|
+
@MaxLength(255)
|
|
26
|
+
title: string;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Optional field
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
@ApiPropertyOptional({ description: '...', example: '...' })
|
|
33
|
+
@IsOptional() // Always first among validators
|
|
34
|
+
@IsString()
|
|
35
|
+
field?: string;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Enum field (always include enumName for Orval)
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
@ApiProperty({
|
|
42
|
+
enum: InitiativeType,
|
|
43
|
+
enumName: 'InitiativeType', // Critical: Orval uses this for type generation
|
|
44
|
+
description: '...',
|
|
45
|
+
example: 'product_gifting',
|
|
46
|
+
})
|
|
47
|
+
@IsEnum(InitiativeType)
|
|
48
|
+
type: InitiativeType;
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Date field
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
@ApiProperty({ description: 'Date (YYYY-MM-DD)', example: '2026-03-31' })
|
|
55
|
+
@IsDateString()
|
|
56
|
+
date: string;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Nested DTO array
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
@ApiProperty({ type: [TargetedPlatformDto] })
|
|
63
|
+
@IsArray()
|
|
64
|
+
@ArrayNotEmpty()
|
|
65
|
+
@ValidateNested({ each: true })
|
|
66
|
+
@Type(() => TargetedPlatformDto)
|
|
67
|
+
items: TargetedPlatformDto[];
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### String array with per-element validation
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
@ApiProperty({ type: [String], example: ['BR', 'US'] })
|
|
74
|
+
@IsArray()
|
|
75
|
+
@ArrayNotEmpty()
|
|
76
|
+
@IsString({ each: true })
|
|
77
|
+
@Length(2, 2, { each: true }) // Each element exactly 2 chars
|
|
78
|
+
countries: string[];
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Nullable field (can be set to null to clear value)
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
@ApiPropertyOptional({ type: 'string', nullable: true })
|
|
85
|
+
@IsOptional()
|
|
86
|
+
@ValidateIf((_, value) => value !== null) // Skip validation when null
|
|
87
|
+
@IsString()
|
|
88
|
+
@MaxLength(500)
|
|
89
|
+
logoUrl?: string | null;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Hex color with regex
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
@ApiPropertyOptional({ pattern: '^#[0-9A-Fa-f]{6}$', example: '#FF5733' })
|
|
96
|
+
@IsOptional()
|
|
97
|
+
@Matches(/^#[0-9A-Fa-f]{6}$/, {
|
|
98
|
+
message: 'fieldName must be a valid hex color (e.g., #FF5733)',
|
|
99
|
+
})
|
|
100
|
+
color?: string;
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Numeric with range
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
@ApiPropertyOptional({ minimum: 0, example: 50 })
|
|
107
|
+
@IsOptional()
|
|
108
|
+
@IsInt()
|
|
109
|
+
@Min(0)
|
|
110
|
+
count?: number;
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Update DTOs
|
|
114
|
+
|
|
115
|
+
Compose from Create DTO using NestJS mapped types:
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
export class UpdateResourceDto extends PartialType(
|
|
119
|
+
OmitType(CreateResourceDto, ['immutableField'] as const),
|
|
120
|
+
) {
|
|
121
|
+
// Re-add fields that need different rules in update context
|
|
122
|
+
@ApiPropertyOptional({ enum: MyEnum, enumName: 'MyEnum' })
|
|
123
|
+
@IsOptional()
|
|
124
|
+
@IsEnum(MyEnum)
|
|
125
|
+
type?: MyEnum;
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Query DTOs (Pagination + Filters)
|
|
130
|
+
|
|
131
|
+
### Pagination fields (required on all list endpoints)
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
@ApiPropertyOptional({ minimum: 1, default: 1 })
|
|
135
|
+
@IsOptional()
|
|
136
|
+
@Type(() => Number) // Query params arrive as strings; must convert
|
|
137
|
+
@IsInt()
|
|
138
|
+
@Min(1)
|
|
139
|
+
page?: number = 1;
|
|
140
|
+
|
|
141
|
+
@ApiPropertyOptional({ minimum: 1, maximum: 100, default: 20 })
|
|
142
|
+
@IsOptional()
|
|
143
|
+
@Type(() => Number)
|
|
144
|
+
@IsInt()
|
|
145
|
+
@Min(1)
|
|
146
|
+
@Max(100)
|
|
147
|
+
limit?: number = 20;
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Sort fields
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
@ApiPropertyOptional({ default: 'createdAt', enum: ['createdAt', 'updatedAt', 'title'] })
|
|
154
|
+
@IsOptional()
|
|
155
|
+
@IsString()
|
|
156
|
+
sortBy?: 'createdAt' | 'updatedAt' | 'title' = 'createdAt';
|
|
157
|
+
|
|
158
|
+
@ApiPropertyOptional({ default: 'desc', enum: ['asc', 'desc'] })
|
|
159
|
+
@IsOptional()
|
|
160
|
+
@IsString()
|
|
161
|
+
sortOrder?: 'asc' | 'desc' = 'desc';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Filter fields
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
@ApiPropertyOptional({ enum: Status, enumName: 'Status' })
|
|
168
|
+
@IsOptional()
|
|
169
|
+
@IsEnum(Status)
|
|
170
|
+
status?: Status;
|
|
171
|
+
|
|
172
|
+
@ApiPropertyOptional({ description: 'Search by name' })
|
|
173
|
+
@IsOptional()
|
|
174
|
+
@IsString()
|
|
175
|
+
search?: string;
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Response DTOs
|
|
179
|
+
|
|
180
|
+
### Resource response
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
export class ResourceResponse {
|
|
184
|
+
@ApiProperty() id: string;
|
|
185
|
+
@ApiProperty() name: string;
|
|
186
|
+
@ApiProperty({ enum: MyEnum, enumName: 'MyEnum' }) type: MyEnum; // Always enumName
|
|
187
|
+
@ApiPropertyOptional() optionalField?: string; // undefined, never null
|
|
188
|
+
@ApiProperty({ type: [NestedResponse] }) items: NestedResponse[];
|
|
189
|
+
@ApiProperty() createdAt: string; // ISO string
|
|
190
|
+
@ApiProperty() updatedAt: string;
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Paginated response
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
export class PaginatedResourceResponse {
|
|
198
|
+
@ApiProperty({ type: [ResourceResponse] }) data: ResourceResponse[];
|
|
199
|
+
@ApiProperty({ description: 'Total count' }) total: number;
|
|
200
|
+
@ApiProperty({ description: 'Current page' }) page: number;
|
|
201
|
+
@ApiProperty({ description: 'Items per page' }) limit: number;
|
|
202
|
+
@ApiProperty({ description: 'Total pages' }) totalPages: number;
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Nested response (for relations)
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
export class RemoteFileResponse {
|
|
210
|
+
@ApiProperty() id: string;
|
|
211
|
+
@ApiProperty() originalName: string;
|
|
212
|
+
@ApiProperty() mimeType: string;
|
|
213
|
+
@ApiProperty() fileSize: number;
|
|
214
|
+
@ApiProperty() url: string;
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Barrel Exports
|
|
219
|
+
|
|
220
|
+
Every `dto/` directory must have an `index.ts`:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
// admin/dto/index.ts
|
|
224
|
+
export { CreateResourceDto } from './create-resource.dto';
|
|
225
|
+
export { UpdateResourceDto } from './update-resource.dto';
|
|
226
|
+
export { QueryResourceDto } from './query-resource.dto';
|
|
227
|
+
export {
|
|
228
|
+
ResourceResponse,
|
|
229
|
+
PaginatedResourceResponse,
|
|
230
|
+
} from './responses/resource.response';
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## JSDoc for Constraints
|
|
234
|
+
|
|
235
|
+
Document business rules in class JSDoc, not inline comments:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
/**
|
|
239
|
+
* DTO for creating a resource
|
|
240
|
+
*
|
|
241
|
+
* Note: briefText and briefFileId are mutually exclusive.
|
|
242
|
+
* Budget requires budgetCurrency when set.
|
|
243
|
+
* File IDs reference pre-uploaded files via POST /files/upload.
|
|
244
|
+
*/
|
|
245
|
+
export class CreateResourceDto { ... }
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Common Mistakes
|
|
249
|
+
|
|
250
|
+
- Missing `enumName` in `@ApiProperty` for enums (Orval generates `unknown` type)
|
|
251
|
+
- Missing `@Type(() => Number)` on query DTO number fields (they arrive as strings)
|
|
252
|
+
- Using `@ApiProperty` for optional fields instead of `@ApiPropertyOptional`
|
|
253
|
+
- Nullable fields without `@ValidateIf((_, v) => v !== null)` (validation fails on null)
|
|
254
|
+
- Missing barrel export in `dto/index.ts` (forces ugly relative imports)
|
|
255
|
+
- Putting response DTOs in wrong portal folder (admin responses in creator/)
|