This commit is contained in:
seb
2026-10-16 22:09:15 +02:00
parent 188cd71f63
commit d7f7d669f9
13 changed files with 446 additions and 171 deletions

View File

@@ -10,15 +10,27 @@ async function formatDelivery(delivery) {
return delivery;
}
export async function list(googleAuthId) {
export async function list(googleAuthId, opts) {
const store = await getStore();
const result = await store.delivery.list(googleAuthId);
const result = await store.delivery.list(googleAuthId, opts);
if (Array.isArray(result)) {
return Promise.all(result.map(formatDelivery));
}
if (result && Array.isArray(result.deliveries)) {
const deliveries = await Promise.all(result.deliveries.map(formatDelivery));
return {
...result,
deliveries,
};
}
return result;
}
export async function rebuildSummaries(googleAuthId) {
const store = await getStore();
return store.delivery.rebuildSummaries(googleAuthId);
}
export async function getById(googleAuthId, id) {
const store = await getStore();
const delivery = await store.delivery.getById(googleAuthId, id);
@@ -42,6 +54,12 @@ export async function remove(googleAuthId, id) {
return store.delivery.delete(googleAuthId, id);
}
export async function book(googleAuthId, data) {
const store = await getStore();
const delivery = await store.delivery.book(googleAuthId, data);
return formatDelivery(delivery);
}
export async function getFile(googleAuthId, deliveryId, fileId) {
const store = await getStore();
return store.manifestattachment.getById(googleAuthId, deliveryId, fileId);
@@ -63,5 +81,3 @@ export async function removeAttachment(googleAuthId, deliveryId, fileId) {
const store = await getStore();
return store.manifestattachment.remove(googleAuthId, deliveryId, fileId);
}

View File

@@ -4,3 +4,13 @@ export async function adjust(googleAuthId, data) {
const store = await getStore();
return store.stock.adjust(googleAuthId, data);
}
export async function accept(googleAuthId, data) {
const store = await getStore();
return store.stock.accept(googleAuthId, data);
}
export async function ship(googleAuthId, data) {
const store = await getStore();
return store.stock.ship(googleAuthId, data);
}