Files
dashlibstorage/API.unit.md
seb aefd97a171 Rewrite store JSDoc, split quote/order into modules, and generate typed API docs
- Rewrite JSDoc across all store methods to document the actual async
  methods (real params, returns, throws) instead of the internal wrappers
- Split quote/order into individual module files backed by shared
  manifestDoc helpers; remove the createStore factory and thin wrappers
- Deduplicate manifest line helpers into src/store/manifestLines.js
- Extend generate-api-doc.js to render parameter/return/throws types and
  emit per-namespace API.<module>.md files with an API.md index
- Regenerate all API docs
2026-08-07 06:23:17 +02:00

2.0 KiB

unit

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

unit.delete

Source: src/store/unit/delete.js

Deletes a unit for the user's selected company by its SI code.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
si string The SI code of the unit to delete.

Returns

Promise<void>

Throws

Error — If the unit is not found.

Example

await store.unit.delete(42, 'l');

unit.list

Source: src/store/unit/list.js

Lists the units available for the user's selected company.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.

Returns

Promise<Array<{id: number, si: string, basesi: string, basesifactor: number, symbol: string, name: string}>> — The units.

Example

const units = await store.unit.list(42);
// => [{ id, si, basesi, basesifactor, symbol, name }]

unit.upsert

Source: src/store/unit/upsert.js

Creates or updates a unit for the user's selected company, keyed by its SI code.

Parameters

Name Type Description
googleAuthId number The id of the Google auth user.
input object The unit input.
input.si string The SI code.
input.basesi string The base SI code.
input.basesifactor number The base SI factor (must be > 0).
input.symbol string The unit symbol.
input.name string The unit name.

Returns

Promise<{id: number, si: string, basesi: string, basesifactor: number, symbol: string, name: string}> — The upserted unit.

Throws

Error — If the unit is invalid.

Example

const unit = await store.unit.upsert(42, { si: 'l', basesi: 'm3', basesifactor: 0.001, symbol: 'L', name: 'Liter' });
// => { id, si, basesi, basesifactor, symbol, name }