Commit Graph

94 Commits

Author SHA1 Message Date
seb
cfb7f86f0e feat: add hash and thumbnail columns to file, sort column and order method to manifestattachment 2026-09-18 01:21:54 +02:00
seb
980eda629b u 2026-09-17 12:36:37 +02:00
seb
af52ff595f feat(articlesupplier): add sort column, reorder method, and update queries and schema 2026-09-17 12:00:41 +02:00
seb
4c196c7209 feat(articlesupplier): implement store methods, schema constraints, and embed in getBySku 2026-09-17 11:41:13 +02:00
seb
1fafeeb5f2 refactor(manifestLines): standardize on taxrate and change schema type to float 2026-09-17 11:02:44 +02:00
seb
5a7773df79 docs: expand input and output object types in API signatures 2026-09-16 17:45:46 +02:00
seb
9b1b7615e2 refactor(manifestLines): standardize on tax and remove taxrate alias 2026-09-16 17:04:08 +02:00
seb
8f23dd8c75 feat: manage files via manifestattachment with auth and cascade trigger, format API.md method signatures 2026-09-16 16:49:59 +02:00
seb
8b97948a75 refactor(manifestLines): remove customname migration fallback 2026-09-16 10:15:39 +02:00
seb
7b3d2141fa feat(schema): rename manifestarticle customname to name, add pu, and use taxrate 2026-09-16 10:05:24 +02:00
seb
63f83b6822 ncu 2026-09-15 09:34:48 +02:00
seb
00bbd2e764 feat(schema): replace manifestarticle article_id FK with sku, rename articlesupplier sku/stock fields 2026-09-15 09:24:43 +02:00
seb
e56f725bd9 feat(companysetting): add writeonly column and mask values for GUI 2026-09-15 08:48:24 +02:00
seb
2e16a22c99 feat(schema): add articlesupplier table and manifestarticle custom sku/name fields 2026-09-14 22:43:03 +02:00
seb
af416246b4 feat(article): add article import with V/K compound linking
Add article.importRows to create articles by SKU from CSV-style rows,
running in two passes so fatherSku links to rows later in the file still
resolve. Existing SKUs are skipped, duplicate EANs are dropped, prices and
taxes are ensured, brands are upserted by name, and parent categories are
resolved/created via breadcrumb path.

Also add:
- article.setFatherBySku to link/unlink a child to its father article
- category.ensureByPath to resolve or create categories by path (tx-aware)
- supporting SQL constants (GET_ID_BY_SKU, EAN_EXISTS, father-link helpers,
  GET_BY_PARENT_AND_NAME)
- regenerated API docs
2026-08-11 05:36:07 +02:00
seb
fb88cb92a5 Auto-allocate delivery number via getnextnumberwithprefixandpadding 2026-08-08 10:09:08 +02:00
seb
91e7c03655 Record articlehistory entry on article creation 2026-08-08 10:09:02 +02:00
seb
53acc6a8ff Use dark color scheme for schema graph in browser preview 2026-08-08 10:08:56 +02:00
seb
29099b2a16 feat(manifest): add externalNumber reference to quote/order/delivery
- Add `external_number NVARCHAR(100)` column to the `manifest` table.
- Thread `externalNumber` through manifestDoc and delivery SQL (list,
  header, create, update).
- Include `externalNumber` in shapeSummary and quote/order/delivery
  create/update/list/getById handlers (optional, clearable on update).
- Update README type definitions and regenerate API/schema docs.
2026-08-08 09:13:20 +02:00
seb
f302cda39e feat(numbers): add number sequences store; restrict companysetting keys
- Add `numbers` store module with `list` and `update` methods backed by
  the `numbers` table (prefix, padding, next) per company.
- Add sql queries LIST_BY_COMPANY, GET_BY_COMPANY_AND_ID, UPDATE_...
- Regenerate and wire API docs for `numbers`.

companysetting:
- Remove the `delete` endpoint (settings are now upsert/read only).
- Restrict `set` to a fixed allow-list of keys:
  ui.theme, keys.tavily, keys.openrouter, labelprinter.addr, labelprinter.type.
- Drop DELETE_BY_COMPANY_AND_KEY sql and the delete store file.

