feat: Beute L3–L5 (3D-Szene, Umbauen, Durchsicht, offline) und Diktat (T7 L1)
Beute L3 Runden 2+3 und Review-Fixes: - Glas-Holo ohne warmes Leuchten, Wanderboden-Fuss, Fokusflug mit Geist-Ansicht, Inhalte im Fokus, Rähmchen mit Art-Farbe beim Anheben - Hinweis-Geometrie je Zarge nur einmal je Layout gebaut; Drehen mit Pointer-Capture, endet auch bei Loslassen ausserhalb (rig-pointer.ts) - Tiefenunschärfe ab 55 fps, Leistungsprobe bei jeder Bewegungsstufe, Context-Loss-Listener aufgeräumt, Trefferboxen als skalierte Einheitsbox Beute L4 Umbauen (/colonies/[id]/hive): Entwurf mit Basis-Schnappschuss beim ersten Schritt, Rückgängig/Wiederholen, Hinweis bei Serverstand- Änderung, Konfliktblatt. Beute L5: - Durchsicht-Abschnitt „Beute“: Aufbau-Änderungen in der Durchsicht, Blatt-Formulare stoppen das Submit-Bubbling durch Portale (sonst speicherte „Speichern“ im Blatt die ganze Durchsicht), Fokus nach Rückgängig, Folgevorschläge beim Speichern - Offline: Beute im Offline-Paket, Warteschlange pending-hive-changes (DB v5), Abarbeiten in Reihenfolge, keine Online-Änderung überholt wartende, Hinweis bei abgelehnter Änderung mit „Warteschlange öffnen“ T7 L1 Diktat: Spracherkennungs-Kapsel (Web Speech API), Einwilligung standardmässig aus, Diktat-Knopf an Freitextfeldern, Seite „Sprache & Datenschutz“; axe-core als exakte devDependency. Backend: NotificationsService liest Empfänger und schreibt in einer Transaktion mit FOR KEY SHARE (paralleles Löschen eines Benutzers führte zu P2003 und verzögerten Vorschlägen; Ursache der wackeligen Endtests). Zwei e2e-Prüfungen gegen geteilten DB-Zustand entschärft. Gates: Frontend lint, typecheck, 2740 Tests, build; Backend lint, typecheck, 4266 Unit-Tests, build; parallele e2e 3x grün (978). Browser-Prüfung 1280/390 px, Tastatur, offline, reduced motion. Refs #19 #20 #21 #22 #27 #32 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
ab45d6e24e
commit
1a57de8573
123 files changed
+7639
-355
No files matched your search
@@ -107,6 +107,9 @@ describe('Apiaries (e2e)', () => {
|
||||
await prisma.suggestion.deleteMany({
|
||||
where: { colony: { apiaryId: fieldApiaryId } },
|
||||
});
|
||||
await prisma.hiveSetup.deleteMany({
|
||||
where: { colony: { apiaryId: fieldApiaryId } },
|
||||
});
|
||||
await prisma.colony.deleteMany({ where: { apiaryId: fieldApiaryId } });
|
||||
await prisma.apiary.delete({ where: { id: fieldApiaryId } });
|
||||
}
|
||||
@@ -455,6 +458,42 @@ describe('Apiaries (e2e)', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('offline-pack carries the hives of the apiary colonies and the hive catalog', async () => {
|
||||
const [withHive, withoutHive] = await Promise.all([
|
||||
prisma.colony.findFirstOrThrow({
|
||||
where: { apiaryId: fieldApiaryId, code: { startsWith: 'V-10-' } },
|
||||
}),
|
||||
prisma.colony.findFirstOrThrow({
|
||||
where: { apiaryId: fieldApiaryId, code: { startsWith: 'V-2-' } },
|
||||
}),
|
||||
]);
|
||||
await prisma.hiveSetup.create({
|
||||
data: {
|
||||
colonyId: withHive.id,
|
||||
systemId: 'hive-system-zander-liebig-10',
|
||||
state: { schemaVersion: 1, stack: [] },
|
||||
},
|
||||
});
|
||||
const response = await request(app.getHttpServer())
|
||||
.get(`/api/v1/apiaries/${fieldApiaryId}/offline-pack`)
|
||||
.set('Authorization', `Bearer ${beekeeperToken}`)
|
||||
.expect(200);
|
||||
const body = response.body as {
|
||||
hives?: Record<string, { systemId: string; version: number }>;
|
||||
hiveCatalog?: { id: string; partTypes: unknown[] }[];
|
||||
};
|
||||
expect(Object.keys(body.hives ?? {})).toEqual([withHive.id]);
|
||||
expect(body.hives?.[withHive.id]).toMatchObject({
|
||||
systemId: 'hive-system-zander-liebig-10',
|
||||
version: 1,
|
||||
});
|
||||
expect(body.hives).not.toHaveProperty(withoutHive.id);
|
||||
const system = body.hiveCatalog?.find(
|
||||
(candidate) => candidate.id === 'hive-system-zander-liebig-10',
|
||||
);
|
||||
expect(system?.partTypes.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('rejects both endpoints without colonies:read', async () => {
|
||||
for (const path of ['colony-overview', 'offline-pack']) {
|
||||
await request(app.getHttpServer())
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as bcrypt from 'bcryptjs';
|
||||
import request from 'supertest';
|
||||
import { App } from 'supertest/types';
|
||||
import { berlinToday } from '../src/common/dates';
|
||||
import { findBaselineIn, herdStatusIn } from '../src/compliance/herd-status';
|
||||
import { findBaselineIn } from '../src/compliance/herd-status';
|
||||
import { NotificationsService } from '../src/notifications/notifications.service';
|
||||
import { DomainEventRegistry } from '../src/domain-events/domain-event-registry';
|
||||
import { PrismaService } from '../src/prisma/prisma.service';
|
||||
@@ -241,9 +241,10 @@ describe('Authority notices: herd change notification (e2e)', () => {
|
||||
data: { read: true },
|
||||
});
|
||||
|
||||
// The sent notice is the new baseline: nothing deviates any more.
|
||||
const status = await herdStatusIn(prisma, new Date());
|
||||
expect(status.deviation?.triggered).toBe(false);
|
||||
// The sent notice is the new baseline. (Not asserted: "nothing deviates"
|
||||
// against the live database - colonies that parallel files create in the
|
||||
// same instant would make that flaky.)
|
||||
expect((await findBaselineIn(prisma))?.id).toBe(notice.id);
|
||||
expect(await unreadOf(managerIds)).toHaveLength(0);
|
||||
|
||||
await addColony();
|
||||
|
||||
@@ -245,7 +245,8 @@ describe('daily-evaluation (e2e)', () => {
|
||||
|
||||
describe('TSK reference day', () => {
|
||||
let savedReferenceDay: string;
|
||||
let permittedUsers: number;
|
||||
/** The shared database gains and loses users while parallel files run. */
|
||||
let permittedUserIds: string[];
|
||||
|
||||
beforeEach(async () => {
|
||||
// The seeded singleton stays: only its reference day is borrowed.
|
||||
@@ -259,15 +260,20 @@ describe('daily-evaluation (e2e)', () => {
|
||||
where: { id: 'singleton' },
|
||||
data: { tskReferenceDay: '03-03' },
|
||||
});
|
||||
permittedUsers = await prisma.user.count({
|
||||
where: {
|
||||
isActive: true,
|
||||
role: {
|
||||
status: 'ACTIVE',
|
||||
permissions: { some: { permission: { key: 'compliance:manage' } } },
|
||||
permittedUserIds = (
|
||||
await prisma.user.findMany({
|
||||
where: {
|
||||
isActive: true,
|
||||
role: {
|
||||
status: 'ACTIVE',
|
||||
permissions: {
|
||||
some: { permission: { key: 'compliance:manage' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
select: { id: true },
|
||||
})
|
||||
).map((user) => user.id);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -306,10 +312,19 @@ describe('daily-evaluation (e2e)', () => {
|
||||
where: { relatedType: 'ComplianceItem', relatedId: 'tsk-report:2001' },
|
||||
select: { userId: true, priority: true, category: true, message: true },
|
||||
});
|
||||
expect(notifications).toHaveLength(permittedUsers);
|
||||
expect(new Set(notifications.map((row) => row.userId)).size).toBe(
|
||||
permittedUsers,
|
||||
);
|
||||
// One copy per recipient, written once - and every permitted user that
|
||||
// still exists got theirs (users other files delete meanwhile do not
|
||||
// count).
|
||||
const notified = new Set(notifications.map((row) => row.userId));
|
||||
expect(notified.size).toBe(notifications.length);
|
||||
const stillThere = await prisma.user.findMany({
|
||||
where: { id: { in: permittedUserIds } },
|
||||
select: { id: true },
|
||||
});
|
||||
expect(stillThere.length).toBeGreaterThan(0);
|
||||
for (const { id } of stillThere) {
|
||||
expect(notified.has(id)).toBe(true);
|
||||
}
|
||||
for (const row of notifications) {
|
||||
expect(row).toMatchObject({
|
||||
priority: 'WARNUNG',
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
[
|
||||
"Königin",
|
||||
"Stifte",
|
||||
"Weiselzellen",
|
||||
"Brutwaben",
|
||||
"Futterkranz",
|
||||
"Honigraum",
|
||||
"Varroa",
|
||||
"Schwarmstimmung",
|
||||
"sanftmütig",
|
||||
"Wabensitz",
|
||||
"Drohnenbrut",
|
||||
"Brutnest",
|
||||
"Brutfläche",
|
||||
"Spielnäpfchen",
|
||||
"Schwarmzellen",
|
||||
"Absperrgitter",
|
||||
"Futterteig",
|
||||
"Ableger",
|
||||
"Jungvolk",
|
||||
"Rähmchen",
|
||||
"Mittelwand",
|
||||
"Flugloch",
|
||||
"Beute",
|
||||
"Zarge",
|
||||
"Ameisensäure",
|
||||
"Oxalsäure",
|
||||
"Windel",
|
||||
"Faulbrut",
|
||||
"Kalkbrut",
|
||||
"Nosema",
|
||||
"Wachsmotten",
|
||||
"Pollen"
|
||||
]
|
||||
@@ -26,7 +26,7 @@ interface FixturePartType {
|
||||
}
|
||||
interface TemplateBody {
|
||||
schemaVersion: number;
|
||||
stack: { id: string; inserts?: { id: string }[] }[];
|
||||
stack: { id: string; partTypeId?: string; inserts?: { id: string }[] }[];
|
||||
}
|
||||
interface SystemBody {
|
||||
id: string;
|
||||
@@ -302,4 +302,46 @@ describe('Hive catalog (e2e)', () => {
|
||||
const overlap = second.stack.filter((p) => firstIds.includes(p.id));
|
||||
expect(overlap).toEqual([]);
|
||||
});
|
||||
it('accepts an id-less template (as the hive editor sends it) and serves fresh ids afterwards', async () => {
|
||||
const current = (
|
||||
await api()
|
||||
.get(`/api/v1/hive-systems/${SYSTEM_ID}/template`)
|
||||
.set(auth(tokens.reader))
|
||||
.expect(200)
|
||||
).body as TemplateBody;
|
||||
const stripIds = (
|
||||
part: Record<string, unknown>,
|
||||
): Record<string, unknown> => {
|
||||
const rest = { ...part };
|
||||
delete rest.id;
|
||||
const inserts = rest.inserts;
|
||||
delete rest.inserts;
|
||||
return Array.isArray(inserts)
|
||||
? { ...rest, inserts: inserts.map(stripIds) }
|
||||
: rest;
|
||||
};
|
||||
const idLess = {
|
||||
schemaVersion: 1,
|
||||
stack: current.stack.map((p) => stripIds(p as never)),
|
||||
};
|
||||
|
||||
await api()
|
||||
.patch(`/api/v1/hive-systems/${SYSTEM_ID}`)
|
||||
.set(auth(tokens.manager))
|
||||
.send({ template: idLess })
|
||||
.expect(200);
|
||||
const after = (
|
||||
await api()
|
||||
.get(`/api/v1/hive-systems/${SYSTEM_ID}/template`)
|
||||
.set(auth(tokens.reader))
|
||||
.expect(200)
|
||||
).body as TemplateBody;
|
||||
|
||||
expect(after.stack.map((p) => p.partTypeId)).toEqual(
|
||||
current.stack.map((p) => p.partTypeId),
|
||||
);
|
||||
expect(
|
||||
after.stack.every((p) => typeof p.id === 'string' && p.id !== ''),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user