260728_02_ENH: SID String으로 교체

This commit is contained in:
2026-07-28 11:47:33 +09:00
parent d97015741a
commit d9f53c0c3d
18 changed files with 151 additions and 54 deletions

View File

@@ -33,11 +33,14 @@ const toRequiredNumber = (value: string): number | null => {
return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
};
const toRequiredSid = (value: string): string | null =>
value.length > 0 ? value : null;
const buildExternalEventBody = (
req: NextRequest,
action: ExternalAction,
prjctSurveyIdx: number,
sid: number,
sid: string,
): ExternalEventBody => {
const pathname = req.nextUrl.pathname;
const h = req.headers;
@@ -51,7 +54,7 @@ const buildExternalEventBody = (
entryType: getEntryTypeCode(h),
action: actionCode,
psidx: String(prjctSurveyIdx),
sid: String(sid),
sid,
remoteAddr: getHeader(h, "x-orig-ip") || getClientIp(req),
uri: getHeader(h, "x-orig-uri") || pathname,
url: getHeader(h, "x-orig-url") || req.url,
@@ -75,7 +78,7 @@ const handleExternalEvent = async (req: NextRequest, context: RouteContext) => {
}
const prjctSurveyIdx = toRequiredNumber((searchParams.get("psidx") ?? "").trim());
const sid = toRequiredNumber((searchParams.get("sid") ?? "").trim());
const sid = toRequiredSid((searchParams.get("sid") ?? "").trim());
if (!prjctSurveyIdx || !sid) {
return NextResponse.json({ message: "psidx, sid는 필수입니다." }, { status: 400 });