Files
shopdb-flask/plugins/printedparts/frontend-api-snippet.js
cproudlock 8dd1fadeca
Some checks failed
CI / backend (push) Failing after 1m38s
CI / naming (push) Successful in 1s
CI / frontend (push) Successful in 7s
CI / migrations-mysql (push) Failing after 8s
printedparts stage 1: scaffold, no AssetType, manifest per spec
flask plugin new output, minus the scaffold's AssetType seeding:
printed parts are quantity-based consumables, not ADR-001 assets.
on_install seeds the three plugin settings instead. Manifest pins
core >=0.11.0, depends on employees (badge name resolution), ships
disabled until a site opts in.
2026-07-16 16:44:54 -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}`)
}
}