Align store calls with selected-company scoping and add entity numbers.

Drop companyId from company-scoped store wrappers and routes, add GET /entity/next-number plus optional number on entity create/update, and document dashdbschema API.md lookup in sibling-repos.
This commit is contained in:
seb
2026-08-07 06:22:13 +02:00
parent 2767568f5a
commit e6c24654dd
36 changed files with 496 additions and 189 deletions

View File

@@ -65,12 +65,12 @@ export async function setCategoryIdsBySku(googleAuthId, sku, categoryIds) {
return store.article.setCategoryIdsBySku(googleAuthId, sku, categoryIds);
}
export async function listSearchIndex(googleAuthId, companyId) {
export async function listSearchIndex(googleAuthId) {
const store = await getStore();
return store.article.listSearchIndex(googleAuthId, companyId);
return store.article.listSearchIndex(googleAuthId);
}
export async function listExport(googleAuthId, companyId, categoryId) {
export async function listExport(googleAuthId, categoryId) {
const store = await getStore();
return store.article.listExport(googleAuthId, companyId, categoryId);
return store.article.listExport(googleAuthId, categoryId);
}

View File

@@ -1,16 +1,16 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.brand.list(googleAuthId, companyId);
return store.brand.list(googleAuthId);
}
export async function upsert(googleAuthId, companyId, data) {
export async function upsert(googleAuthId, data) {
const store = await getStore();
return store.brand.upsert(googleAuthId, companyId, data);
return store.brand.upsert(googleAuthId, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.brand.delete(googleAuthId, companyId, id);
return store.brand.delete(googleAuthId, id);
}

View File

@@ -1,8 +1,8 @@
import { getStore } from './store.js';
export async function getTreeForCompany(googleAuthId, companyId) {
export async function getTreeForCompany(googleAuthId) {
const store = await getStore();
return store.category.getTreeForCompany(googleAuthId, companyId);
return store.category.getTreeForCompany(googleAuthId);
}
export async function createUnderParent({ googleAuthId, parentId, name }) {

View File

@@ -1,26 +1,26 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.customergroup.list(googleAuthId, companyId);
return store.customergroup.list(googleAuthId);
}
export async function create(googleAuthId, companyId, data) {
export async function create(googleAuthId, data) {
const store = await getStore();
return store.customergroup.create(googleAuthId, companyId, data);
return store.customergroup.create(googleAuthId, data);
}
export async function update(googleAuthId, companyId, id, data) {
export async function update(googleAuthId, id, data) {
const store = await getStore();
return store.customergroup.update(googleAuthId, companyId, id, data);
return store.customergroup.update(googleAuthId, id, data);
}
export async function order(googleAuthId, companyId, data) {
export async function order(googleAuthId, data) {
const store = await getStore();
return store.customergroup.order(googleAuthId, companyId, data);
return store.customergroup.order(googleAuthId, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.customergroup.delete(googleAuthId, companyId, id);
return store.customergroup.delete(googleAuthId, id);
}

View File

@@ -1,26 +1,26 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.delivery.list(googleAuthId, companyId);
return store.delivery.list(googleAuthId);
}
export async function getById(googleAuthId, companyId, id) {
export async function getById(googleAuthId, id) {
const store = await getStore();
return store.delivery.getById(googleAuthId, companyId, id);
return store.delivery.getById(googleAuthId, id);
}
export async function create(googleAuthId, companyId, data) {
export async function create(googleAuthId, data) {
const store = await getStore();
return store.delivery.create(googleAuthId, companyId, data);
return store.delivery.create(googleAuthId, data);
}
export async function update(googleAuthId, companyId, id, data) {
export async function update(googleAuthId, id, data) {
const store = await getStore();
return store.delivery.update(googleAuthId, companyId, id, data);
return store.delivery.update(googleAuthId, id, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.delivery.delete(googleAuthId, companyId, id);
return store.delivery.delete(googleAuthId, id);
}

View File

@@ -1,26 +1,31 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId, options) {
export async function list(googleAuthId, options) {
const store = await getStore();
return store.entity.list(googleAuthId, companyId, options);
return store.entity.list(googleAuthId, options);
}
export async function getById(googleAuthId, companyId, id) {
export async function getById(googleAuthId, id) {
const store = await getStore();
return store.entity.getById(googleAuthId, companyId, id);
return store.entity.getById(googleAuthId, id);
}
export async function create(googleAuthId, companyId, data) {
export async function create(googleAuthId, data) {
const store = await getStore();
return store.entity.create(googleAuthId, companyId, data);
return store.entity.create(googleAuthId, data);
}
export async function update(googleAuthId, companyId, id, data) {
export async function update(googleAuthId, id, data) {
const store = await getStore();
return store.entity.update(googleAuthId, companyId, id, data);
return store.entity.update(googleAuthId, id, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.entity.delete(googleAuthId, companyId, id);
return store.entity.delete(googleAuthId, id);
}
export async function peekNextNumber(googleAuthId) {
const store = await getStore();
return store.entity.peekNextNumber(googleAuthId);
}

View File

@@ -1,21 +1,21 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId, entityId) {
export async function list(googleAuthId, entityId) {
const store = await getStore();
return store.entityaddress.list(googleAuthId, companyId, entityId);
return store.entityaddress.list(googleAuthId, entityId);
}
export async function create(googleAuthId, companyId, entityId, data) {
export async function create(googleAuthId, entityId, data) {
const store = await getStore();
return store.entityaddress.create(googleAuthId, companyId, entityId, data);
return store.entityaddress.create(googleAuthId, entityId, data);
}
export async function update(googleAuthId, companyId, entityId, id, data) {
export async function update(googleAuthId, entityId, id, data) {
const store = await getStore();
return store.entityaddress.update(googleAuthId, companyId, entityId, id, data);
return store.entityaddress.update(googleAuthId, entityId, id, data);
}
export async function remove(googleAuthId, companyId, entityId, id) {
export async function remove(googleAuthId, entityId, id) {
const store = await getStore();
return store.entityaddress.delete(googleAuthId, companyId, entityId, id);
return store.entityaddress.delete(googleAuthId, entityId, id);
}

View File

@@ -1,21 +1,21 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId, entityId) {
export async function list(googleAuthId, entityId) {
const store = await getStore();
return store.entitycontact.list(googleAuthId, companyId, entityId);
return store.entitycontact.list(googleAuthId, entityId);
}
export async function create(googleAuthId, companyId, entityId, data) {
export async function create(googleAuthId, entityId, data) {
const store = await getStore();
return store.entitycontact.create(googleAuthId, companyId, entityId, data);
return store.entitycontact.create(googleAuthId, entityId, data);
}
export async function update(googleAuthId, companyId, entityId, id, data) {
export async function update(googleAuthId, entityId, id, data) {
const store = await getStore();
return store.entitycontact.update(googleAuthId, companyId, entityId, id, data);
return store.entitycontact.update(googleAuthId, entityId, id, data);
}
export async function remove(googleAuthId, companyId, entityId, id) {
export async function remove(googleAuthId, entityId, id) {
const store = await getStore();
return store.entitycontact.delete(googleAuthId, companyId, entityId, id);
return store.entitycontact.delete(googleAuthId, entityId, id);
}

View File

@@ -1,26 +1,26 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.order.list(googleAuthId, companyId);
return store.order.list(googleAuthId);
}
export async function getById(googleAuthId, companyId, id) {
export async function getById(googleAuthId, id) {
const store = await getStore();
return store.order.getById(googleAuthId, companyId, id);
return store.order.getById(googleAuthId, id);
}
export async function create(googleAuthId, companyId, data) {
export async function create(googleAuthId, data) {
const store = await getStore();
return store.order.create(googleAuthId, companyId, data);
return store.order.create(googleAuthId, data);
}
export async function update(googleAuthId, companyId, id, data) {
export async function update(googleAuthId, id, data) {
const store = await getStore();
return store.order.update(googleAuthId, companyId, id, data);
return store.order.update(googleAuthId, id, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.order.delete(googleAuthId, companyId, id);
return store.order.delete(googleAuthId, id);
}

View File

@@ -1,36 +1,36 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.posterminal.list(googleAuthId, companyId);
return store.posterminal.list(googleAuthId);
}
export async function upsert(googleAuthId, companyId, data) {
export async function upsert(googleAuthId, data) {
const store = await getStore();
return store.posterminal.upsert(googleAuthId, companyId, data);
return store.posterminal.upsert(googleAuthId, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.posterminal.delete(googleAuthId, companyId, id);
return store.posterminal.delete(googleAuthId, id);
}
export async function setOn(googleAuthId, companyId, posterminalId, categoryId) {
export async function setOn(googleAuthId, posterminalId, categoryId) {
const store = await getStore();
return store.posterminal.setOn(googleAuthId, companyId, posterminalId, categoryId);
return store.posterminal.setOn(googleAuthId, posterminalId, categoryId);
}
export async function setOff(googleAuthId, companyId, posterminalId, categoryId) {
export async function setOff(googleAuthId, posterminalId, categoryId) {
const store = await getStore();
return store.posterminal.setOff(googleAuthId, companyId, posterminalId, categoryId);
return store.posterminal.setOff(googleAuthId, posterminalId, categoryId);
}
export async function setOnAll(googleAuthId, companyId, posterminalId) {
export async function setOnAll(googleAuthId, posterminalId) {
const store = await getStore();
return store.posterminal.setOnAll(googleAuthId, companyId, posterminalId);
return store.posterminal.setOnAll(googleAuthId, posterminalId);
}
export async function setOffAll(googleAuthId, companyId, posterminalId) {
export async function setOffAll(googleAuthId, posterminalId) {
const store = await getStore();
return store.posterminal.setOffAll(googleAuthId, companyId, posterminalId);
return store.posterminal.setOffAll(googleAuthId, posterminalId);
}

View File

@@ -1,26 +1,26 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.quote.list(googleAuthId, companyId);
return store.quote.list(googleAuthId);
}
export async function getById(googleAuthId, companyId, id) {
export async function getById(googleAuthId, id) {
const store = await getStore();
return store.quote.getById(googleAuthId, companyId, id);
return store.quote.getById(googleAuthId, id);
}
export async function create(googleAuthId, companyId, data) {
export async function create(googleAuthId, data) {
const store = await getStore();
return store.quote.create(googleAuthId, companyId, data);
return store.quote.create(googleAuthId, data);
}
export async function update(googleAuthId, companyId, id, data) {
export async function update(googleAuthId, id, data) {
const store = await getStore();
return store.quote.update(googleAuthId, companyId, id, data);
return store.quote.update(googleAuthId, id, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.quote.delete(googleAuthId, companyId, id);
return store.quote.delete(googleAuthId, id);
}

View File

@@ -1,21 +1,21 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.supplier.list(googleAuthId, companyId);
return store.supplier.list(googleAuthId);
}
export async function create(googleAuthId, companyId, data) {
export async function create(googleAuthId, data) {
const store = await getStore();
return store.supplier.create(googleAuthId, companyId, data);
return store.supplier.create(googleAuthId, data);
}
export async function update(googleAuthId, companyId, id, data) {
export async function update(googleAuthId, id, data) {
const store = await getStore();
return store.supplier.update(googleAuthId, companyId, id, data);
return store.supplier.update(googleAuthId, id, data);
}
export async function remove(googleAuthId, companyId, id) {
export async function remove(googleAuthId, id) {
const store = await getStore();
return store.supplier.delete(googleAuthId, companyId, id);
return store.supplier.delete(googleAuthId, id);
}

View File

@@ -1,16 +1,16 @@
import { getStore } from './store.js';
export async function list(googleAuthId, companyId) {
export async function list(googleAuthId) {
const store = await getStore();
return store.unit.list(googleAuthId, companyId);
return store.unit.list(googleAuthId);
}
export async function upsert(googleAuthId, companyId, data) {
export async function upsert(googleAuthId, data) {
const store = await getStore();
return store.unit.upsert(googleAuthId, companyId, data);
return store.unit.upsert(googleAuthId, data);
}
export async function remove(googleAuthId, companyId, si) {
export async function remove(googleAuthId, si) {
const store = await getStore();
return store.unit.delete(googleAuthId, companyId, si);
return store.unit.delete(googleAuthId, si);
}