seahaven-ap/packages/api/openapi/openapi.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

115 lines
3.6 KiB
YAML

openapi: 3.1.0
info:
title: Sea Haven AP API
version: 1.0.0
description: "Accounts payable HTTP API for Sea Haven Industries. Liveness, cookie session, and authenticated session smoke under local and AWS runtimes."
license:
name: Proprietary
servers:
- url: http://127.0.0.1:8787
description: Local API process used by Vite proxy and unit tests.
tags:
- name: Health
description: Liveness and readiness checks for the API process.
- name: Session
description: Cookie session via Cognito hosted UI, plus caller identity after upsert.
- name: Master data
description: Vendors, GL accounts, departments, and user role updates.
- name: Invoices
description: Invoice headers, coding lines, and uniqueness rules.
- name: Documents
description: Presigned document upload, confirm, and download against MinIO or S3.
- name: Approvals
description: Approval policies, step decisions, inbox, comments, and activity.
paths:
/api/health:
$ref: ./paths/health.yaml
/api/ready:
$ref: ./paths/ready.yaml
/api/auth/login:
$ref: ./paths/auth-login.yaml
/api/auth/callback:
$ref: ./paths/auth-callback.yaml
/api/auth/refresh:
$ref: ./paths/auth-refresh.yaml
/api/auth/logout:
$ref: ./paths/auth-logout.yaml
/api/me:
$ref: ./paths/me.yaml
/api/vendors:
$ref: ./paths/vendors.yaml
/api/vendors/{id}:
$ref: ./paths/vendors-id.yaml
/api/gl-accounts:
$ref: ./paths/gl-accounts.yaml
/api/gl-accounts/{id}:
$ref: ./paths/gl-accounts-id.yaml
/api/departments:
$ref: ./paths/departments.yaml
/api/departments/{id}:
$ref: ./paths/departments-id.yaml
/api/users:
$ref: ./paths/users.yaml
/api/users/{id}:
$ref: ./paths/users-id.yaml
/api/invoices:
$ref: ./paths/invoices.yaml
/api/invoices/{id}:
$ref: ./paths/invoices-id.yaml
/api/invoices/{id}/lines:
$ref: ./paths/invoices-id-lines.yaml
/api/invoices/{id}/documents:
$ref: ./paths/invoices-id-documents.yaml
/api/documents/{id}:
$ref: ./paths/documents-id.yaml
/api/documents/{id}/confirmations:
$ref: ./paths/documents-id-confirmations.yaml
/api/approval-policies:
$ref: ./paths/approval-policies.yaml
/api/approval-policies/{id}:
$ref: ./paths/approval-policies-id.yaml
/api/approval-steps/{id}/decisions:
$ref: ./paths/approval-steps-id-decisions.yaml
/api/inbox:
$ref: ./paths/inbox.yaml
/api/invoices/{id}/comments:
$ref: ./paths/invoices-id-comments.yaml
/api/invoices/{id}/activity-logs:
$ref: ./paths/invoices-id-activity-logs.yaml
components:
securitySchemes:
cookieAuth:
$ref: ./components/security.yaml#/cookieAuth
schemas:
Error:
$ref: ./components/schemas.yaml#/Error
HealthResponse:
$ref: ./components/schemas.yaml#/HealthResponse
ReadyResponse:
$ref: ./components/schemas.yaml#/ReadyResponse
MeResponse:
$ref: ./components/schemas.yaml#/MeResponse
Vendor:
$ref: ./components/schemas.yaml#/Vendor
GlAccount:
$ref: ./components/schemas.yaml#/GlAccount
Department:
$ref: ./components/schemas.yaml#/Department
User:
$ref: ./components/schemas.yaml#/User
Invoice:
$ref: ./components/schemas.yaml#/Invoice
InvoiceLine:
$ref: ./components/schemas.yaml#/InvoiceLine
Document:
$ref: ./components/schemas.yaml#/Document
ApprovalPolicy:
$ref: ./components/schemas.yaml#/ApprovalPolicy
ApprovalStep:
$ref: ./components/schemas.yaml#/ApprovalStep
InvoiceComment:
$ref: ./components/schemas.yaml#/InvoiceComment
ActivityLog:
$ref: ./components/schemas.yaml#/ActivityLog
security:
- cookieAuth: []