fix(api): harden notification assignee persistence

This commit is contained in:
2026-03-31 22:52:09 +02:00
parent 7ace137d16
commit 6e84b022c3
5 changed files with 127 additions and 8 deletions
@@ -82,6 +82,24 @@ describe("notification procedure support", () => {
}
});
it("rewrites assignee foreign-key errors to a not found TRPC error", () => {
const error = {
code: "P2003",
meta: { field_name: "Notification_assigneeId_fkey" },
};
try {
rethrowNotificationReferenceError(error);
throw new Error("expected notification reference error");
} catch (caught) {
expect(caught).toBeInstanceOf(TRPCError);
expect(caught).toMatchObject<Partial<TRPCError>>({
code: "NOT_FOUND",
message: "Assignee user not found",
});
}
});
it("rewrites broadcast source foreign-key errors to a not found TRPC error", () => {
const error = {
code: "P2003",