website refactor
This commit is contained in:
@@ -16,19 +16,19 @@ import { Mutation } from '@/lib/contracts/mutations/Mutation';
|
||||
*/
|
||||
export class UpdateUserStatusMutation implements Mutation<{ userId: string; status: string }, void, MutationError> {
|
||||
async execute(input: { userId: string; status: string }): Promise<Result<void, MutationError>> {
|
||||
try {
|
||||
// Manual construction: Service creates its own dependencies
|
||||
const service = new AdminService();
|
||||
|
||||
const result = await service.updateUserStatus(input.userId, input.status);
|
||||
|
||||
if (result.isErr()) {
|
||||
return Result.err(mapToMutationError(result.getError()));
|
||||
}
|
||||
|
||||
return Result.ok(undefined);
|
||||
} catch (err) {
|
||||
return Result.err('updateFailed');
|
||||
}
|
||||
}
|
||||
try {
|
||||
// Manual construction: Service creates its own dependencies
|
||||
const service = new AdminService();
|
||||
|
||||
const result = await service.updateUserStatus(input.userId, input.status);
|
||||
|
||||
if (result.isErr()) {
|
||||
return Result.err(mapToMutationError(result.getError()));
|
||||
}
|
||||
|
||||
return Result.ok(undefined);
|
||||
} catch (err) {
|
||||
return Result.err('updateFailed');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user