More yup validations.

This commit is contained in:
Brian Cao 2023-09-25 13:19:56 -07:00
parent 2ccb8d0a3c
commit ce2a83a09f
12 changed files with 99 additions and 50 deletions

View file

@ -22,6 +22,12 @@ const schema = {
GET: yup.object().shape({
id: yup.string().uuid().required(),
}),
POST: yup.object().shape({
id: yup.string().uuid().required(),
name: yup.string().required(),
domain: yup.string().required(),
shareId: yup.string().matches(SHARE_ID_REGEX, { excludeEmptyString: true }),
}),
};
export default async (
@ -55,10 +61,6 @@ export default async (
let website;
if (shareId && !shareId.match(SHARE_ID_REGEX)) {
return serverError(res, 'Invalid share ID.');
}
try {
website = await updateWebsite(websiteId, { name, domain, shareId });
} catch (e: any) {