u
This commit is contained in:
@@ -11,35 +11,42 @@ export const ledger = {
|
||||
* Body: { manifestarticle_id, transaction_type, amount, transaction_text }
|
||||
* → 201 { ledger: LedgerEntry }
|
||||
*/
|
||||
// #region POST /api/ledger — add
|
||||
add(body) {
|
||||
return http('/api/ledger', { method: 'POST', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* GET /api/ledger/manifestarticle/:manifestarticleId
|
||||
* Query: ?transaction_type=...
|
||||
* → 200 { ledger: LedgerEntry[] }
|
||||
*/
|
||||
// #region GET /api/ledger/manifestarticle/:manifestarticleId — listByManifestarticleId
|
||||
listByManifestarticleId(manifestarticleId, transactionType) {
|
||||
const query = transactionType ? `?transaction_type=${encodeURIComponent(transactionType)}` : '';
|
||||
return http(`/api/ledger/manifestarticle/${encodeURIComponent(manifestarticleId)}${query}`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* GET /api/ledger/sku/:sku
|
||||
* Query: ?transaction_type=...
|
||||
* → 200 { ledger: LedgerEntry[] }
|
||||
*/
|
||||
// #region GET /api/ledger/sku/:sku — listBySku
|
||||
listBySku(sku, transactionType) {
|
||||
const query = transactionType ? `?transaction_type=${encodeURIComponent(transactionType)}` : '';
|
||||
return http(`/api/ledger/sku/${encodeURIComponent(sku)}${query}`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* GET /api/ledger
|
||||
* Query: { manifestarticle_id?, sku?, transaction_type? }
|
||||
* → 200 { ledger: LedgerEntry[] }
|
||||
*/
|
||||
// #region GET /api/ledger — list
|
||||
list(query) {
|
||||
const params = new URLSearchParams();
|
||||
if (query?.manifestarticle_id != null) params.set('manifestarticle_id', query.manifestarticle_id);
|
||||
@@ -50,4 +57,5 @@ export const ledger = {
|
||||
const qs = params.toString();
|
||||
return http(`/api/ledger${qs ? `?${qs}` : ''}`);
|
||||
},
|
||||
// #endregion
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user