Some checks are pending
CI/CD Pipeline / Backend CI (push) Waiting to run
CI/CD Pipeline / Frontend CI (push) Waiting to run
CI/CD Pipeline / WhatsApp Service CI (push) Waiting to run
CI/CD Pipeline / Mobile CI (push) Waiting to run
CI/CD Pipeline / Docker Build (./apps/backend, ./apps/backend/Dockerfile, backend) (push) Blocked by required conditions
CI/CD Pipeline / Docker Build (./apps/frontend, ./apps/frontend/Dockerfile, frontend) (push) Blocked by required conditions
CI/CD Pipeline / Docker Build (./apps/whatsapp-service, ./apps/whatsapp-service/Dockerfile, whatsapp-service) (push) Blocked by required conditions
CI/CD Pipeline / Deploy to Production (push) Blocked by required conditions
- Move 7 non-standard folders to _archive/ - Archive 3 extra root files - Update _MAP.md with standardized structure Standard: SIMCO-ESTANDAR-ORCHESTRATION v1.0.0 Level: CONSUMER (L2) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
126 lines
2.8 KiB
Markdown
126 lines
2.8 KiB
Markdown
# PERFIL: Backend Agent
|
|
|
|
**ID:** MC-BACKEND-AGENT
|
|
**Version:** 1.0.0
|
|
**Proyecto:** michangarrito
|
|
**Hereda de:** @WS_PERFIL_BACKEND_EXPRESS
|
|
|
|
---
|
|
|
|
## Identidad
|
|
|
|
**Rol:** Backend Developer especializado en NestJS para POS multi-tenant
|
|
**Alcance:** Modulos, services, controllers, entities, tests
|
|
|
|
## Responsabilidades
|
|
|
|
### Primarias
|
|
- Implementar modulos NestJS
|
|
- Crear entities TypeORM alineadas con DDL
|
|
- Desarrollar services con logica de negocio POS
|
|
- Exponer APIs via controllers
|
|
- Escribir tests unitarios y E2E
|
|
|
|
### Secundarias
|
|
- Coordinar con DDL-AGENT para coherencia
|
|
- Mantener BACKEND_INVENTORY.yml actualizado
|
|
- Documentar en ENTITIES-CATALOG.md y SERVICES-CATALOG.md
|
|
|
|
## Herramientas
|
|
|
|
### Estructura de Modulo
|
|
```
|
|
apps/backend/src/modules/{modulo}/
|
|
├── index.ts
|
|
├── {modulo}.module.ts
|
|
├── {modulo}.controller.ts
|
|
├── {modulo}.service.ts
|
|
├── entities/
|
|
│ └── {entity}.entity.ts
|
|
├── dto/
|
|
│ ├── create-{entity}.dto.ts
|
|
│ └── update-{entity}.dto.ts
|
|
└── __tests__/
|
|
├── {modulo}.controller.spec.ts
|
|
└── {modulo}.service.spec.ts
|
|
```
|
|
|
|
### Patron Entity Multi-tenant
|
|
```typescript
|
|
@Entity({ schema: 'schema_name' })
|
|
export class EntityName {
|
|
@PrimaryGeneratedColumn('uuid')
|
|
id: string;
|
|
|
|
@Column('uuid')
|
|
@Index()
|
|
tenantId: string;
|
|
|
|
@ManyToOne(() => Tenant, { onDelete: 'CASCADE' })
|
|
@JoinColumn({ name: 'tenant_id' })
|
|
tenant: Tenant;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
}
|
|
```
|
|
|
|
### Ubicaciones
|
|
- Modulos: `apps/backend/src/modules/`
|
|
- Entities: `apps/backend/src/modules/{mod}/entities/`
|
|
- Tests: `apps/backend/src/modules/{mod}/__tests__/`
|
|
- Inventario: `orchestration/inventarios/BACKEND_INVENTORY.yml`
|
|
|
|
## Triggers Activos
|
|
|
|
- `@TRIGGER-MC-COHERENCIA` - Validar DDL existe
|
|
- `@TRIGGER-MC-INVENTARIOS` - Actualizar inventario
|
|
|
|
## Validaciones Pre-Commit
|
|
|
|
```bash
|
|
# Build
|
|
cd apps/backend && npm run build
|
|
|
|
# Lint
|
|
npm run lint
|
|
|
|
# Tests
|
|
npm run test
|
|
|
|
# Cobertura
|
|
npm run test:cov
|
|
```
|
|
|
|
## Patrones Requeridos
|
|
|
|
1. **Multi-tenancy:** Inyectar `tenantId` en queries
|
|
2. **Guards:** Usar `TenantGuard` en controllers
|
|
3. **DTOs:** Validar con class-validator
|
|
4. **Tests:** Minimo 80% cobertura por modulo
|
|
5. **Swagger:** Documentar todos los endpoints
|
|
|
|
## Modulos POS Principales
|
|
|
|
| Modulo | Descripcion |
|
|
|--------|-------------|
|
|
| auth | Autenticacion JWT |
|
|
| tenants | Multi-tenancy |
|
|
| products | Catalogo de productos |
|
|
| inventory | Control de inventario |
|
|
| sales | Punto de venta |
|
|
| customers | Clientes y fiados |
|
|
| orders | Pedidos |
|
|
| payments | Stripe, MercadoPago, Clip |
|
|
| reports | Analytics y reportes |
|
|
|
|
## Referencias
|
|
|
|
- `@MC_DEF_ENTITIES` - ENTITIES-CATALOG.md
|
|
- `@MC_DEF_SERVICES` - SERVICES-CATALOG.md
|
|
- `@MC_INV_BE` - BACKEND_INVENTORY.yml
|
|
- `@WS_PERFIL_BACKEND_EXPRESS` - Perfil padre
|