fix(orders): 내 출고 이력에서 본인 발주만 — user.objid undefined 폴백
Deploy momo-erp / deploy (push) Successful in 2m37s

USER 권한 사용자의 list API 필터링에서 r.user.objid 가 undefined 인
세션에선 customer_objid 비교가 NULL 매칭 → 필터링 무효화돼 모든 발주가
노출되던 버그. user_id 폴백 + customer_objid 가 user_id 로 박힌 경우
모두 IN 절로 매칭.
This commit is contained in:
chpark
2026-05-14 01:03:43 +09:00
parent 34ee374796
commit b204f14265
+5 -2
View File
@@ -16,8 +16,11 @@ export async function POST(req: NextRequest) {
let i = 1;
if (r.user.role === "USER") {
conditions.push(`O.customer_objid = $${i++}`);
params.push(r.user.objid);
// user.objid 가 undefined 인 세션도 있어 user_id 로 폴백.
// customer_objid 가 user_id 형태(예: 'momo075')로 박힌 경우 → 두 값 모두 매칭.
const own = r.user.objid ?? r.user.userId;
conditions.push(`O.customer_objid IN ($${i++}, $${i++})`);
params.push(own, r.user.userId);
} else if (customerObjid) {
conditions.push(`O.customer_objid = $${i++}`);
params.push(customerObjid);