Files
shopdb-flask/plugins/printedparts/frontend-api-snippet.js
Cam Proudlock 11c8d79ba4 Add the printedparts plugin: 3D-printed parts storefront and kiosk
Catalog with photos and append-only print-file revisions, a stock
ledger attributing every take/restock/adjust to a badge-resolved
employee, a touch kiosk (scan bin, scan badge, keypad quantity) with a
deliberately open decrement-only take endpoint, 1x0.5in CODE128 bin
labels, low-stock email alerts to selected users, roles, or addresses,
and stock/consumption/by-person reports with a cache-vs-ledger
reconcile. Ships disabled; enable per site. Contract 0.13.0 adds the
mailer and the User/Role models to the plugin surface.
2026-07-17 09:29:01 -04:00

36 lines
1.2 KiB
JavaScript

/*
* Printedparts API client snippet.
*
* Paste this printedpartsApi block into frontend/src/api/index.js (next to the
* other per-resource blocks). Then, in the generated PrintedpartsList, PrintedpartsDetail,
* and PrintedpartsForm views, delete the local printedpartsApi const and import the shared
* one instead:
*
* import { printedpartsApi } from '../../api'
*
* The scaffolded views ship with an identical inline client so they build and
* run before you touch the shared api module. This file is NOT auto-merged into
* api/index.js on purpose; that module is hand-maintained and shared.
*
* The create/update/delete calls assume matching POST/PUT/DELETE routes exist
* on the backend. The scaffolded api/routes.py only ships list and get; add the
* write endpoints when you wire up the form.
*/
export const printedpartsApi = {
list(params = {}) {
return api.get('/printedparts', { params })
},
get(itemId) {
return api.get(`/printedparts/${itemId}`)
},
create(data) {
return api.post('/printedparts', data)
},
update(itemId, data) {
return api.put(`/printedparts/${itemId}`, data)
},
remove(itemId) {
return api.delete(`/printedparts/${itemId}`)
}
}