fix: harden api authentication and validation

This commit is contained in:
que01 committed 2026-09-18 16:37:48 +08:00
1 parent ae5f26baab
commit b89853bc94
5 files changed
+75 -28

No files matched your search

+10
View File
@@ -33,6 +33,16 @@ export class BookingService {
throw new BadRequestException("普通套餐至少选择一份有效套餐");
}
const extraData = input.extraData as { people?: unknown; location?: unknown } | undefined;
const allowedExtraKeys = new Set([
"people",
"location",
"budgetRange",
"tastePreferences",
"allergyNotes",
"dishPreferences",
]);
if (input.extraData && Object.keys(input.extraData).some((key) => !allowedExtraKeys.has(key)))
throw new BadRequestException("存在不支持的行业字段");
if (
input.requestType === "private_chef" &&
(!input.requestedDate || !extraData?.people || !extraData.location)