feat(TICKET-LOGO): completed feature
This commit is contained in:
68
work/artifacts/TICKET-LOGO/02-design.md
Normal file
68
work/artifacts/TICKET-LOGO/02-design.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# TICKET-LOGO — Design
|
||||
|
||||
## Feature
|
||||
**ID:** TICKET-LOGO
|
||||
**Title:** TPV ticket header: allow custom text or logo upload
|
||||
|
||||
---
|
||||
|
||||
## Solución Propuesta
|
||||
|
||||
### Opción A: URL manual (simpler, menor riesgo)
|
||||
1. Agregar campo `logo_url` a `pos_stores` (nullable, max 500 chars)
|
||||
2. Actualizar admin para permitir editar logo URL
|
||||
3. ReceiptModal muestra `receipt.logoUrl ?? '/images/logo-main.png'`
|
||||
|
||||
### Opción B: Upload de imagen (más complejo)
|
||||
1. Crear tabla `pos_store_assets` o similar
|
||||
2. Endpoint de upload con storage (S3/local)
|
||||
3. Admin con file picker
|
||||
4. ReceiptModal con URL dinámica
|
||||
|
||||
---
|
||||
|
||||
## Recomendación: Opción A
|
||||
|
||||
**Rationale:**
|
||||
- Risk: low
|
||||
- Complejidad: mínima
|
||||
- Funcionalidad: equivalente para el usuario
|
||||
- Permite logo custom sin infraestructura de upload
|
||||
|
||||
### Cambios Requeridos
|
||||
|
||||
| Componente | Archivo | Cambio |
|
||||
|------------|---------|--------|
|
||||
| Migration | `project/migrations/XXX_pos_store_logo.js` | Agregar columna `logo_url` |
|
||||
| Route | `src/modules/pos/api/pos.routes.ts` | Agregar al schema de store |
|
||||
| Build receipt | `src/modules/pos/application/build-pos-receipt.ts` | Incluir `logoUrl` en receipt |
|
||||
| Types | `PosReceipt` type | Agregar `logoUrl` optional |
|
||||
| Admin | `apps/admin/src/app/(dashboard)/pos/page.tsx` | Campo URL para logo |
|
||||
| Receipt UI | `apps/pos/src/components/ReceiptModal.tsx` | Mostrar logo custom |
|
||||
|
||||
### Migration (pseudo-code)
|
||||
```sql
|
||||
ALTER TABLE pos_stores ADD COLUMN logo_url TEXT NULL;
|
||||
COMMENT ON COLUMN pos_stores.logo_url IS 'URL del logo custom para tickets (nullable, fallback a /images/logo-main.png)';
|
||||
```
|
||||
|
||||
### ReceiptModal Change
|
||||
```tsx
|
||||
<img
|
||||
src={receipt.logoUrl ?? '/images/logo-main.png'}
|
||||
alt="Logo"
|
||||
className="h-16 object-contain"
|
||||
/>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Testing
|
||||
1. Crear store sin logo → usa default
|
||||
2. Guardar logo URL en store → aparece en receipt
|
||||
3. Receipt con logo custom imprime correctamente
|
||||
|
||||
## Gates
|
||||
- [ ] reviewer: PENDING
|
||||
- [ ] security: PENDING
|
||||
- [ ] qa: PENDING
|
||||
Reference in New Issue
Block a user