u
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user