[as] feat: dc service 추가

This commit is contained in:
2026-07-29 15:39:37 +09:00
parent afbebb9dfc
commit b8b0b24b0e
6 changed files with 120 additions and 3 deletions
+18 -3
View File
@@ -1,8 +1,16 @@
import { NextRequest, NextResponse } from "next/server";
import { AUTH_USER_ID, CLAIM_NAME, PORT, PROXY_HOST, SERVER_API_URL, SITE_ID } from "@/shared/config";
import {
AUTH_USER_ID,
CLAIM_NAME,
PORT,
PROXY_HOST,
SERVER_API_URL,
SITE_ID,
} from "@/shared/config";
const serverApiUrl = process.env.SERVER_API_URL;
const dcServiceApiUrl = process.env.DC_SERVICE_API_URL;
// CSP 헤더 설정 함수 (img-src만)
function addSecurityHeaders(response: NextResponse): NextResponse {
@@ -22,7 +30,15 @@ export function middleware(req: NextRequest) {
if (pathname.startsWith("/server")) {
const queryParams = searchParams.toString();
const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${
let serverUrl: string | undefined;
if (pathname.includes("/dc-service")) {
serverUrl = dcServiceApiUrl;
} else {
serverUrl = serverApiUrl;
}
const newUrl = `${serverUrl}${pathname.replace("/server", "")}${
queryParams ? `?${queryParams}` : ""
}`;
@@ -34,7 +50,6 @@ export function middleware(req: NextRequest) {
return addSecurityHeaders(response);
}
// tus-js-client PATCH 요청: Location 헤더로 /server 없이 반환된 경로 직접 처리
// (예: /attach-service/api/v1/tus/upload/{id})
if (pathname.startsWith("/attach-service")) {
+19
View File
@@ -0,0 +1,19 @@
import { client } from "@/shared/api";
import { ENDPOINT } from "@/shared/config";
import type {
NowDmgMtncGnsvyResponseDto,
NowDmgMtncGnsvySearchDto,
} from "../model/dc-interface";
async function getNowDmgMtncGnsvy(
params: NowDmgMtncGnsvySearchDto,
): Promise<NowDmgMtncGnsvyResponseDto[]> {
const response = await client.get<NowDmgMtncGnsvyResponseDto[]>(
ENDPOINT.DC_SERVICE.NOW_DMG_MTNC_GNSVY,
{ params },
);
return response.data;
}
export { getNowDmgMtncGnsvy };
+17
View File
@@ -0,0 +1,17 @@
import { useQuery } from "@tanstack/react-query";
import { ENDPOINT } from "@/shared/config";
import type { NowDmgMtncGnsvySearchDto } from "../model/dc-interface";
import { getNowDmgMtncGnsvy } from "./dc-service";
export const nowDmgMtncGnsvyBaseKey = [ENDPOINT.DC_SERVICE.NOW_DMG_MTNC_GNSVY] as const;
export function useNowDmgMtncGnsvy(params: NowDmgMtncGnsvySearchDto) {
return useQuery({
queryKey: [...nowDmgMtncGnsvyBaseKey, params],
queryFn: () => getNowDmgMtncGnsvy(params),
enabled: Boolean(params.swtrmtFcltCd && params.ctpvNm),
});
}
+6
View File
@@ -0,0 +1,6 @@
export { getNowDmgMtncGnsvy } from "./api/dc-service";
export { nowDmgMtncGnsvyBaseKey, useNowDmgMtncGnsvy } from "./api/queries";
export type {
NowDmgMtncGnsvyResponseDto,
NowDmgMtncGnsvySearchDto,
} from "./model/dc-interface";
@@ -0,0 +1,57 @@
export interface NowDmgMtncGnsvySearchDto {
swtrmtFcltCd?: string;
ctpvNm?: string;
sggNm?: string;
targetYear?: string;
}
type NullableNumber = number | null;
type NullableString = string | null;
/** 현재·단계별(Dt/Dc) 공통 지표 필드 */
interface NowDmgMtncGnsvyMetricFields {
planYr?: NullableString;
swtrmtPpltnCnt?: NullableNumber;
natrSwtrmtPpltnCnt?: NullableNumber;
scilSwtrmtPpltnCnt?: NullableNumber;
swtrmtZoneArea?: NullableNumber;
wtrUsqtyOrgnUnit?: NullableNumber;
drtwSwtcRt?: NullableNumber;
flctnLodRt?: NullableNumber;
drtwOrgnUnit?: NullableNumber;
planSwageQntSum?: NullableNumber;
lvngDrtwSum?: NullableNumber;
ugwtSum?: NullableNumber;
fctryWwtSum?: NullableNumber;
toursmDrtwSum?: NullableNumber;
mtbsSum?: NullableNumber;
linkPrcsCntSum?: NullableNumber;
etcDrtwSum?: NullableNumber;
ugwtUseSum?: NullableNumber;
fcltCpctSum?: NullableNumber;
exclsMethExpln?: NullableString;
brcPplSum?: NullableNumber;
icptgPplSum?: NullableNumber;
exclnPplSum?: NullableNumber;
stofcbrSum?: NullableNumber;
pmstnSum?: NullableNumber;
simplPubSwtrmtFcltSum?: NullableNumber;
swageImpdFcltSum?: NullableNumber;
mltvFclSum?: NullableNumber;
}
type StageSuffix = "Dt1" | "Dt2" | "Dt3" | "Dt4" | "Dc1" | "Dc2" | "Dc3" | "Dc4";
type StagedMetricFields = {
[K in keyof NowDmgMtncGnsvyMetricFields as `${K & string}${StageSuffix}`]?: NowDmgMtncGnsvyMetricFields[K];
};
/** DC nowDmgMtncGnsvy 응답 DTO */
export interface NowDmgMtncGnsvyResponseDto
extends NowDmgMtncGnsvyMetricFields, StagedMetricFields {
swtrmtFcltCd?: NullableString;
swtrmtFcltNm?: NullableString;
gnsvyYr?: NullableString;
ctpvNm?: NullableString;
sggNm?: NullableString;
}
+3
View File
@@ -44,6 +44,9 @@ export const ENDPOINT = {
STATVERIFY_SERVICE: {
ST_ANLS_MST: "/statverify-service/api/v1/st-anls-mst",
},
DC_SERVICE: {
NOW_DMG_MTNC_GNSVY: "/dc-service/api/v1/nowDmgMtncGnsvy",
},
};
export const JWT_EXPIRATION_TIME = 1800000;