diff --git a/README.md b/README.md
index e5ead61..4b684e8 100644
--- a/README.md
+++ b/README.md
@@ -27,23 +27,11 @@ SQL lives in `src/sql/
.js`. Schema DDL: `src/schema.js` / `import 'libdas
| Method | Signature | Returns |
| --- | --- | --- |
-| `create` | `({ iso639, name, taxrate, reducedtaxrate })` | result |
-| `update` | `(id, { iso639, name, taxrate, reducedtaxrate })` | result |
+| `create` | `({ iso639, name, taxrate, reducedtaxrate })` | `{ id, root_category_id, language_id, taxrate_id, reducedtaxrate_id, taxfreerate_id }` |
+| `update` | `(id, { iso639, name, taxrate, reducedtaxrate })` | `{ id, root_category_id, language_id, taxrate_id, reducedtaxrate_id, taxfreerate_id }` |
| `delete` | `(companyId)` | `void` |
-| `list` | `()` | `result[]` |
+| `list` | `()` | `{ id, root_category_id, language_id, taxrate_id, reducedtaxrate_id, taxfreerate_id }[]` |
-### result (`create` / `update` / `list` items)
-
-```ts
-{
- id: number // company id
- root_category_id: number
- language_id: number // language.id for iso639
- taxrate: number // tax.id
- reducedtaxrate: number // tax.id
- taxfreerate: number // tax.id (rate 0; unchanged on update)
-}
-```
### `create` (transaction)
@@ -51,7 +39,7 @@ 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` → `taxfreerate`
+3. Ensures tax rows for `taxrate`, `reducedtaxrate`, and `0` → `taxfreerate_id`
4. Creates root category (`parent_id = null`)
5. Inserts company with all FKs set
@@ -62,7 +50,7 @@ For `PATCH /api/company/:id`:
1. Fails if company missing / name taken by another company
2. Ensures lang + tax rates
3. Updates `name`, `default_language_id`, `taxrate`, `reducedtaxrate`
- (`taxfreerate` / root category unchanged)
+ (`taxfreerate_id` / root category unchanged)
---
diff --git a/src/sql/company.js b/src/sql/company.js
index daa1fc4..188938b 100644
--- a/src/sql/company.js
+++ b/src/sql/company.js
@@ -45,9 +45,9 @@ SELECT
id,
root_category_id,
default_language_id AS language_id,
- taxrate,
- reducedtaxrate,
- taxfreerate
+ taxrate AS taxrate_id,
+ reducedtaxrate AS reducedtaxrate_id,
+ taxfreerate AS taxfreerate_id
FROM company
`;
diff --git a/src/store/company/create.js b/src/store/company/create.js
index ce90c96..7f46975 100644
--- a/src/store/company/create.js
+++ b/src/store/company/create.js
@@ -48,9 +48,9 @@ export default function create(pool) {
id: result.recordset[0].id,
root_category_id: rootCategoryId,
language_id: languageId,
- taxrate: taxrateId,
- reducedtaxrate: reducedtaxrateId,
- taxfreerate: taxfreerateId,
+ taxrate_id: taxrateId,
+ reducedtaxrate_id: reducedtaxrateId,
+ taxfreerate_id: taxfreerateId,
};
} catch (err) {
try {
diff --git a/src/store/company/update.js b/src/store/company/update.js
index e3bd9c8..c39b9b5 100644
--- a/src/store/company/update.js
+++ b/src/store/company/update.js
@@ -47,9 +47,9 @@ export default function update(pool) {
id,
root_category_id: company.root_category_id,
language_id: languageId,
- taxrate: taxrateId,
- reducedtaxrate: reducedtaxrateId,
- taxfreerate: company.taxfreerate,
+ taxrate_id: taxrateId,
+ reducedtaxrate_id: reducedtaxrateId,
+ taxfreerate_id: company.taxfreerate,
};
} catch (err) {
try {