test(sharing): drive the booster admission through its owned effect

The booster route was admitted into the MANAGE matrix but had no driver, so
the strict-driver and real-effect inventories stayed one short of the admission
count and the completeness guards failed. Register the write-effect driver that
mints the reminder against a tetanus dose and asserts the delegated WRITE actor
on the audit row, matching every other admitted write.
This commit is contained in:
Marc-André Bombeck committed 2026-08-09 00:28:32 +02:00
1 parent e5072ba99e
commit 77ba829fcf
1 file changed
+19
@@ -1556,6 +1556,25 @@ manageContract("POST /api/vaccinations/[id]/restore", {
)?.deletedAt === null,
});
proveWriteRoute("POST /api/vaccinations/[id]/booster", {
route: "/api/vaccinations/[id]/booster",
// The dose the booster is planned against. `makeVaccination` records a
// monovalent tetanus dose, so the mint keys the reminder on the tetanus
// antigen and `applied` can prove exactly one reminder now carries it.
prepare: async (ownerId) => ({
ownerId,
vaccination: await makeVaccination(ownerId),
}),
params: ({ vaccination }) => ({ id: vaccination.id }),
body: () => ({ intervalMonths: 120, label: "Tetanus booster" }),
ok: 201,
auditAction: "vaccination.booster.planned",
applied: async ({ ownerId }) =>
(await getPrismaClient().measurementReminder.count({
where: { userId: ownerId, vaccinationAntigen: "tetanus" },
})) === 1,
});
manageContract("POST /api/illness/episodes/[id]/day-logs", {
contract: ADMITTED_MUTATING_HANDLERS.find(
(entry) =>