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:
seb
2026-08-03 06:32:39 +02:00
parent b132f0c17c
commit a4b78ad6d5
3 changed files with 603 additions and 0 deletions

36
src/db/posterminal.js Normal file
View 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);
}

View File

@@ -18,6 +18,7 @@ const STORE_NAMESPACES = [
'lang',
'tax',
'google_auth',
'posterminal',
];
/**