seahaven-ap/packages/api/openapi/paths/invoices-id-lines.yaml
Adam Moussa 864531b51e
feat(api): portal contract, cookie auth, and domain stubs (AP-51) (#64)
* feat(api): serve portal-shaped health and error envelope

Move liveness to GET /api/health { stage, sha } with a Node 24 image on 8080 so ALB probes and deploy verify do not need auth or a database ping.

* feat(api): switch live auth to host cookie BFF

Replace Bearer as the documented session path with Cognito hosted UI plus __Host-ap_* cookies so the SPA can call /api with credentials include.

* feat(web): add unused cookie SPA API client

Land a credentials-include fetch helper and hand-synced health/me types without wiring pages or domain hooks, so mocks stay the default data path.

* feat(api): add master-data OpenAPI and Hono stubs

* feat(api): add invoice, line, and document stubs

* feat(api): add approval policy, inbox, and activity stubs

* test(web): fix SPA client fetch mock types

* test(web): cast fetch mock call args for tsc

* fix(api): do not default DEV_AUTH_BYPASS outside local migrate

* fix(api): replace invoice lines in a single transaction

* fix(api): create invoices and lines in one transaction

* fix(api): inline GIT_SHA from the image build arg

* fix(api): stop PATCH from skipping the approval workflow

* fix(api): address review feedback

* fix(ci): format upsert-user test

* fix(api): document only the auth statuses the routes return

* fix(api): drop health 400 responses the routes never return
2026-09-25 22:43:44 +00:00

123 lines
3.3 KiB
YAML

parameters:
- name: id
in: path
required: true
description: Invoice primary key.
schema:
type: string
format: uuid
example: 88888888-8888-4888-8888-888888888888
post:
tags: [Invoices]
summary: Add an invoice line
description: Appends one coding line. Sum is checked on replace, not on this add.
operationId: post-api-invoices-id-lines
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [description, amount]
properties:
description:
type: string
example: Extra coding
amount:
type: string
example: "25.00"
glAccountId:
type: string
format: uuid
example: 66666666-6666-4666-8666-666666666666
departmentId:
type: string
format: uuid
example: 77777777-7777-4777-8777-777777777777
responses:
"201":
description: Created line.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/InvoiceLine
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks write:invoices.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"404":
description: Invoice not found.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
put:
tags: [Invoices]
summary: Replace invoice lines
description: Replaces every coding line. The amounts must sum to the invoice amount.
operationId: put-api-invoices-id-lines
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
type: object
required: [description, amount]
properties:
description:
type: string
example: Labor
amount:
type: string
example: "1250.00"
glAccountId:
type: string
format: uuid
departmentId:
type: string
format: uuid
responses:
"200":
description: Replaced lines.
content:
application/json:
schema:
type: object
required: [items]
properties:
items:
type: array
items:
$ref: ../components/schemas.yaml#/InvoiceLine
"400":
description: Validation failed.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"403":
description: Caller lacks write:invoices.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error
"404":
description: Invoice not found.
content:
application/json:
schema:
$ref: ../components/schemas.yaml#/Error