Add customergroup and entity HTTP APIs with address and contact routes.
Expose store-backed CRUD for customer groups, entities, nested addresses, and contacts, matching the documented dashdbschema contracts.
This commit is contained in:
21
src/db/customergroup.js
Normal file
21
src/db/customergroup.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getStore } from './store.js';
|
||||
|
||||
export async function list(googleAuthId, companyId) {
|
||||
const store = await getStore();
|
||||
return store.customergroup.list(googleAuthId, companyId);
|
||||
}
|
||||
|
||||
export async function create(googleAuthId, companyId, data) {
|
||||
const store = await getStore();
|
||||
return store.customergroup.create(googleAuthId, companyId, data);
|
||||
}
|
||||
|
||||
export async function update(googleAuthId, companyId, id, data) {
|
||||
const store = await getStore();
|
||||
return store.customergroup.update(googleAuthId, companyId, id, data);
|
||||
}
|
||||
|
||||
export async function remove(googleAuthId, companyId, id) {
|
||||
const store = await getStore();
|
||||
return store.customergroup.delete(googleAuthId, companyId, id);
|
||||
}
|
||||
26
src/db/entity.js
Normal file
26
src/db/entity.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { getStore } from './store.js';
|
||||
|
||||
export async function list(googleAuthId, companyId, options) {
|
||||
const store = await getStore();
|
||||
return store.entity.list(googleAuthId, companyId, options);
|
||||
}
|
||||
|
||||
export async function getById(googleAuthId, companyId, id) {
|
||||
const store = await getStore();
|
||||
return store.entity.getById(googleAuthId, companyId, id);
|
||||
}
|
||||
|
||||
export async function create(googleAuthId, companyId, data) {
|
||||
const store = await getStore();
|
||||
return store.entity.create(googleAuthId, companyId, data);
|
||||
}
|
||||
|
||||
export async function update(googleAuthId, companyId, id, data) {
|
||||
const store = await getStore();
|
||||
return store.entity.update(googleAuthId, companyId, id, data);
|
||||
}
|
||||
|
||||
export async function remove(googleAuthId, companyId, id) {
|
||||
const store = await getStore();
|
||||
return store.entity.delete(googleAuthId, companyId, id);
|
||||
}
|
||||
21
src/db/entityaddress.js
Normal file
21
src/db/entityaddress.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getStore } from './store.js';
|
||||
|
||||
export async function list(googleAuthId, companyId, entityId) {
|
||||
const store = await getStore();
|
||||
return store.entityaddress.list(googleAuthId, companyId, entityId);
|
||||
}
|
||||
|
||||
export async function create(googleAuthId, companyId, entityId, data) {
|
||||
const store = await getStore();
|
||||
return store.entityaddress.create(googleAuthId, companyId, entityId, data);
|
||||
}
|
||||
|
||||
export async function update(googleAuthId, companyId, entityId, id, data) {
|
||||
const store = await getStore();
|
||||
return store.entityaddress.update(googleAuthId, companyId, entityId, id, data);
|
||||
}
|
||||
|
||||
export async function remove(googleAuthId, companyId, entityId, id) {
|
||||
const store = await getStore();
|
||||
return store.entityaddress.delete(googleAuthId, companyId, entityId, id);
|
||||
}
|
||||
21
src/db/entitycontact.js
Normal file
21
src/db/entitycontact.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getStore } from './store.js';
|
||||
|
||||
export async function list(googleAuthId, companyId, entityId) {
|
||||
const store = await getStore();
|
||||
return store.entitycontact.list(googleAuthId, companyId, entityId);
|
||||
}
|
||||
|
||||
export async function create(googleAuthId, companyId, entityId, data) {
|
||||
const store = await getStore();
|
||||
return store.entitycontact.create(googleAuthId, companyId, entityId, data);
|
||||
}
|
||||
|
||||
export async function update(googleAuthId, companyId, entityId, id, data) {
|
||||
const store = await getStore();
|
||||
return store.entitycontact.update(googleAuthId, companyId, entityId, id, data);
|
||||
}
|
||||
|
||||
export async function remove(googleAuthId, companyId, entityId, id) {
|
||||
const store = await getStore();
|
||||
return store.entitycontact.delete(googleAuthId, companyId, entityId, id);
|
||||
}
|
||||
@@ -21,6 +21,10 @@ const STORE_NAMESPACES = [
|
||||
'posterminal',
|
||||
'supplier',
|
||||
'delivery',
|
||||
'customergroup',
|
||||
'entity',
|
||||
'entityaddress',
|
||||
'entitycontact',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user