feat: expand vehicle data platform capabilities

This commit is contained in:
lingniu
2026-07-27 16:46:15 +08:00
parent e3a1f80f86
commit 3c4bece72c
650 changed files with 62155 additions and 2552 deletions

View File

@@ -32,6 +32,23 @@ Saving an unchanged vehicle assignment preserves its original start time. Removi
Administrators manage `validFrom` and optional `validTo` per vehicle in account management. The API updates the active projection and its latest history interval in one transaction, validates `validTo > validFrom`, and repairs any pre-existing projection/history drift on save. The admin list reads the complete projection, including future or scheduled-to-end grants; customer principals still contain only grants active at the current database time. Each update audit stores the actor and per-VIN before/after interval.
### OneOS business scope
OneOS customer identities can use `platform_user_business_scope` instead of a manually maintained VIN list:
- `scope_level=department`: `department_ids` is a comma-separated allow-list. The session receives every VIN in the active OneOS business projection for those departments.
- `scope_level=responsible`: the session receives only VINs whose `responsible_user_id` equals the configured user.
- An enabled row with a missing or unknown scope resolves to an empty VIN set. A OneOS account without a row keeps the existing manual-grant behavior for migration compatibility.
The VIN set and the department/responsible/customer/status filter candidates are both calculated on the server. Client query parameters can only narrow this set and cannot widen it.
```sql
INSERT INTO platform_user_business_scope(user_id,scope_level,department_ids,responsible_user_id,source_updated_at)
VALUES(42,'department','40001,40002','',NOW(3))
ON DUPLICATE KEY UPDATE scope_level=VALUES(scope_level),department_ids=VALUES(department_ids),
responsible_user_id=VALUES(responsible_user_id),enabled=1,source_updated_at=VALUES(source_updated_at);
```
## Sessions and password policy
- Passwords are stored with bcrypt cost 12.
@@ -64,6 +81,7 @@ POST /api/v2/auth/login
POST /api/v2/auth/logout
PUT /api/v2/auth/password
GET /api/v2/session
GET /api/vehicles/business-filters
GET /api/v2/admin/users
POST /api/v2/admin/users