(user) create validation in user update data

This commit is contained in:
unknown
2025-06-28 17:44:31 +07:00
parent 89c4fb79a7
commit 01b29e2a78
7 changed files with 1089 additions and 14 deletions

View File

@ -2,6 +2,10 @@ import { saveFile } from "..";
import { AppError } from "../../../error/instances/app";
export const saveAvatar = async (file: File): Promise<string> => {
if (Array.isArray(file)) {
throw new AppError(415, "Can't upload more than 1 file");
}
const allowedTypes = ["image/png", "image/jpeg", "image/webp"];
if (!allowedTypes.includes(file.type)) {
throw new AppError(