u
This commit is contained in:
@@ -33,7 +33,7 @@ ID fields in the JS API use camelCase `…Id` (DB columns stay snake_case). `goo
|
||||
|
||||
| Method | Signature | Returns |
|
||||
| --- | --- | --- |
|
||||
| `create` | `({ iso639, name, taxrate, reducedtaxrate, googleAuthId })` | `{ id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId }` |
|
||||
| `create` | `({ iso639, name, taxrate, reducedtaxrate, googleAuthId })` | `{ id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId, posCustomerGroupId }` |
|
||||
| `update` | `(id, { iso639, name, taxrate, reducedtaxrate })` | `{ id, rootCategoryId, languageId, taxrateId, reducedtaxrateId, taxfreerateId }` |
|
||||
| `delete` | `(companyId)` | `void` |
|
||||
| `list` | `(googleAuthId)` | `{ id, name, rootCategoryId, languageId, taxrate, reducedtaxrate, taxfreerate }[]` |
|
||||
@@ -46,10 +46,10 @@ For `POST /api/company`:
|
||||
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. Inserts company with all FKs set
|
||||
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`)
|
||||
|
||||
`company.poscustomergroup_id` (optional) points at the `customergroup` used for POS pricing in `getTreeForCompany` articles.
|
||||
`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.
|
||||
|
||||
### `list`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user