P1 (backend) — Partes de trabajo + conversión idempotente a factura - #2
Merged
Conversation
…(P1 backend) ES -- El 80% del trabajo de un electricista son avisos y reparaciones, no instalaciones nuevas. Este PR añade el backend de los partes de trabajo. - Entidades WorkOrder + WorkOrderLine: cliente, título, descripción, estado (pendiente→en_curso→terminado→facturado), fecha, mano de obra (horas × precio + IVA) y líneas de material en céntimos enteros. Solo tablas nuevas: la cadena de hash de facturas no se toca. - WorkOrderService::convert() reutiliza el patrón de QuoteService::convert(): el enlace convertedInvoice lo hace idempotente (convertir dos veces = misma factura). Materiales → líneas; mano de obra → una línea "Mano de obra (N h)". Se emite por InvoiceService::create(), así que hereda numeración sin huecos + el registro de la cadena y respeta el modo de facturación (ADR 0004). - WorkOrderController: CRUD + /convert, acotado al usuario; parte facturado inmutable (409). - Tests: WorkOrderServiceTest + integración que convierte dos veces y comprueba UNA sola factura (total = materiales + mano de obra), aislamiento e inmutabilidad. 91 tests, 401 aserciones. La UI móvil, las fotos y la firma del cliente van en el siguiente PR. EN -- 80% of an electrician's work is call-outs and repairs. This PR adds the work-order backend: WorkOrder + WorkOrderLine entities, an idempotent convert-to-invoice (reusing QuoteService::convert()'s convertedInvoice link — convert twice = same invoice), CRUD scoped per user, and tests (convert twice ⇒ one invoice, isolation, invoiced-immutability). New tables only; the invoice hash chain is untouched. 91 tests, 401 assertions. Mobile UI, photos and signature come next. Docs: guide 39, DEVLOG 049.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Segundo PR del PLAN-v2. Backend del P1 — partes de trabajo (el 80% del trabajo real de un electricista: avisos y reparaciones).
Qué añade
WorkOrder+WorkOrderLine: cliente, título, descripción, estado (pendiente→en_curso→terminado→facturado), fecha, mano de obra (horas × precio + IVA) y líneas de material en céntimos enteros. Solo tablas nuevas → la cadena de hash de facturas no se toca.WorkOrderService::convert()reutiliza el patrón deQuoteService::convert(): el enlaceconvertedInvoicelo hace idempotente (convertir dos veces = misma factura). Materiales → líneas; mano de obra → una línea "Mano de obra (N h)". Se emite porInvoiceService::create()→ hereda numeración sin huecos + registro de la cadena y respeta el modo de facturación (ADR 0004).WorkOrderController: CRUD +/convert, acotado al usuario; parte facturado inmutable (409).Verificación
doctrine:schema:validateen sync. Frontend build verde (sin cambios).Alcance
Este PR es backend. La UI móvil, las fotos y la firma del cliente van en el siguiente PR (P1 PR2), como en el plan.
Docs: guía 39, DEVLOG 049.
🤖 Generated with Claude Code