- examples/fixture-invoicing/: FastAPI + Vue + Postgres demo (4-entity invoice fixture)
- cfg/sample/: wraps the fixture (managed.repos points at examples/)
- ctrl/kind-{up,down,status}.sh + per-room k8s render in soleprint/ctrl/k8s/
- build.py: relative repo paths, resilient rmtree, optional k8s render hook
- cfg/.gitignore: stop ignoring sample/ and standalone/ template rooms
Manifests render cleanly but kind cluster has not been run end-to-end yet.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
1.5 KiB
JavaScript
43 lines
1.5 KiB
JavaScript
const apiBase = import.meta.env.VITE_API_URL || "";
|
|
|
|
async function request(path, options = {}) {
|
|
const resp = await fetch(`${apiBase}${path}`, {
|
|
headers: { "Content-Type": "application/json" },
|
|
...options,
|
|
});
|
|
if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);
|
|
if (resp.status === 204) return null;
|
|
return resp.json();
|
|
}
|
|
|
|
export const api = {
|
|
listCustomers: () => request("/api/customers"),
|
|
createCustomer: (data) =>
|
|
request("/api/customers", { method: "POST", body: JSON.stringify(data) }),
|
|
deleteCustomer: (id) => request(`/api/customers/${id}`, { method: "DELETE" }),
|
|
|
|
listInvoices: (params = {}) => {
|
|
const qs = new URLSearchParams(params).toString();
|
|
return request(`/api/invoices${qs ? "?" + qs : ""}`);
|
|
},
|
|
getInvoice: (id) => request(`/api/invoices/${id}`),
|
|
createInvoice: (data) =>
|
|
request("/api/invoices", { method: "POST", body: JSON.stringify(data) }),
|
|
deleteInvoice: (id) => request(`/api/invoices/${id}`, { method: "DELETE" }),
|
|
|
|
addLineItem: (invoiceId, data) =>
|
|
request(`/api/line-items/invoices/${invoiceId}`, {
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
}),
|
|
deleteLineItem: (id) =>
|
|
request(`/api/line-items/${id}`, { method: "DELETE" }),
|
|
|
|
recordPayment: (invoiceId, data) =>
|
|
request(`/api/payments/invoices/${invoiceId}`, {
|
|
method: "POST",
|
|
body: JSON.stringify(data),
|
|
}),
|
|
deletePayment: (id) => request(`/api/payments/${id}`, { method: "DELETE" }),
|
|
};
|