This commit is contained in:
seb
2026-10-10 18:17:14 +02:00
parent 004e0de869
commit a20668cd61
31 changed files with 572 additions and 76 deletions

View File

@@ -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
};