fix(housekeeping): harden people account workflows
This commit is contained in:
1 parent
e1b31ff773
commit
25b76437ff
41 files changed
+2657
-838
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import {
|
||||
createLegacyPeopleMutationContext,
|
||||
createPeopleMutationInvocation,
|
||||
peopleMutationService,
|
||||
} from "@/features/housekeeping/domains/people/services/mutations";
|
||||
import { createCorrelationId } from "@/features/housekeeping/foundation/contracts";
|
||||
@@ -27,11 +27,7 @@ async function executeLegacy(
|
||||
input: unknown,
|
||||
) {
|
||||
return peopleMutationService.execute(
|
||||
createLegacyPeopleMutationContext(
|
||||
staff,
|
||||
PERMS.USERS_EDIT,
|
||||
createCorrelationId(),
|
||||
),
|
||||
createPeopleMutationInvocation(staff, createCorrelationId()),
|
||||
operation,
|
||||
input,
|
||||
);
|
||||
@@ -259,6 +255,14 @@ export async function setTradeLock({
|
||||
userId,
|
||||
untilUnix: until,
|
||||
});
|
||||
if (!result.ok) return { ok: false, error: "Trade lock update failed" };
|
||||
if (!result.ok) {
|
||||
return {
|
||||
ok: false,
|
||||
error:
|
||||
result.error.code === "NOT_FOUND"
|
||||
? "User not found"
|
||||
: "Trade lock update failed",
|
||||
};
|
||||
}
|
||||
return { ok: true, data: { userId, untilUnix: until } };
|
||||
}
|
||||
Reference in new issue
Block a user