feat(companysetting): add writeonly column and mask values for GUI
This commit is contained in:
12
README.md
12
README.md
@@ -160,13 +160,15 @@ Company-scoped key/value settings. Auth via selected company (`google_auth.selec
|
||||
|
||||
| Method | Signature | Returns |
|
||||
| --- | --- | --- |
|
||||
| `list` | `(googleAuthId, { frontendOnly? })` | `{ key, value, frontend }[]` |
|
||||
| `get` | `(googleAuthId, key, { frontendOnly? })` | `{ key, value, frontend } \| undefined` |
|
||||
| `set` | `(googleAuthId, { key, value, frontend? })` | `{ key, value, frontend }` |
|
||||
| `list` | `(googleAuthId, { frontendOnly?, maskWriteonly? })` | `{ key, value, frontend, writeonly }[]` |
|
||||
| `get` | `(googleAuthId, key, { frontendOnly?, maskWriteonly? })` | `{ key, value, frontend, writeonly } \| undefined` |
|
||||
| `set` | `(googleAuthId, { key, value, frontend?, writeonly? })` | `{ key, value, frontend, writeonly }` |
|
||||
|
||||
- `value` is always a string (`NVARCHAR(MAX)`).
|
||||
- `frontend: true` → readable by frontend routes (`frontendOnly: true`). Default on `set` is `false` (backend-only).
|
||||
- With `frontendOnly: true`, backend-only keys are omitted / `get` returns `undefined` (no leak via error type beyond missing).
|
||||
- `writeonly: true` → usergui gets a `"***"` scrambled version when retrieving the key (in `list`, or in `get` when `maskWriteonly` is enabled / `frontendOnly: true`). The backend receives the full value.
|
||||
- `keys.tavily` and `keys.openrouter` default to `writeonly: true` on `set`.
|
||||
- `set` only allows a fixed allow-list of keys: `ui.theme`, `keys.tavily`, `keys.openrouter`, `labelprinter.addr`, `labelprinter.type`.
|
||||
- No delete endpoint — settings are upsert / read only.
|
||||
|
||||
@@ -295,8 +297,8 @@ Maps articles to suppliers (`entity`) with purchase pricing, stock, packaging un
|
||||
| `article_id` | `INT` | FK → `article(id)` (`ON DELETE CASCADE`) |
|
||||
| `entity_id` | `INT` | FK → `entity(id)` (`ON DELETE CASCADE`) |
|
||||
| `price_id` | `INT` | FK → `price(id)` (`ON DELETE NO ACTION`), nullable |
|
||||
| `SupplierSKU` | `NVARCHAR(100)` | Supplier's SKU code, nullable |
|
||||
| `SupplierStock` | `FLOAT` | Stock available at supplier, nullable |
|
||||
| `supplierSKU` | `NVARCHAR(100)` | Supplier's SKU code, nullable |
|
||||
| `supplierStock` | `FLOAT` | Stock available at supplier, nullable |
|
||||
| `pu` | `FLOAT` | Packaging unit (Verpackungseinheit), default `1` |
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user