Commit Graph

47 Commits

Author SHA1 Message Date
seb
84e547660e u 2026-10-01 17:40:04 +02:00
seb
62c3e69ed4 u 2026-10-01 07:12:39 +02:00
seb
9c770d765e u 2026-09-30 23:11:04 +02:00
seb
74ed74fc68 u 2026-09-30 22:37:40 +02:00
seb
bc467e29da u 2026-09-30 21:27:27 +02:00
seb
280a45a11f u 2026-09-30 09:48:01 +02:00
seb
9885c489f0 u 2026-09-29 20:10:49 +02:00
seb
23d6742a9f u 2026-09-29 18:48:15 +02:00
seb
69bd0935cc u 2026-09-29 18:26:42 +02:00
seb
0cafa11a32 u 2026-09-27 21:01:30 +02:00
seb
cd57f21af8 u 2026-09-27 16:19:45 +02:00
seb
e7f92ebef8 u 2026-09-26 23:06:05 +02:00
seb
607e6cc0ac u 2026-09-25 12:30:45 +02:00
seb
b5255bdd17 u 2026-09-25 11:34:00 +02:00
seb
075b1f0ddc u 2026-09-22 08:35:36 +02:00
seb
dce65db435 bench 2026-09-22 08:31:01 +02:00
seb
cca131d83a sqlite 2026-09-22 07:25:16 +02:00
seb
53a20c4353 refactor: introduce database provider abstraction, isolate MSSQL layer
- Add provider contract (src/providers/provider.js): query() -> {rows,
  rowsAffected, insertId}, callback transaction(fn), exec() for stored
  procs, initialize/purge lifecycle
- Add MssqlProvider (src/providers/mssql/index.js) wrapping an mssql
  ConnectionPool with normalized results, tx commit/rollback and
  constraint-error classifiers (unique 2627/2601, FK 547)
- LibDashStore constructor now takes a provider instead of a pool
  (breaking); adds LibDashStore.create() async factory; keeps pool as
  transitional bridge until store modules are converted (see TODO.md)
- Move MSSQL-specific code into the provider: src/sql/* ->
  src/providers/mssql/queries/*, src/schema.js ->
  src/providers/mssql/schema.js, purge SQL -> purgeSql.js
- Update scripts, generate-schema-graph.js and package.json exports
  (./providers/mssql, ./providers/provider)
- Add TODO.md with the remaining provider/SQLite migration plan

No SQL or behavioral changes.
2026-09-20 13:51:01 +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
00bbd2e764 feat(schema): replace manifestarticle article_id FK with sku, rename articlesupplier sku/stock fields 2026-09-15 09:24:43 +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
91e7c03655 Record articlehistory entry on article creation 2026-08-08 10:09:02 +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
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
4833acd680 docs: add JSDoc headers to all externally exported store functions 2026-08-07 03:58:48 +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
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
b890843445 u 2026-08-02 19:01:00 +02:00
seb
12e83a7ffb Add company-scoped unit list/upsert/delete and article unit patches.
Units are isolated per company; article detail exposes full unit shape, and unused units can be deleted safely via FK NO ACTION.
2026-08-01 06:12:24 +02:00
seb
54700a145e Add article.setPricesBySku to replace POS prices for a SKU.
Gives dashback a single store call that atomically replaces all price rows for the article’s poscustomergroup.
2026-08-01 05:16:50 +02:00
seb
9be9f7f74c u 2026-08-01 05:10:03 +02:00
seb
1756dc7ef0 u 2026-08-01 03:37:45 +02:00
seb
69a24192d3 u 2026-08-01 02:15:21 +02:00
seb
59c874144b u 2026-08-01 01:59:05 +02:00
seb
671064bf3f u 2026-08-01 01:36:49 +02:00
seb
e8326e22ac u 2026-07-31 19:49:07 +02:00
seb
6b1701d4dc u 2026-07-31 18:15:15 +02:00
seb
c2e128cb55 u 2026-07-31 17:50:06 +02:00
seb
7e1e96d3cd u 2026-07-31 16:17:33 +02:00
seb
f9dec6d51a u 2026-07-31 16:06:51 +02:00