feat: add posterminal API endpoints
- Add posterminal to STORE_NAMESPACES for timing wrappers - Create db/posterminal.js wrapper for store methods - Create routes/posterminal.js with all endpoints: - GET /api/posterminal - list terminals - PUT /api/posterminal - create terminal (name only, pin randomized) - DELETE /api/posterminal/:id - delete terminal - PUT/DELETE /api/posterminal/:id/category/:categoryId - toggle category - PUT/DELETE /api/posterminal/:id/categories - toggle all categories Closes #<issue-number>
This commit is contained in:
36
src/db/posterminal.js
Normal file
36
src/db/posterminal.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import { getStore } from './store.js';
|
||||
|
||||
export async function list(googleAuthId, companyId) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.list(googleAuthId, companyId);
|
||||
}
|
||||
|
||||
export async function upsert(googleAuthId, companyId, data) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.upsert(googleAuthId, companyId, data);
|
||||
}
|
||||
|
||||
export async function remove(googleAuthId, companyId, id) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.delete(googleAuthId, companyId, id);
|
||||
}
|
||||
|
||||
export async function setOn(googleAuthId, companyId, posterminalId, categoryId) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.setOn(googleAuthId, companyId, posterminalId, categoryId);
|
||||
}
|
||||
|
||||
export async function setOff(googleAuthId, companyId, posterminalId, categoryId) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.setOff(googleAuthId, companyId, posterminalId, categoryId);
|
||||
}
|
||||
|
||||
export async function setOnAll(googleAuthId, companyId, posterminalId) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.setOnAll(googleAuthId, companyId, posterminalId);
|
||||
}
|
||||
|
||||
export async function setOffAll(googleAuthId, companyId, posterminalId) {
|
||||
const store = await getStore();
|
||||
return store.posterminal.setOffAll(googleAuthId, companyId, posterminalId);
|
||||
}
|
||||
Reference in New Issue
Block a user