Documentation
¶
Overview ¶
Package draftorder wires the admin order-builder HTTP surface: CRUD on draft orders and their line items, plus the complete action that converts a draft into a REAL order (models/order) with the same items and total.
Every handler is tenant-scoped via middleware.GetOrganization(c) + org.Namespaced(c.Context()) — the same isolation the rest of the /v1 surface uses — so a caller only ever touches its own org's drafts. Custom sub-routes pass the Namespace middleware explicitly since the REST layer only auto-namespaces default CRUD.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Complete ¶
Complete converts a draft order into a real order: it builds one order line per draft line (server-authoritative unit price), sets the order total to the projected draft total, creates the order, and marks the draft complete with a back-reference to the order it produced.
Money action, so it is admin-gated INSIDE the handler (the route middleware no-ops on the IAM path). Idempotent: completing an already-completed draft returns its existing order rather than creating a second one.
Types ¶
This section is empty.