fix: 服务端验证强化 — 房间ID/坐标/swipe/盲盒竞态/空格
- #15: 房间 ID 扩展为 6 位字母数字,createRoom 用 P2002 重试替代 find-then-create - #16: 盲盒编辑/删除改用 updateMany/deleteMany 原子操作,防止 TOCTOU - #17: lat/lng 用 Number.isFinite + 范围校验 (-90~90, -180~180) - #18: swipe action 必须为 'like' 或 'pass' - #19: user PUT 的 JSON.parse(preferences) 加 try/catch - #26: requireString 拒绝纯空格字符串
This commit is contained in:
@@ -11,6 +11,9 @@ export const POST = apiHandler(async (req, { params }) => {
|
||||
if (restaurantId == null || !action) {
|
||||
throw new ApiError("restaurantId and action are required");
|
||||
}
|
||||
if (action !== "like" && action !== "pass") {
|
||||
throw new ApiError("action must be 'like' or 'pass'");
|
||||
}
|
||||
|
||||
const rid = String(restaurantId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user