This commit is contained in:
seb
2026-10-19 23:56:56 +02:00
parent a5eee3f3d0
commit 4b34902b92
8 changed files with 15 additions and 37 deletions

View File

@@ -42,12 +42,11 @@ Company-scoped methods take **no** `companyId` argument: they use `google_auth.s
For `POST /api/company`:
1. Fails if `name` is taken (`Company name not available`)
2. Ensures language by `iso639` (get or create)
3. Ensures tax rows for `taxrate`, `reducedtaxrate`, and `0` → `taxfreerateId`
4. Creates root category (`parentId = null`)
5. Creates POS `customergroup` (name `POS`), then inserts company with `poscustomergroup_id` (**NOT NULL**), then links the group via `customergroup.company_id`
6. Links creator as `companyuser` (`googleAuthId` → `company_id`)
1. Ensures language by `iso639` (get or create)
2. Ensures tax rows for `taxrate`, `reducedtaxrate`, and `0` → `taxfreerateId`
3. Creates root category (`parentId = null`)
4. Creates POS `customergroup` (name `POS`), then inserts company with `poscustomergroup_id` (**NOT NULL**), then links the group via `customergroup.company_id`
5. Links creator as `companyuser` (`googleAuthId` → `company_id`)
`company.poscustomergroup_id` is required (POS pricing in `getTreeForCompany` / category articles). Circular FK with `customergroup.company_id`: the group is inserted first with `company_id` null, then linked after the company row exists.
@@ -59,7 +58,7 @@ Returns only companies where `googleAuthId` has a `companyuser` row.
For `PATCH /api/company/:id`:
1. Fails if company missing / name taken by another company
1. Fails if company missing
2. Ensures lang + tax rates
3. Updates `name`, `default_language_id`, `taxrate`, `reducedtaxrate`
(`taxfreerateId` / root category unchanged)