Docs: update README, API.md, API.companysetting.md, API.numbers.md.
2026-08-08 09:03:51 +02:00
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
seb
396389457f part1 2026-08-07 05:21:56 +02:00
seb
70e0a9ddc4 Add entity customer numbers and scope APIs via selected company.
Entity gets an optional unique-per-company number with allocate/peek/isNumberFree helpers. Company-scoped store methods no longer take companyId and resolve google_auth.selected_company instead.
2026-08-07 04:29:35 +02:00
seb
1e89e19863 docs 2026-08-07 04:05:01 +02:00
seb
4833acd680 docs: add JSDoc headers to all externally exported store functions 2026-08-07 03:58:48 +02:00
seb
c290fe8f4b Add customergroup sort with bulk order and locked implicit names.
Reorder via customergroup.order (exact id list → sort 0…n-1); block renaming POS/Lieferanten while still allowing create/update of other groups by name.
2026-08-07 03:38:01 +02:00
seb
b095ab6199 Add quote and order stores plus ledger hash_version.
Mirror delivery on manifest for quote/order with customer entityId (excluding Lieferanten/POS), and support entity.list role=customer for pickers.
2026-08-06 19:58:35 +02:00
seb
ae549fd022 Add ledger, address/contact sort, and tighter schema-graph layout.
Replace manifestarticle.transactedamount with an append-only ledger, add sort on entity address/contact, and allow same-rank FKs with crossing-aware exits in the graph.
2026-08-06 07:39:48 +02:00
seb
3b77a1c946 Add entity address/contact tables and CRUD for entity resources 2026-08-06 05:43:50 +02:00
seb
0b7e40ac9c Add company-scoped delivery store on manifest 2026-08-06 05:32:48 +02:00
seb
4f46967f28 Add supplier CRUD on entity with Lieferanten group and entityhistory 2026-08-06 03:56:32 +02:00
seb
561ba5bb99 Store Google profile picture bytes on google_auth 2026-08-05 11:08:06 +02:00
seb
d1eb2716ae Link articlehistory to companyuser; store Google picture and sub on google_auth 2026-08-05 10:57:50 +02:00
seb
46c85fe29e Add articlehistory on updateBySku and getHistoryBySku 2026-08-05 09:17:17 +02:00
seb
530efa4f09 slugify 2026-08-04 01:29:12 +02:00
seb
82c61e599d export 2026-08-04 01:24:27 +02:00
seb
d313fc7a85 Rewrite article API docs with explicit TypeScript-style types
Every method now shows typed signatures and return types. New
SearchIndexEntry and ArticleDetail types replace the old vague
shorthand. All prose paragraphs reference ArticleDetail instead of
"same shape as getBySku".
2026-08-03 22:38:28 +02:00
seb
a645c91460 Fix listSearchIndex return type in README table 2026-08-03 22:35:05 +02:00
seb
c8b1a73b62 Add categoryIds to article.listSearchIndex response 2026-08-03 22:33:46 +02:00
seb
84bb561031 Add article.listSearchIndex for client-side search preload
Returns all company articles with id, sku, name, and eans as a flat
array. Walks the category tree to find reachable articles. Single
query using recursive CTE + FOR JSON for eans.
2026-08-03 22:31:36 +02:00
seb
eaf4df4f5a Require at least one category when setting article categories
Prevents articles from becoming unreachable by rejecting empty
categoryIds arrays in setCategoryIdsBySku.
2026-08-03 08:51:20 +02:00
seb
14d8a4c978 Merge getBySku into single SQL query with FOR JSON sub-queries
Replaces 6 round-trips (1 sequential resolve + 5 parallel detail)
with one query. Auth resolution, article detail, categories, photos,
eans, and prices are all fetched in a single round-trip.
2026-08-03 08:39:17 +02:00
seb
b3ef24f34a Extend GET_CATEGORY_ID_BY_HASH to resolve categorypic hashes directly 2026-08-03 07:59:09 +02:00
seb
6128fc59fd Add category image add/delete with categorypic SQL layer 2026-08-03 07:38:14 +02:00
seb
f8e52549d6 Fix posterminal token uniqueness for nullable column
Replace inline UNIQUE constraint with filtered unique index on token
column to allow multiple NULL values while maintaining uniqueness
for non-NULL tokens.
2026-08-03 07:13:36 +02:00
seb
829ab19f59 Add name column to posterminal table
- Added required name NVARCHAR(255) NOT NULL column to posterminal schema
- Updated SQL queries (LIST_BY_COMPANY, GET_BY_ID, CREATE, UPDATE) to include name
- Updated upsert store method to validate and persist name
- Updated README with name in method signatures and return types
2026-08-03 06:32:25 +02:00
seb
e7c43ab4e7 Remove ?companyId query params from route cheatsheet
Company ID is derived from the auth token cookie, not query params.
2026-08-03 06:20:22 +02:00
seb
831bf52c14 Add POS terminal category visibility system
Add posterminal and posterminalcategory tables to control which categories
are visible on each POS terminal. The existence of a row in
posterminalcategory means the category is visible on that terminal.

Store methods:
- posterminal.list/upsert/delete - CRUD for terminals
- posterminal.setOn/setOff - toggle single category on a terminal
- posterminal.setOnAll/setOffAll - toggle all categories on a terminal
- posterminal.getCategoryPosterminalIds - internal, used by category tree

The category tree (getTreeForCompany) now includes a posterminalIds array
on each node listing which terminals have that category enabled.
2026-08-03 06:14:25 +02:00
seb
3b06c3117d u 2026-08-03 03:57:16 +02:00
seb
d8d66ce105 Add category.move to reparent a category.
Validates both source and target via resolveCategoryAccess so the new
parent must be a category of the same authorized company, and guards
against moving into a descendant (cycle). Assigns next sibling sort.
2026-08-03 03:01:02 +02:00