feat: platform backbone and field capture complete (checkpoint)
Platform backbone (plan 2026-10-13-plattform-rueckgrat), all tasks reviewed: - webhooks with delivery table, retries and stable delivery id - calendar handlers; a finished task removes its Outlook event - tasks, automations, inspections, varroa, treatments, feedings, harvests, colonies, wintering, stock and bottling record domain events in the same transaction; legacy post-commit calls removed - row locks through one helper (lockRowForUpdate, lockRowsForShare, lockRowsForUpdate) - job framework with JobRun, cli exit codes, cleanup, task templates, daily evaluation, hourly app-backup and the rekey job - system API and page "Verwaltung > System" with retry - @nestjs/schedule removed, guard tests against in-process schedulers Field capture T3 (plan 2026-10-13-t3-erfassung-am-stand), all tasks reviewed: - inspection photo offline without metadata - bulk capture for treatments, feedings and varroa (backend + frontend) - offline stand mode with service worker, offline pages and packs - offline session, cold start and logout on shared devices Docs: ARCHITECTURE.md assumptions and sections updated, TASKS.md. Gates: backend lint, typecheck, 1770 unit, 420 e2e, build, no schema drift; frontend lint, typecheck, 913 tests, build. Not rolled out. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
c01a38835a
commit
cdd30cf3ee
288 files changed
+39165
-2853
No files matched your search
@@ -43,6 +43,18 @@ describe('TaskTemplates (e2e)', () => {
|
||||
|
||||
afterAll(async () => {
|
||||
if (templateId) {
|
||||
const generated = await prisma.task.findMany({
|
||||
where: { sourceTemplateId: templateId },
|
||||
select: { id: true },
|
||||
});
|
||||
const generatedIds = generated.map((task) => task.id);
|
||||
// Written without a user, so not covered by the userId cleanup below.
|
||||
await prisma.auditLog.deleteMany({
|
||||
where: { entityType: 'Task', entityId: { in: generatedIds } },
|
||||
});
|
||||
await prisma.domainEvent.deleteMany({
|
||||
where: { aggregateType: 'Task', aggregateId: { in: generatedIds } },
|
||||
});
|
||||
await prisma.task.deleteMany({ where: { sourceTemplateId: templateId } });
|
||||
await prisma.taskTemplate.delete({ where: { id: templateId } });
|
||||
}
|
||||
@@ -88,15 +100,51 @@ describe('TaskTemplates (e2e)', () => {
|
||||
.set('Authorization', `Bearer ${beekeeperToken}`)
|
||||
.expect(200);
|
||||
|
||||
const generatedTask = await prisma.task.findFirst({
|
||||
const generated = await prisma.task.findMany({
|
||||
where: { sourceTemplateId: templateId },
|
||||
});
|
||||
expect(generatedTask).not.toBeNull();
|
||||
expect(generated).toHaveLength(1);
|
||||
const [generatedTask] = generated;
|
||||
expect(generatedTask.createdByUserId).toBeNull();
|
||||
|
||||
const template = await prisma.taskTemplate.findUniqueOrThrow({
|
||||
where: { id: templateId },
|
||||
});
|
||||
expect(template.nextDueDate.getTime()).toBeGreaterThan(yesterday.getTime());
|
||||
|
||||
// Same trail as any other task: an audit entry (by no user - the
|
||||
// template made it) and TaskCreated for calendar and webhooks.
|
||||
const audit = await prisma.auditLog.findMany({
|
||||
where: { entityType: 'Task', entityId: generatedTask.id },
|
||||
});
|
||||
expect(audit).toEqual([
|
||||
expect.objectContaining({ action: 'CREATE', userId: null }),
|
||||
]);
|
||||
const events = await prisma.domainEvent.findMany({
|
||||
where: { aggregateType: 'Task', aggregateId: generatedTask.id },
|
||||
});
|
||||
expect(events).toEqual([
|
||||
expect.objectContaining({
|
||||
type: 'TaskCreated',
|
||||
actorUserId: null,
|
||||
payload: {
|
||||
relatedType: 'GENERAL',
|
||||
relatedId: null,
|
||||
dueDate: generatedTask.dueDate?.toISOString().slice(0, 10),
|
||||
},
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('creates nothing more for an occurrence already generated', async () => {
|
||||
await request(app.getHttpServer())
|
||||
.get('/api/v1/tasks')
|
||||
.set('Authorization', `Bearer ${beekeeperToken}`)
|
||||
.expect(200);
|
||||
|
||||
await expect(
|
||||
prisma.task.count({ where: { sourceTemplateId: templateId } }),
|
||||
).resolves.toBe(1);
|
||||
});
|
||||
|
||||
it('rejects a recurrence emptied of a field it needs', () => {
|
||||
|
||||
Reference in new issue
Block a user