remove unused utilities, fix delete profile image issue

This commit is contained in:
Alex Holliday committed 2026-07-22 10:03:48 -07:00
1 parent ac16126e2e
commit d53785b768
4 files changed
+3 -39

No files matched your search

@@ -54,24 +54,6 @@ export const optionalNumber = (value: unknown, fieldName: string): number | unde
throw new AppError({ message: `${fieldName} must be a number`, status: 400 });
};
export const optionalBoolean = (value: unknown, fieldName: string): boolean | undefined => {
if (value === undefined) {
return undefined;
}
if (typeof value === "boolean") {
return value;
}
if (typeof value === "string") {
if (value === "true") {
return true;
}
if (value === "false") {
return false;
}
}
throw new AppError({ message: `${fieldName} must be a boolean`, status: 400 });
};
export const parseMonitorTypeFilter = (value: unknown): MonitorType | MonitorType[] | undefined => {
const parseSingle = (input: unknown): MonitorType => {
if (typeof input !== "string") {
+2 -1
View File
@@ -1,6 +1,6 @@
import { z } from "zod";
import { UserRoles } from "@/domain/users/user.type.js";
import { nameValidation, lowercaseEmailValidation, passwordValidation } from "./shared.js";
import { nameValidation, lowercaseEmailValidation, passwordValidation, booleanCoercion } from "@/api/validation/shared.js";
//****************************************
// User Validations
@@ -46,6 +46,7 @@ export const editUserBodyValidation = z
profilePicture: z.string().optional(),
password: passwordValidation.optional(),
newPassword: passwordValidation.optional(),
deleteProfileImage: booleanCoercion.optional(),
})
// Changing a password requires both the current password and the new one.
// The service only runs the change-password flow when both are present, so