feat: hive setup data model and API (Beute L1)
Each colony can now hold its hive setup (Ist-Zustand) as validated JSON with an append-only change log: - catalog: hive systems and part types with dimensions, placement rules and state fields; Liebig-Zander 10 seeded with fixed ids (owner's equipment incl. Bausperre, Futterzarge, Nassenheider) - pure domain module (operations, validator, derived facts) with shared JSON fixtures the frontend runs too - API: catalog (hive-systems:manage), setup create/change/history/ state at a day (colonies:read/update), 409 HIVE_CONFLICT with the current state, idempotent writes, HiveChanged event - inspections can carry hive ops saved in the same transaction - backup export/import of the new tables (backup wins per colony) - docs: ARCHITECTURE section 13, Annahmen 95-100 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
8982d0796a
commit
b48fb157c8
141 files changed
+15211
-17
No files matched your search
@@ -226,10 +226,12 @@ describe('lock keys per table', () => {
|
||||
expect(tx.$queryRaw).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('keeps the map in lock order: Apiary before Colony, the T6 tables last', () => {
|
||||
it('keeps the map in lock order: Apiary before Colony, HiveSetup right after Colony, HivePartType after HiveSetup, the T6 tables last', () => {
|
||||
expect(LOCK_ORDER).toEqual([
|
||||
'Apiary',
|
||||
'Colony',
|
||||
'HiveSetup',
|
||||
'HivePartType',
|
||||
'Suggestion',
|
||||
'Task',
|
||||
'Queen',
|
||||
@@ -262,7 +264,10 @@ describe('lock keys per table', () => {
|
||||
|
||||
it('every table of the map is lockable by id and each appears once', async () => {
|
||||
expect(new Set(LOCK_ORDER).size).toBe(LOCK_ORDER.length);
|
||||
const keyed = new Map([['NotificationPreference', 'userId']]);
|
||||
const keyed = new Map([
|
||||
['NotificationPreference', 'userId'],
|
||||
['HiveSetup', 'colonyId'],
|
||||
]);
|
||||
for (const table of LOCK_ORDER) {
|
||||
const tx = { $queryRaw: jest.fn().mockResolvedValue([]) };
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ function lockable(table: string, key = 'id') {
|
||||
const LOCKABLE_TABLES = {
|
||||
Apiary: lockable('Apiary'),
|
||||
Colony: lockable('Colony'),
|
||||
// Beute in 3D: one setup row per colony, keyed by the colony. Locked right
|
||||
// after the colony row it belongs to.
|
||||
HiveSetup: lockable('HiveSetup', 'colonyId'),
|
||||
// Catalog part types: locked while their stateSchema is changed.
|
||||
HivePartType: lockable('HivePartType'),
|
||||
Suggestion: lockable('Suggestion'),
|
||||
Task: lockable('Task'),
|
||||
Queen: lockable('Queen'),
|
||||
|
||||
Reference in new issue
Block a user