refactor(api): update manifest line schema docs with name and pu, update deliveryParsePdf model

This commit is contained in:
seb
2026-09-16 17:04:32 +02:00
parent ed36c534b9
commit ab6d018a1f
15 changed files with 142 additions and 70 deletions

View File

@@ -81,9 +81,8 @@ export function register(app, basePath = '') {
* Creates a goods receipt with header and lines in one transaction.
* The manifest `number` is allocated automatically via
* `nextNumber('delivery')`; the user-supplied reference is stored as
* `externalNumber`. Each line requires `sku`, `amount`, `net`, and
* `tax` (rate). `rebate` defaults to `0`; `transactedAmount` defaults
* to `amount`.
* `externalNumber`. Each line requires `sku` or `name`, `amount`, `net`, and
* `tax` (rate). `pu` defaults to `1`; `rebate` defaults to `0`.
* security:
* - cookieAuth: []
* x-markdown: delivery/create.md
@@ -114,6 +113,8 @@ export function register(app, basePath = '') {
* supplierId: 1
* lines:
* - sku: '1'
* name: 'Sample Article'
* pu: 1
* amount: 10
* net: 99.5
* tax: 19

View File

@@ -194,8 +194,9 @@ export function register(app, basePath = '') {
// ── Fetch OpenRouter API key from company settings ────────────────
let apiKey;
try {
const setting = await dbCompanySetting.getByKey(req.user.id, 'keys.openrouter');
const setting = await dbCompanySetting.getByKey(req.user.id, 'keys.openrouter', { maskWriteonly: false });
apiKey = setting?.value;
console.log('parsePDF debug: user=', req.user.id, 'setting=', setting ? { ...setting, value: setting.value ? `${setting.value.slice(0, 8)}... (len=${setting.value.length})` : null } : null);
} catch (err) {
console.error('parsePDF: failed to read OpenRouter key:', err);
}
@@ -356,7 +357,7 @@ export function register(app, basePath = '') {
});
// ── LLMOrbiter setup ─────────────────────────────────────────────
const model = '~openai/gpt-sol-latest';
const model = '~openai/gpt-luna-latest:floor';
const provider = new OpenRouterProvider({ apiKey });
const orbiter = new LLMOrbiter(provider, {
onStatus: (status) => sseWrite(res, 'status', { message: status }),

View File

@@ -81,7 +81,7 @@ export function register(app, basePath = '') {
* Creates a sales order with header and lines in one transaction.
* `date` is the document date (expected delivery).
* `entityId` must be a company customer (not Lieferanten/POS), or null.
* Each line requires `sku`, `amount`, `net`, and `tax` (rate); `rebate` defaults to `0`.
* Each line requires `sku` or `name`, `amount`, `net`, and `tax` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
* security:
* - cookieAuth: []
* x-markdown: order/create.md
@@ -113,6 +113,8 @@ export function register(app, basePath = '') {
* entityId: 1
* lines:
* - sku: '1'
* name: 'Sample Article'
* pu: 1
* amount: 10
* net: 99.5
* tax: 19

View File

@@ -81,7 +81,7 @@ export function register(app, basePath = '') {
* Creates a quote with header and lines in one transaction.
* `date` is the document date (valid-until).
* `entityId` must be a company customer (not Lieferanten/POS), or null.
* Each line requires `sku`, `amount`, `net`, and `tax` (rate); `rebate` defaults to `0`.
* Each line requires `sku` or `name`, `amount`, `net`, and `tax` (rate); `pu` defaults to `1`; `rebate` defaults to `0`.
* security:
* - cookieAuth: []
* x-markdown: quote/create.md
@@ -113,6 +113,8 @@ export function register(app, basePath = '') {
* entityId: 1
* lines:
* - sku: '1'
* name: 'Sample Article'
* pu: 1
* amount: 10
* net: 99.5
* tax: 19