From 675e5f58d1926eb4005eabcee6e1533050b9f2aa Mon Sep 17 00:00:00 2001 From: rsone001 Date: Wed, 8 Jul 2026 17:39:35 +0900 Subject: [PATCH 1/7] =?UTF-8?q?[st]=20-=20fix=20log=20detail=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../management/LogHistoryDetailDialog.tsx | 5 +- .../management/LogHistoryDetailColumn.ts | 50 ++++++++++++++++++- .../statistics/model/statistics-interface.ts | 2 +- 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/apps/st/src/components/statistics/management/LogHistoryDetailDialog.tsx b/apps/st/src/components/statistics/management/LogHistoryDetailDialog.tsx index 416543fa1..46675c000 100644 --- a/apps/st/src/components/statistics/management/LogHistoryDetailDialog.tsx +++ b/apps/st/src/components/statistics/management/LogHistoryDetailDialog.tsx @@ -25,6 +25,7 @@ import { emptyLogHistoryDetailColumnInfo, LOG_DETAIL_DETAILS_FIELD, LOG_DETAIL_DETAILS_RAW_FIELD, + normalizeLogDetailList, type LogDetailVerificationItem, prepareLogDetailRowsForGrid, } from "@/components/util/column/management/LogHistoryDetailColumn"; @@ -113,9 +114,7 @@ export function LogHistoryDetailDialog({ return; } - const list = Array.isArray(response.data) - ? response.data - : []; + const list = normalizeLogDetailList(response.data); const nextColumnInfo = buildLogHistoryDetailColumnInfo(list); const nextRows = alignLogDetailRowsToColumns( prepareLogDetailRowsForGrid(list), diff --git a/apps/st/src/components/util/column/management/LogHistoryDetailColumn.ts b/apps/st/src/components/util/column/management/LogHistoryDetailColumn.ts index 220aa70e5..e10e68df8 100644 --- a/apps/st/src/components/util/column/management/LogHistoryDetailColumn.ts +++ b/apps/st/src/components/util/column/management/LogHistoryDetailColumn.ts @@ -32,9 +32,46 @@ const FIELD_HEADER: Record = { sggNm: "시군구", admdstCd: "행정구역코드", admdstNm: "행정구역명", + vrfcSn: "검증순번", + vrfcNm: "검증명", + trgtStatsCd: "대상통계코드", + trgtStatsNm: "대상통계명", + vrfcClsfCd: "검증분류코드", + vrfcClsfNm: "검증분류명", + dcptDigtCnt: "소수점자릿수", + dcptPrcsMthCd: "소수점처리방법코드", + dcptPrcsMthNm: "소수점처리방법명", + useYn: "사용여부", + regDt: "등록일시", + mdfcnDt: "수정일시", [LOG_DETAIL_DETAILS_FIELD]: "상세", }; +/** 검증 규칙 로그 상세(vrfcSn 등) 컬럼 표시 순서 */ +const VERIFICATION_FIELD_ORDER = [ + "vrfcSn", + "vrfcNm", + "trgtStatsCd", + "trgtStatsNm", + "vrfcClsfCd", + "vrfcClsfNm", + "dcptDigtCnt", + "dcptPrcsMthCd", + "dcptPrcsMthNm", + "useYn", + "regDt", + "mdfcnDt", +] as const; + +/** API `data`가 배열 또는 단일 객체일 때 그리드 행 배열로 정규화 */ +export function normalizeLogDetailList( + data: StatisticsLogDetailRow[] | StatisticsLogDetailRow | null | undefined, +): StatisticsLogDetailRow[] { + if (Array.isArray(data)) return data; + if (data != null && typeof data === "object") return [data]; + return []; +} + function parseLogDetailsValue( value: unknown, ): LogDetailVerificationItem[] | null { @@ -104,11 +141,20 @@ function collectFieldNames(rows: StatisticsLogDetailRow[]): string[] { keys.add(key); } } + const verification = VERIFICATION_FIELD_ORDER.filter((k) => keys.has(k)); const common = COMMON_FIELD_ORDER.filter((k) => keys.has(k)); + const ordered = new Set([ + ...verification, + ...common, + LOG_DETAIL_DETAILS_FIELD, + ]); const rest = [...keys] - .filter((k) => !COMMON_FIELD_ORDER.includes(k as (typeof COMMON_FIELD_ORDER)[number])) + .filter((k) => !ordered.has(k) && k !== LOG_DETAIL_DETAILS_RAW_FIELD) .sort((a, b) => a.localeCompare(b, "ko")); - return [...common, ...rest]; + const details = keys.has(LOG_DETAIL_DETAILS_FIELD) + ? [LOG_DETAIL_DETAILS_FIELD] + : []; + return [...verification, ...common, ...rest, ...details]; } function isNumericField(rows: StatisticsLogDetailRow[], fieldName: string): boolean { diff --git a/apps/st/src/entities/statistics/model/statistics-interface.ts b/apps/st/src/entities/statistics/model/statistics-interface.ts index 571835065..2b533d955 100644 --- a/apps/st/src/entities/statistics/model/statistics-interface.ts +++ b/apps/st/src/entities/statistics/model/statistics-interface.ts @@ -310,7 +310,7 @@ export interface StatisticsLogDetailRow { export interface StatisticsLogDetailResponse { status: string; message?: string; - data?: StatisticsLogDetailRow[]; + data?: StatisticsLogDetailRow[] | StatisticsLogDetailRow; } export interface getReviewOpinionDetailRequest { From 1cd24b5dd5540b93a51dc86cf33a0c5d1591a5b3 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 8 Jul 2026 18:05:11 +0900 Subject: [PATCH 2/7] =?UTF-8?q?[st]=20chore:=20stClient=20=EC=B0=B8?= =?UTF-8?q?=EC=A1=B0=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/dashboard/dashboard-service.ts | 2 +- .../api/dashboard/schedule-info-service.ts | 2 +- .../api/general-verification-service.ts | 2 +- ...nput-excreta-treatment-facility-service.ts | 33 +- ...s-input-private-sewage-facility-service.ts | 42 +-- ...tatistics-input-pumping-station-service.ts | 5 +- ...tatistics-input-sew-supply-rate-service.ts | 29 +- ...cs-input-sewage-excreta-related-service.ts | 33 +- ...ics-input-sewage-excreta-slurge-service.ts | 114 +++--- ...tics-input-sewage-pipe-maintain-service.ts | 56 +-- ...ics-input-sewage-reservoir-pump-service.ts | 21 +- ...atistics-input-sewerage-finance-service.ts | 15 +- ...cs-input-sewerage-service-level-service.ts | 33 +- .../input/statistics-input-status-service.ts | 2 +- .../statistics-input-water-reuse-service.ts | 104 +++--- ...cs-public-sewage-facility-input-service.ts | 35 +- .../statistics-sewage-pipe-input-service.ts | 228 +++++++----- .../statistics/api/sewer-st-user-service.ts | 2 +- .../api/statistics-management-service.ts | 318 +++++++++-------- .../api/statistics-ppltn-service.ts | 185 +++++----- .../statistics/api/statistics-service.ts | 60 ++-- ...tics-sewerage-aggregate-summary-service.ts | 27 +- .../api/statistics-total-service.ts | 330 ++++++++++-------- .../api/verification-input-report-service.ts | 8 +- apps/st/src/shared/api/index.ts | 2 +- 25 files changed, 948 insertions(+), 740 deletions(-) diff --git a/apps/st/src/entities/statistics/api/dashboard/dashboard-service.ts b/apps/st/src/entities/statistics/api/dashboard/dashboard-service.ts index 0bb830e61..d23946f20 100644 --- a/apps/st/src/entities/statistics/api/dashboard/dashboard-service.ts +++ b/apps/st/src/entities/statistics/api/dashboard/dashboard-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import type { diff --git a/apps/st/src/entities/statistics/api/dashboard/schedule-info-service.ts b/apps/st/src/entities/statistics/api/dashboard/schedule-info-service.ts index b9b593d0b..7c0363be3 100644 --- a/apps/st/src/entities/statistics/api/dashboard/schedule-info-service.ts +++ b/apps/st/src/entities/statistics/api/dashboard/schedule-info-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import type { diff --git a/apps/st/src/entities/statistics/api/general-verification-service.ts b/apps/st/src/entities/statistics/api/general-verification-service.ts index 4e3f3a478..b12f0d0a9 100644 --- a/apps/st/src/entities/statistics/api/general-verification-service.ts +++ b/apps/st/src/entities/statistics/api/general-verification-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import type { diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-excreta-treatment-facility-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-excreta-treatment-facility-service.ts index e4489bc1a..e0261b506 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-excreta-treatment-facility-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-excreta-treatment-facility-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -12,17 +12,16 @@ import { type StatisticsInputExcretaTreatmentFacilityService, } from "../../model/input/statistics-input-excreta-treatment-facility-interface"; -export class StatisticsInputExcretaTreatmentFacilityApiService - implements StatisticsInputExcretaTreatmentFacilityService -{ +export class StatisticsInputExcretaTreatmentFacilityApiService implements StatisticsInputExcretaTreatmentFacilityService { /** 분뇨처리시설 조회 — ST00070001 */ public async getExcretaTreatmentFacilityList( params: ExcretaTreatmentFacilityRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.INPUT}/excreta-treatment-facility`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.INPUT}/excreta-treatment-facility`, + withAuthHeader({ params }), + ); return response.data; } @@ -30,10 +29,11 @@ export class StatisticsInputExcretaTreatmentFacilityApiService public async saveExcretaTreatmentFacilityList( request: ExcretaTreatmentFacilitySaveRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/excreta-treatment-facility/save`, - request, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/excreta-treatment-facility/save`, + request, + ); return response.data; } @@ -41,10 +41,11 @@ export class StatisticsInputExcretaTreatmentFacilityApiService public async submitExcretaTreatmentFacilityList( request: ExcretaTreatmentFacilitySubmitRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/excreta-treatment-facility/submit`, - request, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/excreta-treatment-facility/submit`, + request, + ); return response.data; } } diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-private-sewage-facility-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-private-sewage-facility-service.ts index bcb23018c..0d5ff20c5 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-private-sewage-facility-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-private-sewage-facility-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -26,9 +26,7 @@ import { const BASE = `${ENDPOINT.ST_SERVICE.INPUT}/private-sewage-facility`; -export class StatisticsInputPrivateSewageFacilityApiService - implements StatisticsInputPrivateSewageFacilityService -{ +export class StatisticsInputPrivateSewageFacilityApiService implements StatisticsInputPrivateSewageFacilityService { /** 처리용량별 오수처리시설 현황 조회 — ST00080001 */ public async getSewageTreatFactStatusList( params: SewageTreatFactStatusRequestParams, @@ -55,10 +53,11 @@ export class StatisticsInputPrivateSewageFacilityApiService public async submitSewageTreatFactStatus( request: SewageTreatFactStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/sewage-treat-fact-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/sewage-treat-fact-status/submit`, + request, + ); return response.data; } @@ -99,10 +98,11 @@ export class StatisticsInputPrivateSewageFacilityApiService public async getPrivateSewageDesigStatusList( params: PrivateSewageDesigStatusRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/desig-status`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/desig-status`, + withAuthHeader({ params }), + ); return response.data; } @@ -110,10 +110,11 @@ export class StatisticsInputPrivateSewageFacilityApiService public async savePrivateSewageDesigStatus( request: PrivateSewageDesigStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/desig-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/desig-status/save`, + request, + ); return response.data; } @@ -121,10 +122,11 @@ export class StatisticsInputPrivateSewageFacilityApiService public async submitPrivateSewageDesigStatus( request: PrivateSewageDesigStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/desig-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/desig-status/submit`, + request, + ); return response.data; } } diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-pumping-station-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-pumping-station-service.ts index 7538acb7d..63492d7aa 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-pumping-station-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-pumping-station-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -47,4 +47,5 @@ export class StatisticsInputPumpingStationApiService implements StatisticsInputP } } -export const statisticsInputPumpingStationApi = new StatisticsInputPumpingStationApiService(); +export const statisticsInputPumpingStationApi = + new StatisticsInputPumpingStationApiService(); diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sew-supply-rate-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sew-supply-rate-service.ts index fce1895d4..4d1b3cc52 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sew-supply-rate-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sew-supply-rate-service.ts @@ -1,19 +1,21 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; import { - type StatisticsInputSewSupplyRateService, - type SewerageSupplyRateRequestParams, - type SewerageSupplyRateApiResponse, type CheckInputPeriodResponse, + type SewerageSupplyRateApiResponse, + type SewerageSupplyRateRequestParams, type SewerageSupplyRateSaveRequest, - type SewerageSupplyRateSubmitResponse, type SewerageSupplyRateSaveResponse, + type SewerageSupplyRateSubmitResponse, + type StatisticsInputSewSupplyRateService, } from "../../model/input/statistics-sewage-supply-rate-input-interface"; export class StatisticsInputSewSupplyRateApiService implements StatisticsInputSewSupplyRateService { - public async getSewerageSupplyRateList(params: SewerageSupplyRateRequestParams): Promise { + public async getSewerageSupplyRateList( + params: SewerageSupplyRateRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewerage-supply-rate`, withAuthHeader({ params }), @@ -21,14 +23,18 @@ export class StatisticsInputSewSupplyRateApiService implements StatisticsInputSe return response.data; } - public async checkInputPeriod(params: string): Promise { + public async checkInputPeriod( + params: string, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUTCOMMON}/check-input-period?statsYr=${params}`, ); return response.data; } - public async saveSewerageSupplyRate(params: SewerageSupplyRateSaveRequest): Promise { + public async saveSewerageSupplyRate( + params: SewerageSupplyRateSaveRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUT}/sewerage-supply-rate/save`, params, @@ -36,7 +42,9 @@ export class StatisticsInputSewSupplyRateApiService implements StatisticsInputSe return response.data; } - public async submitSewerageSupplyRate(params: SewerageSupplyRateSaveRequest): Promise { + public async submitSewerageSupplyRate( + params: SewerageSupplyRateSaveRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUT}/sewerage-supply-rate/submit`, params, @@ -45,4 +53,5 @@ export class StatisticsInputSewSupplyRateApiService implements StatisticsInputSe } } -export const statisticsInputSewSupplyRateApi = new StatisticsInputSewSupplyRateApiService(); \ No newline at end of file +export const statisticsInputSewSupplyRateApi = + new StatisticsInputSewSupplyRateApiService(); diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-related-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-related-service.ts index 61baeca8e..d1a1f08da 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-related-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-related-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -23,17 +23,16 @@ import type { const BASE = `${ENDPOINT.ST_SERVICE.INPUT}/sewage-excreta-related`; -export class StatisticsInputSewageExcretaRelatedApiService - implements StatisticsInputSewageExcretaRelatedService -{ +export class StatisticsInputSewageExcretaRelatedApiService implements StatisticsInputSewageExcretaRelatedService { /** 공공기관 하수분야 조회 — ST00120001 */ public async getPublicInstitutionSewerIndustryList( params: SewageExcretaRelatedRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/public-institution-sewer-industry`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/public-institution-sewer-industry`, + withAuthHeader({ params }), + ); return response.data; } @@ -63,10 +62,11 @@ export class StatisticsInputSewageExcretaRelatedApiService public async getPublicInstitutionExcretaIndustryList( params: SewageExcretaRelatedRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/public-institution-excreta-industry`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/public-institution-excreta-industry`, + withAuthHeader({ params }), + ); return response.data; } @@ -129,10 +129,11 @@ export class StatisticsInputSewageExcretaRelatedApiService public async getPrivateSewageTreatRelatedIndustryList( params: SewageExcretaRelatedRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/private-sewage-treat-related-industry`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/private-sewage-treat-related-industry`, + withAuthHeader({ params }), + ); return response.data; } diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-slurge-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-slurge-service.ts index 4d47e0e24..57a908a37 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-slurge-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-excreta-slurge-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -31,17 +31,16 @@ import type { const BASE = `${ENDPOINT.ST_SERVICE.INPUT}/sewage-excreta-slurge`; -export class StatisticsInputSewageExcretaSlurgeApiService - implements StatisticsInputSewageExcretaSlurgeService -{ +export class StatisticsInputSewageExcretaSlurgeApiService implements StatisticsInputSewageExcretaSlurgeService { /** 찌꺼기(슬러지)처리시설현황 조회 — ST00110001 */ public async getSlurgeProcessingFacStatusList( params: SewageExcretaSlurgeRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/slurge-processing-fac-status`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/slurge-processing-fac-status`, + withAuthHeader({ params }), + ); return response.data; } @@ -49,10 +48,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async saveSlurgeProcessingFacStatus( request: SlurgeProcessingFacStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/slurge-processing-fac-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/slurge-processing-fac-status/save`, + request, + ); return response.data; } @@ -60,10 +60,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async submitSlurgeProcessingFacStatus( request: SlurgeProcessingFacStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/slurge-processing-fac-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/slurge-processing-fac-status/submit`, + request, + ); return response.data; } @@ -82,10 +83,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async saveDigestorOperatingStatus( request: DigestorOperatingStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/digestor-operating-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/digestor-operating-status/save`, + request, + ); return response.data; } @@ -93,10 +95,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async submitDigestorOperatingStatus( request: DigestorOperatingStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/digestor-operating-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/digestor-operating-status/submit`, + request, + ); return response.data; } @@ -104,10 +107,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async getSewageSlurgeProcessingFacStatusList( params: SewageExcretaSlurgeRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/sewage-slurge-processing-fac-status`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/sewage-slurge-processing-fac-status`, + withAuthHeader({ params }), + ); return response.data; } @@ -115,10 +119,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async saveSewageSlurgeProcessingFacStatus( request: SewageSlurgeProcessingFacStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/sewage-slurge-processing-fac-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/sewage-slurge-processing-fac-status/save`, + request, + ); return response.data; } @@ -126,10 +131,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async submitSewageSlurgeProcessingFacStatus( request: SewageSlurgeProcessingFacStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/sewage-slurge-processing-fac-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/sewage-slurge-processing-fac-status/submit`, + request, + ); return response.data; } @@ -137,10 +143,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async getExcretaSlurgeProcessingStatusList( params: SewageExcretaSlurgeRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/excreta-slurge-processing-status`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/excreta-slurge-processing-status`, + withAuthHeader({ params }), + ); return response.data; } @@ -148,10 +155,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async saveExcretaSlurgeProcessingStatus( request: ExcretaSlurgeProcessingStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/excreta-slurge-processing-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/excreta-slurge-processing-status/save`, + request, + ); return response.data; } @@ -159,10 +167,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async submitExcretaSlurgeProcessingStatus( request: ExcretaSlurgeProcessingStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/excreta-slurge-processing-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/excreta-slurge-processing-status/submit`, + request, + ); return response.data; } @@ -170,10 +179,11 @@ export class StatisticsInputSewageExcretaSlurgeApiService public async getPublicSewageFacilitiesList( params: PublicSewageFacilitiesListRequest, ): Promise { - const response = await stClient.get( - `${BASE}/public-sewage-facilities`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/public-sewage-facilities`, + withAuthHeader({ params }), + ); return response.data; } } diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-pipe-maintain-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-pipe-maintain-service.ts index cc366f08d..e7d2253c9 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-pipe-maintain-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-pipe-maintain-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -18,61 +18,69 @@ import type { } from "../../model/input/statistics-input-sewage-pipe-maintain-interface"; export class SewagePipeMaintainApiService implements SewagePipeMaintainService { - public async getSewagePipeMaintainRepair(param: SewagePipeMaintainRequestParams): Promise { + public async getSewagePipeMaintainRepair( + param: SewagePipeMaintainRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/repair`, - withAuthHeader({ params: param }) + withAuthHeader({ params: param }), ); return response.data; - }; + } - public async getSewagePipeMaintainDredging(param: SewagePipeMaintainRequestParams): Promise { + public async getSewagePipeMaintainDredging( + param: SewagePipeMaintainRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/dredging`, - withAuthHeader({ params: param }) + withAuthHeader({ params: param }), ); return response.data; - }; + } public async saveSewagePipeMaintainRepair( param: SewagePipeMaintainRepairSaveRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/repair/save`, - param, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/repair/save`, + param, + ); return response.data; } public async submitSewagePipeMaintainRepair( param: SewagePipeMaintainRepairSubmitRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/repair/submit`, - param, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/repair/submit`, + param, + ); return response.data; } public async saveSewagePipeMaintainDredging( param: SewagePipeMaintainDredgingSaveRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/dredging/save`, - param, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/dredging/save`, + param, + ); return response.data; } public async submitSewagePipeMaintainDredging( param: SewagePipeMaintainDredgingSubmitRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/dredging/submit`, - param, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe-maintain/dredging/submit`, + param, + ); return response.data; } } -export const sewagePipeMaintainApiService = new SewagePipeMaintainApiService(); \ No newline at end of file +export const sewagePipeMaintainApiService = new SewagePipeMaintainApiService(); diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-reservoir-pump-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-reservoir-pump-service.ts index 9e187ce30..780320b46 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sewage-reservoir-pump-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sewage-reservoir-pump-service.ts @@ -1,25 +1,27 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; import { - type StatisticsInputSewageReservoirPumpService, + type RainfallPumpStationApiResponse, + type RainfallPumpStationSaveRequest, + type RainfallPumpStationSaveResponse, + type RainfallPumpStationSubmitRequest, + type RainfallPumpStationSubmitResponse, type SewageReservoirApiResponse, type SewageReservoirRequestParams, type SewageReservoirSaveRequest, type SewageReservoirSaveResponse, type SewageReservoirSubmitRequest, type SewageReservoirSubmitResponse, - type RainfallPumpStationApiResponse, - type RainfallPumpStationSaveRequest, - type RainfallPumpStationSaveResponse, - type RainfallPumpStationSubmitRequest, - type RainfallPumpStationSubmitResponse, + type StatisticsInputSewageReservoirPumpService, } from "../../model/input/statistics-input-sewage-reservoir-pump-interface"; export class StatisticsInputSewageReservoirPumpApiService implements StatisticsInputSewageReservoirPumpService { /** 하수저류시설 조회 — ST00040001 */ - public async getSewageReservoirList(params: SewageReservoirRequestParams): Promise { + public async getSewageReservoirList( + params: SewageReservoirRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-reservoir-pump/sewage-reservoir`, withAuthHeader({ params }), @@ -83,4 +85,5 @@ export class StatisticsInputSewageReservoirPumpApiService implements StatisticsI } } -export const statisticsInputSewageReservoirPumpApi = new StatisticsInputSewageReservoirPumpApiService(); +export const statisticsInputSewageReservoirPumpApi = + new StatisticsInputSewageReservoirPumpApiService(); diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-finance-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-finance-service.ts index 1bac7543c..f817079e4 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-finance-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-finance-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -30,9 +30,7 @@ import { const BASE = `${ENDPOINT.ST_SERVICE.INPUT}/sewerage-finance`; -export class StatisticsInputSewerageFinanceApiService - implements StatisticsInputSewerageFinanceService -{ +export class StatisticsInputSewerageFinanceApiService implements StatisticsInputSewerageFinanceService { /** 하수도재정 결산 조회 — ST00090001 */ public async getSewerageFinanceSettleList( params: SewerageFinanceSettleRequestParams, @@ -59,10 +57,11 @@ export class StatisticsInputSewerageFinanceApiService public async submitSewerageFinanceSettle( request: SewerageFinanceSettleSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/settle/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/settle/submit`, + request, + ); return response.data; } diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-service-level-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-service-level-service.ts index 478ad0696..652a6acc4 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-service-level-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-sewerage-service-level-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -19,17 +19,16 @@ import { const BASE = `${ENDPOINT.ST_SERVICE.INPUT}/sewerage-service-level`; -export class StatisticsInputSewerageServiceLevelApiService - implements StatisticsInputSewerageServiceLevelService -{ +export class StatisticsInputSewerageServiceLevelApiService implements StatisticsInputSewerageServiceLevelService { /** 민원 조회 — ST00130001 */ public async getComplaintList( params: SewerageServiceLevelComplaintRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/complaint`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/complaint`, + withAuthHeader({ params }), + ); return response.data; } @@ -49,10 +48,11 @@ export class StatisticsInputSewerageServiceLevelApiService public async saveComplaintList( request: SewerageServiceLevelComplaintSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/complaint/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/complaint/save`, + request, + ); return response.data; } @@ -60,10 +60,11 @@ export class StatisticsInputSewerageServiceLevelApiService public async saveResidentFriendlyFactList( request: SewerageServiceLevelResidentFriendlyFactSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/resident-friendly-fact/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/resident-friendly-fact/save`, + request, + ); return response.data; } diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-status-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-status-service.ts index 20e446d41..3d3d164aa 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-status-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-status-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import type { diff --git a/apps/st/src/entities/statistics/api/input/statistics-input-water-reuse-service.ts b/apps/st/src/entities/statistics/api/input/statistics-input-water-reuse-service.ts index 87ec895be..b825c2604 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-input-water-reuse-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-input-water-reuse-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -41,10 +41,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async getPublicSewageTreatWaterReuseList( params: WaterReuseRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/public-sewage`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/public-sewage`, + withAuthHeader({ params }), + ); return response.data; } @@ -52,10 +53,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async savePublicSewageTreatWaterReuse( request: PublicSewageTreatWaterReuseSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/public-sewage/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/public-sewage/save`, + request, + ); return response.data; } @@ -63,10 +65,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async submitPublicSewageTreatWaterReuse( request: PublicSewageTreatWaterReuseSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/public-sewage/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/public-sewage/submit`, + request, + ); return response.data; } @@ -129,10 +132,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async submitRainFallUtilFactStatus( request: RainFallUtilFactStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/rainfall-util-fact-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/rainfall-util-fact-status/submit`, + request, + ); return response.data; } @@ -140,10 +144,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async getTreatWaterReuseDesignConstStatusList( params: WaterReuseRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/treat-water-reuse-design-const-status`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/treat-water-reuse-design-const-status`, + withAuthHeader({ params }), + ); return response.data; } @@ -151,10 +156,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async saveTreatWaterReuseDesignConstStatus( request: TreatWaterReuseDesignConstStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/treat-water-reuse-design-const-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/treat-water-reuse-design-const-status/save`, + request, + ); return response.data; } @@ -162,10 +168,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async submitTreatWaterReuseDesignConstStatus( request: TreatWaterReuseDesignConstStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/treat-water-reuse-design-const-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/treat-water-reuse-design-const-status/submit`, + request, + ); return response.data; } @@ -173,10 +180,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async getTreatWaterReuseBusinessApprStatusList( params: WaterReuseRequestParams, ): Promise { - const response = await stClient.get( - `${BASE}/treat-water-reuse-business-appr-status`, - withAuthHeader({ params }), - ); + const response = + await stClient.get( + `${BASE}/treat-water-reuse-business-appr-status`, + withAuthHeader({ params }), + ); return response.data; } @@ -184,10 +192,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async saveTreatWaterReuseBusinessApprStatus( request: TreatWaterReuseBusinessApprStatusSaveRequest, ): Promise { - const response = await stClient.put( - `${BASE}/treat-water-reuse-business-appr-status/save`, - request, - ); + const response = + await stClient.put( + `${BASE}/treat-water-reuse-business-appr-status/save`, + request, + ); return response.data; } @@ -195,10 +204,11 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async submitTreatWaterReuseBusinessApprStatus( request: TreatWaterReuseBusinessApprStatusSubmitRequest, ): Promise { - const response = await stClient.put( - `${BASE}/treat-water-reuse-business-appr-status/submit`, - request, - ); + const response = + await stClient.put( + `${BASE}/treat-water-reuse-business-appr-status/submit`, + request, + ); return response.data; } @@ -206,12 +216,14 @@ export class StatisticsInputWaterReuseApiService implements StatisticsInputWater public async updateWaterReuseOperationData( request: WaterReuseOperationDataUpdateRequest, ): Promise { - const response = await stClient.put( - `${BASE}/operation-data/update`, - request, - ); + const response = + await stClient.put( + `${BASE}/operation-data/update`, + request, + ); return response.data; } } -export const statisticsInputWaterReuseApi = new StatisticsInputWaterReuseApiService(); +export const statisticsInputWaterReuseApi = + new StatisticsInputWaterReuseApiService(); diff --git a/apps/st/src/entities/statistics/api/input/statistics-public-sewage-facility-input-service.ts b/apps/st/src/entities/statistics/api/input/statistics-public-sewage-facility-input-service.ts index bc81d6a8b..a1e1abb85 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-public-sewage-facility-input-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-public-sewage-facility-input-service.ts @@ -1,16 +1,16 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; import type { + PublicSewageFacilityOperationDataUpdateRequest, + PublicSewageFacilityOperationDataUpdateResponse, PublicSewageFacilityRequestParams, PublicSewageFacilityResponse, PublicSewageFacilitySaveRequest, PublicSewageFacilitySaveResponse, PublicSewageFacilitySubmitRequest, PublicSewageFacilitySubmitResponse, - PublicSewageFacilityOperationDataUpdateRequest, - PublicSewageFacilityOperationDataUpdateResponse, PublicSewageMainFacilityMappingSaveRequest, PublicSewageMainFacilityMappingSaveResponse, PublicSewageMainFacilityResponse, @@ -20,7 +20,9 @@ import type { } from "../../model/input/statistics-public-sewage-facility-input-interface"; export class StatisticsInputPublicSewageFacilityApiService implements StatisticsInputPublicSewageFacilityService { - public async getPublicSewageFacility(param: PublicSewageFacilityRequestParams): Promise { + public async getPublicSewageFacility( + param: PublicSewageFacilityRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/public-sewage-facility/facility`, withAuthHeader({ params: param }), @@ -28,7 +30,9 @@ export class StatisticsInputPublicSewageFacilityApiService implements Statistics return response.data; } - public async getPublicSewageMainFacility(param: PublicSewageFacilityRequestParams): Promise { + public async getPublicSewageMainFacility( + param: PublicSewageFacilityRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/public-sewage-facility/main-facility`, withAuthHeader({ params: param }), @@ -49,10 +53,11 @@ export class StatisticsInputPublicSewageFacilityApiService implements Statistics public async saveMainFacilityMapping( param: PublicSewageMainFacilityMappingSaveRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/public-sewage-facility/main-facility/save`, - param, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/public-sewage-facility/main-facility/save`, + param, + ); return response.data; } @@ -79,12 +84,14 @@ export class StatisticsInputPublicSewageFacilityApiService implements Statistics public async updatePublicSewageFacilityOperationData( param: PublicSewageFacilityOperationDataUpdateRequest, ): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/public-sewage-facility/operation-data/update`, - param, - ); + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/public-sewage-facility/operation-data/update`, + param, + ); return response.data; } } -export const statisticsInputPublicSewageFacilityApiService = new StatisticsInputPublicSewageFacilityApiService(); +export const statisticsInputPublicSewageFacilityApiService = + new StatisticsInputPublicSewageFacilityApiService(); diff --git a/apps/st/src/entities/statistics/api/input/statistics-sewage-pipe-input-service.ts b/apps/st/src/entities/statistics/api/input/statistics-sewage-pipe-input-service.ts index c506a5085..eb3df5271 100644 --- a/apps/st/src/entities/statistics/api/input/statistics-sewage-pipe-input-service.ts +++ b/apps/st/src/entities/statistics/api/input/statistics-sewage-pipe-input-service.ts @@ -1,75 +1,88 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; + import type { + SeweragePipeFacilitiesListRequest, + SeweragePipeFacilitiesListResponse, SeweragePipeFacilityAdminAreaListRequest, SeweragePipeFacilityAdminAreaListResponse, SeweragePipeFactConnectionSaveRequest, SeweragePipeFactConnectionSaveResponse, - SeweragePipeFacilitiesListRequest, - SeweragePipeFacilitiesListResponse, SeweragePipeInputConnectionStatusResponse, SeweragePipeInputFactInstallResponse, + SeweragePipeInputFactInstallStatusSaveRequest, + SeweragePipeInputFactInstallStatusSaveResponse, + SeweragePipeInputFactInstallStatusSubmitRequest, + SeweragePipeInputFactInstallStatusSubmitResponse, SeweragePipeInputManholeResponse, + SeweragePipeInputManholeStatusSaveRequest, + SeweragePipeInputManholeStatusSaveResponse, + SeweragePipeInputManholeStatusSubmitRequest, SeweragePipeInputPipeDiameterResponse, + SeweragePipeInputPipeDiameterStatusSaveRequest, + SeweragePipeInputPipeDiameterStatusSaveResponse, + SeweragePipeInputPipeDiameterStatusSubmitRequest, SeweragePipeInputPipeTypeResponse, + SeweragePipeInputPipeTypeStatusSaveRequest, + SeweragePipeInputPipeTypeStatusSaveResponse, + SeweragePipeInputPipeTypeStatusSubmitRequest, SeweragePipeInputRegionalFactStatusSaveRequest, SeweragePipeInputRegionalFactStatusSaveResponse, SeweragePipeInputRegionalFactStatusSubmitRequest, SeweragePipeInputRegionalFactStatusSubmitResponse, - SeweragePipeInputFactInstallStatusSubmitRequest, - SeweragePipeInputFactInstallStatusSubmitResponse, SeweragePipeInputRegionalResponse, + SeweragePipeInputSubmitResponse, SeweragePipeRequestParams, StatisticsInputSewPipeService, - SeweragePipeInputFactInstallStatusSaveRequest, - SeweragePipeInputFactInstallStatusSaveResponse, - SeweragePipeInputPipeTypeStatusSaveRequest, - SeweragePipeInputPipeTypeStatusSaveResponse, - SeweragePipeInputPipeTypeStatusSubmitRequest, - SeweragePipeInputPipeDiameterStatusSaveRequest, - SeweragePipeInputPipeDiameterStatusSaveResponse, - SeweragePipeInputPipeDiameterStatusSubmitRequest, - SeweragePipeInputManholeStatusSaveRequest, - SeweragePipeInputManholeStatusSaveResponse, - SeweragePipeInputManholeStatusSubmitRequest, - SeweragePipeInputSubmitResponse, } from "../../model/input/statistics-sewage-pipe-input-interface"; export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeService { - public async getRegionalFactStatus(param: SeweragePipeRequestParams): Promise { - const response = await stClient.get ( + public async getRegionalFactStatus( + param: SeweragePipeRequestParams, + ): Promise { + const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status`, withAuthHeader({ params: param }), ); return response.data; } - public async getFactInstallStatus(param: SeweragePipeRequestParams): Promise { - const response = await stClient.get ( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status`, - withAuthHeader({ params: param }), - ); + public async getFactInstallStatus( + param: SeweragePipeRequestParams, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status`, + withAuthHeader({ params: param }), + ); return response.data; } - public async getPipeTypeStatus(param: SeweragePipeRequestParams): Promise { - const response = await stClient.get ( + public async getPipeTypeStatus( + param: SeweragePipeRequestParams, + ): Promise { + const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-type-status`, withAuthHeader({ params: param }), ); return response.data; } - public async getPipeDiameterStatus(param: SeweragePipeRequestParams): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-diameter-status`, - withAuthHeader({ params: param }), - ); + public async getPipeDiameterStatus( + param: SeweragePipeRequestParams, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-diameter-status`, + withAuthHeader({ params: param }), + ); return response.data; } - public async getManholeStatus(param: SeweragePipeRequestParams): Promise { + public async getManholeStatus( + param: SeweragePipeRequestParams, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/manhole-status`, withAuthHeader({ params: param }), @@ -77,15 +90,20 @@ export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeS return response.data; } - public async getConnectionStatus(param: SeweragePipeRequestParams): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status`, - withAuthHeader({ params: param }), - ); + public async getConnectionStatus( + param: SeweragePipeRequestParams, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status`, + withAuthHeader({ params: param }), + ); return response.data; } - public async getFacilitiesList(param: SeweragePipeFacilitiesListRequest): Promise { + public async getFacilitiesList( + param: SeweragePipeFacilitiesListRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status/popup/facilities`, withAuthHeader({ params: param }), @@ -93,63 +111,86 @@ export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeS return response.data; } - public async getFacilityAdminAreaList(param: SeweragePipeFacilityAdminAreaListRequest): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status/popup/areas`, - withAuthHeader({ params: param }), - ); + public async getFacilityAdminAreaList( + param: SeweragePipeFacilityAdminAreaListRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status/popup/areas`, + withAuthHeader({ params: param }), + ); return response.data; } - public async saveFactConnection(param: SeweragePipeFactConnectionSaveRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status/popup/save`, - param, - ); + public async saveFactConnection( + param: SeweragePipeFactConnectionSaveRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status/popup/save`, + param, + ); return response.data; } - public async saveRegionalFactStatus(param: SeweragePipeInputRegionalFactStatusSaveRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status/save`, - param, - ); + public async saveRegionalFactStatus( + param: SeweragePipeInputRegionalFactStatusSaveRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status/save`, + param, + ); return response.data; } - public async submitRegionalFactStatus(param: SeweragePipeInputRegionalFactStatusSubmitRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status/submit`, - param, - ); + public async submitRegionalFactStatus( + param: SeweragePipeInputRegionalFactStatusSubmitRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status/submit`, + param, + ); return response.data; } - public async saveFactInstallStatus(param: SeweragePipeInputFactInstallStatusSaveRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status/save`, - param, - ); + public async saveFactInstallStatus( + param: SeweragePipeInputFactInstallStatusSaveRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status/save`, + param, + ); return response.data; } - public async submitFactInstallStatus(param: SeweragePipeInputFactInstallStatusSubmitRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status/submit`, - param, - ); + public async submitFactInstallStatus( + param: SeweragePipeInputFactInstallStatusSubmitRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status/submit`, + param, + ); return response.data; } - public async savePipeTypeStatus(param: SeweragePipeInputPipeTypeStatusSaveRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-type-status/save`, - param, - ); + public async savePipeTypeStatus( + param: SeweragePipeInputPipeTypeStatusSaveRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-type-status/save`, + param, + ); return response.data; } - public async submitPipeTypeStatus(param: SeweragePipeInputPipeTypeStatusSubmitRequest): Promise { + public async submitPipeTypeStatus( + param: SeweragePipeInputPipeTypeStatusSubmitRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-type-status/submit`, param, @@ -157,15 +198,20 @@ export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeS return response.data; } - public async savePipeDiameterStatus(param: SeweragePipeInputPipeDiameterStatusSaveRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-diameter-status/save`, - param, - ); + public async savePipeDiameterStatus( + param: SeweragePipeInputPipeDiameterStatusSaveRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-diameter-status/save`, + param, + ); return response.data; } - public async submitPipeDiameterStatus(param: SeweragePipeInputPipeDiameterStatusSubmitRequest): Promise { + public async submitPipeDiameterStatus( + param: SeweragePipeInputPipeDiameterStatusSubmitRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/pipe-diameter-status/submit`, param, @@ -173,21 +219,27 @@ export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeS return response.data; } - public async saveManholeStatus(param: SeweragePipeInputManholeStatusSaveRequest): Promise { - const response = await stClient.put( - `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/manhole-status/save`, - param, - ); + public async saveManholeStatus( + param: SeweragePipeInputManholeStatusSaveRequest, + ): Promise { + const response = + await stClient.put( + `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/manhole-status/save`, + param, + ); return response.data; } - public async submitManholeStatus(param: SeweragePipeInputManholeStatusSubmitRequest): Promise { + public async submitManholeStatus( + param: SeweragePipeInputManholeStatusSubmitRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/manhole-status/submit`, param, ); return response.data; } -}; +} -export const statisticsInputSewPipeApiService = new StatisticsInputSewPipeApiService(); \ No newline at end of file +export const statisticsInputSewPipeApiService = + new StatisticsInputSewPipeApiService(); diff --git a/apps/st/src/entities/statistics/api/sewer-st-user-service.ts b/apps/st/src/entities/statistics/api/sewer-st-user-service.ts index fb0184820..89ee337a9 100644 --- a/apps/st/src/entities/statistics/api/sewer-st-user-service.ts +++ b/apps/st/src/entities/statistics/api/sewer-st-user-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import type { diff --git a/apps/st/src/entities/statistics/api/statistics-management-service.ts b/apps/st/src/entities/statistics/api/statistics-management-service.ts index 93bed5573..94f1636c5 100644 --- a/apps/st/src/entities/statistics/api/statistics-management-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-management-service.ts @@ -1,81 +1,80 @@ +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; -import { stClient } from "@/shared/api/client"; - -import type { - StatsInputStatusReviewApiResponse, - ReviewHistoryRequest, - ReviewHistoryResponse, -} from "../model/statistics-input-review-interface"; -import { - type SewerageSupplyRateReviewRequestParams, - type SewerageSupplyRateReviewApiResponse, -} from "../model/statistics-sewerage-penetration-review-interface"; -import { - type SewagePipeReviewRequestParams, - type SewagePipeReviewRegionalApiResponse, - type SewagePipeFacilityApiResponse, - type SewerPipeTypeApiResponse, - type SewerPipeDiamApiResponse, - type SewagePipeManholeApiResponse, -} from "../model/statistics-sewage-pipe-review-interface"; -import { - type SewerPipeMtcApiResponse, - type SewerPipeDrdgApiResponse, - type SewerPipeMtcRequestParams -} from "../model/statistics-sewage-pipe-mtc-review-interface"; import { + type PumpingStationRegionalApiResponse, type SewerReservoirRegionalApiResponse, - type PumpingStationRegionalApiResponse } from "../model/sewage-reservoir-pump-review-interface"; -import { - type MediationPumpStationApiResponse, -} from "../model/statistics-pumping-station-review-interface"; -import { - type PublicSewageFacilityReviewApiResponse, - type PublicSewageFacilityReviewRequestParams, -} from "../model/statistics-public-sewage-facility-review-interface"; import { type ExcretaTreatmentFacilityReviewApiResponse, type ExcretaTreatmentFacilityReviewRequestParams, } from "../model/statistics-excreta-treatment-facility-review-interface"; +import type { + ReviewHistoryRequest, + ReviewHistoryResponse, + StatsInputStatusReviewApiResponse, +} from "../model/statistics-input-review-interface"; import { type PrivateSewageFacilityReviewApiResponse, type PrivateSewageFacilityReviewRequestParams, } from "../model/statistics-private-sewage-facility-review-interface"; import { - type SewerageFinanceReviewApiResponse, - type SewerageFinanceReviewRequestParams, -} from "../model/statistics-sewerage-finance-review-interface"; -import { - type WaterReuseReviewApiResponse, - type WaterReuseReviewRequestParams, -} from "../model/statistics-water-reuse-review-interface"; -import { - type SewageExcretaSlurgeReviewApiResponse, - type SewageExcretaSlurgeReviewRequestParams, -} from "../model/statistics-sewage-excreta-slurge-review-interface"; + type PublicSewageFacilityReviewApiResponse, + type PublicSewageFacilityReviewRequestParams, +} from "../model/statistics-public-sewage-facility-review-interface"; +import { type MediationPumpStationApiResponse } from "../model/statistics-pumping-station-review-interface"; import { type SewageExcretaRelatedReviewApiResponse, type SewageExcretaRelatedReviewRequestParams, } from "../model/statistics-sewage-excreta-related-review-interface"; +import { + type SewageExcretaSlurgeReviewApiResponse, + type SewageExcretaSlurgeReviewRequestParams, +} from "../model/statistics-sewage-excreta-slurge-review-interface"; +import { + type SewerPipeDrdgApiResponse, + type SewerPipeMtcApiResponse, + type SewerPipeMtcRequestParams, +} from "../model/statistics-sewage-pipe-mtc-review-interface"; +import { + type SewagePipeFacilityApiResponse, + type SewagePipeManholeApiResponse, + type SewagePipeReviewRegionalApiResponse, + type SewagePipeReviewRequestParams, + type SewerPipeDiamApiResponse, + type SewerPipeTypeApiResponse, +} from "../model/statistics-sewage-pipe-review-interface"; +import { + type SewerageFinanceReviewApiResponse, + type SewerageFinanceReviewRequestParams, +} from "../model/statistics-sewerage-finance-review-interface"; +import { + type SewerageSupplyRateReviewApiResponse, + type SewerageSupplyRateReviewRequestParams, +} from "../model/statistics-sewerage-penetration-review-interface"; import { type SewerageServiceLevelReviewApiResponse, type SewerageServiceLevelReviewRequestParams, } from "../model/statistics-sewerage-service-level-review-interface"; - +import { + type WaterReuseReviewApiResponse, + type WaterReuseReviewRequestParams, +} from "../model/statistics-water-reuse-review-interface"; export class StatisticsManagementApiService { /** * 00. 통계 입력 현황 목록 조회 * @param params (yr, bsnmCd, sido, gugun) */ - public async getStatsInputStatusList( - params: { statsYr?: string; sewerBzmnCd?: string; ctpvNm?: string; sggNm?: string } - ): Promise { + public async getStatsInputStatusList(params: { + statsYr?: string; + sewerBzmnCd?: string; + ctpvNm?: string; + sggNm?: string; + }): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/input-status`, - { params } + { params }, ); return response.data; } @@ -85,12 +84,13 @@ export class StatisticsManagementApiService { * @param params (sido, gugun, yr, bsnmCd) */ public async getSewerageSupplyRateReviewList( - params: SewerageSupplyRateReviewRequestParams + params: SewerageSupplyRateReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/supply-rate`, - { params } - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/supply-rate`, + { params }, + ); return response.data; } @@ -99,12 +99,13 @@ export class StatisticsManagementApiService { * @param params (sido, gugun, yr, bsnmCd, fctName) */ public async getPublicSewageFacilityReviewList( - params: PublicSewageFacilityReviewRequestParams + params: PublicSewageFacilityReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/public-sewage`, - { params } - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/public-sewage`, + { params }, + ); return response.data; } @@ -115,10 +116,11 @@ export class StatisticsManagementApiService { public async getExcretaTreatmentFacilityReviewList( params: ExcretaTreatmentFacilityReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/excreta-treatment`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/excreta-treatment`, + { params }, + ); return response.data; } @@ -127,12 +129,13 @@ export class StatisticsManagementApiService { * @param params (sido, gugun, yr, bsnmCd) */ public async getSewagePipeReviewRegionalList( - params: SewagePipeReviewRequestParams + params: SewagePipeReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/regional-status`, - { params } - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/regional-status`, + { params }, + ); return response.data; } @@ -141,25 +144,25 @@ export class StatisticsManagementApiService { * @param params (sido, gugun, yr, bsnmCd) */ public async getSewagePipeFacilityList( - params: SewagePipeReviewRequestParams + params: SewagePipeReviewRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/facility-status`, - { params } + { params }, ); return response.data; } /** - * 02. 하수관로 관종별 시설현황 조회 (Tab3) - * @param params (sido, gugun, yr, bsnmCd) - */ + * 02. 하수관로 관종별 시설현황 조회 (Tab3) + * @param params (sido, gugun, yr, bsnmCd) + */ public async getSewagePipeTypeList( - params: SewagePipeReviewRequestParams + params: SewagePipeReviewRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/type-status`, - { params } + { params }, ); return response.data; } @@ -169,11 +172,11 @@ export class StatisticsManagementApiService { * @param params (sido, gugun, yr, bsnmCd) */ public async getSewagePipeDiamList( - params: SewagePipeReviewRequestParams + params: SewagePipeReviewRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/diam-status`, - { params } + { params }, ); return response.data; } @@ -183,11 +186,11 @@ export class StatisticsManagementApiService { * @param params (sido, gugun, yr, bsnmCd) */ public async getSewagePipeManholeList( - params: SewagePipeReviewRequestParams + params: SewagePipeReviewRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe/manhole`, - { params } + { params }, ); return response.data; } @@ -197,11 +200,11 @@ export class StatisticsManagementApiService { * @param params (yr, bsnmCd, sido, gugun) */ public async getSewerPipeMtcList( - params: SewerPipeMtcRequestParams + params: SewerPipeMtcRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe-mtc/repair`, - { params } + { params }, ); return response.data; } @@ -211,11 +214,11 @@ export class StatisticsManagementApiService { * @param params (yr, bsnmCd, sido, gugun) */ public async getSewerPipeDrdgList( - params: SewerPipeMtcRequestParams + params: SewerPipeMtcRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-pipe-mtc/dredging`, - { params } + { params }, ); return response.data; } @@ -225,11 +228,11 @@ export class StatisticsManagementApiService { * @param params (yr, bsnmCd, sido, gugun) */ public async getSewerReservoirList( - params: SewerPipeMtcRequestParams + params: SewerPipeMtcRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-reservoir/facilities`, - { params } + { params }, ); return response.data; } @@ -239,11 +242,11 @@ export class StatisticsManagementApiService { * @param params (yr, bsnmCd, sido, gugun) */ public async getPumpStationList( - params: SewerPipeMtcRequestParams + params: SewerPipeMtcRequestParams, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/sewer-reservoir/pumping-stations`, - { params } + { params }, ); return response.data; } @@ -252,18 +255,16 @@ export class StatisticsManagementApiService { * 05. 중계펌프장 통계관리 조회 * @param params (yr, bsnmCd, sido, gugun, bscFctNm) */ - public async getMediationPumpStationList( - params: { - ctpvNm?: string; - sggNm?: string; - statsYr?: string; - sewerBzmnCd?: string; - fcltNm?: string; - } - ): Promise { + public async getMediationPumpStationList(params: { + ctpvNm?: string; + sggNm?: string; + statsYr?: string; + sewerBzmnCd?: string; + fcltNm?: string; + }): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/mediation-pump-stations`, - { params } + { params }, ); return response.data; } @@ -274,10 +275,11 @@ export class StatisticsManagementApiService { public async getPrivateSewageTreatFactStatusReviewList( params: PrivateSewageFacilityReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/private-sevage`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/private-sevage`, + { params }, + ); return response.data; } @@ -287,10 +289,11 @@ export class StatisticsManagementApiService { public async getSepticTankStatusReviewList( params: PrivateSewageFacilityReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/private-tank-status`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/private-tank-status`, + { params }, + ); return response.data; } @@ -300,10 +303,11 @@ export class StatisticsManagementApiService { public async getPrivateSewageDesigStatusReviewList( params: PrivateSewageFacilityReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/private-mgmt-area`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/private-mgmt-area`, + { params }, + ); return response.data; } @@ -430,10 +434,11 @@ export class StatisticsManagementApiService { public async getSludgeProcessingReviewList( params: SewageExcretaSlurgeReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-processing`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-processing`, + { params }, + ); return response.data; } @@ -443,10 +448,11 @@ export class StatisticsManagementApiService { public async getSludgeDigestionTankReviewList( params: SewageExcretaSlurgeReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-digestion-tank`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-digestion-tank`, + { params }, + ); return response.data; } @@ -456,10 +462,11 @@ export class StatisticsManagementApiService { public async getSludgeFacilityOperReviewList( params: SewageExcretaSlurgeReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-facility-oper`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-facility-oper`, + { params }, + ); return response.data; } @@ -469,10 +476,11 @@ export class StatisticsManagementApiService { public async getHumanWasteSludgeReviewList( params: SewageExcretaSlurgeReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-human-waste`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/sludge-human-waste`, + { params }, + ); return response.data; } @@ -482,10 +490,11 @@ export class StatisticsManagementApiService { public async getPublicSewageStaffReviewList( params: SewageExcretaRelatedReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/public-sewage-staff`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/public-sewage-staff`, + { params }, + ); return response.data; } @@ -495,10 +504,11 @@ export class StatisticsManagementApiService { public async getPublicHumanWasteStaffReviewList( params: SewageExcretaRelatedReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/public-human-waste-staff`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/public-human-waste-staff`, + { params }, + ); return response.data; } @@ -508,10 +518,11 @@ export class StatisticsManagementApiService { public async getHumanWasteCollectionReviewList( params: SewageExcretaRelatedReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/human-waste-collection`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/human-waste-collection`, + { params }, + ); return response.data; } @@ -521,10 +532,11 @@ export class StatisticsManagementApiService { public async getIndvSwtrmtRelBsnsReviewList( params: SewageExcretaRelatedReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/indv-swtrmt-rel-bsns`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/indv-swtrmt-rel-bsns`, + { params }, + ); return response.data; } @@ -534,10 +546,11 @@ export class StatisticsManagementApiService { public async getSewageComplaintReviewList( params: SewerageServiceLevelReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/sewage-complaint`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/sewage-complaint`, + { params }, + ); return response.data; } @@ -547,21 +560,24 @@ export class StatisticsManagementApiService { public async getResidentFriendlyFacilityReviewList( params: SewerageServiceLevelReviewRequestParams, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/resident-friendly-facility`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/resident-friendly-facility`, + { params }, + ); return response.data; } - public async getReviewHistory(params: ReviewHistoryRequest): Promise { + public async getReviewHistory( + params: ReviewHistoryRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/history`, - { params } + { params }, ); return response.data; } } // 통합 인스턴스 수출 -export const statisticsManagementApi = new StatisticsManagementApiService(); \ No newline at end of file +export const statisticsManagementApi = new StatisticsManagementApiService(); diff --git a/apps/st/src/entities/statistics/api/statistics-ppltn-service.ts b/apps/st/src/entities/statistics/api/statistics-ppltn-service.ts index 84565434d..a4dbffa97 100644 --- a/apps/st/src/entities/statistics/api/statistics-ppltn-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-ppltn-service.ts @@ -1,29 +1,28 @@ +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; -import { stClient } from "@/shared/api/client"; import type { - DomesticPopulationListResponse, DomesticPopulationFinalResponse, - UpperCodesByNameResponse, + DomesticPopulationListResponse, DomesticPopulationMappingItem, + UpperCodesByNameResponse, } from "../model/ppltn/statistics-domestic-population-interface"; // 1. 응답 데이터의 타입을 정의합니다 (이미 정의된 것이 있다면 그것을 사용하세요) interface ChartDataResponse { - status: string; - data: { - X_AXIS: string[]; - TOT: number[]; - ORIGIN_MALE: (number | null)[]; - ORIGIN_FEMALE: (number | null)[]; - FOREIGN_MALE: (number | null)[]; - FOREIGN_FEMALE: (number | null)[]; - }; - message?: string; + status: string; + data: { + X_AXIS: string[]; + TOT: number[]; + ORIGIN_MALE: (number | null)[]; + ORIGIN_FEMALE: (number | null)[]; + FOREIGN_MALE: (number | null)[]; + FOREIGN_FEMALE: (number | null)[]; + }; + message?: string; } export class StatisticsPpltnApiService { - /** 내국인 엑셀 임시 업로드 */ public async uploadDomesticPopulationExcel( file: File, @@ -33,11 +32,12 @@ export class StatisticsPpltnApiService { formData.append("file", file); formData.append("statsYr", statsYr); - const response = await stClient.post<{ status: string; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/domestic-population-excel`, - formData, - { headers: { "Content-Type": "multipart/form-data" } }, - ); + const response = await stClient.post<{ + status: string; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/domestic-population-excel`, formData, { + headers: { "Content-Type": "multipart/form-data" }, + }); return response.data; } @@ -71,22 +71,22 @@ export class StatisticsPpltnApiService { public async getUpperCodesByName( statsYr: string, admdstNm: string, - admdstCd: string + admdstCd: string, ): Promise { // GET 요청으로 변경하고 params 객체를 추가합니다. const response = await stClient.get( `${ENDPOINT.ST_SERVICE.PPLTN}/upper-codes-by-name`, - { - params: { statsYr, admdstNm,admdstCd } + { + params: { statsYr, admdstNm, admdstCd }, }, ); return response.data; } - + /* ════════════════════════════════════ 외국인 ════════════════════════════════════ */ - + /** 외국인 엑셀 임시 업로드 */ public async uploadForeignPopulationExcel( file: File, @@ -95,14 +95,15 @@ export class StatisticsPpltnApiService { const formData = new FormData(); formData.append("file", file); formData.append("statsYr", statsYr); - const response = await stClient.post<{ status: string; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-excel`, - formData, - { headers: { "Content-Type": "multipart/form-data" } }, - ); + const response = await stClient.post<{ + status: string; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-excel`, formData, { + headers: { "Content-Type": "multipart/form-data" }, + }); return response.data; } - + /** 외국인 임시 적재 리스트 조회 * @param opt1 "1" = 전체 리스트(좌측), "2" = 미매핑 리스트(우측) */ @@ -110,30 +111,35 @@ export class StatisticsPpltnApiService { statsYr: string, opt1: "1" | "2", ): Promise<{ status: string; data: object[]; message?: string }> { - const response = await stClient.get<{ status: string; data: object[]; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-list`, - { params: { statsYr, opt1 } }, - ); + const response = await stClient.get<{ + status: string; + data: object[]; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-list`, { + params: { statsYr, opt1 }, + }); return response.data; } - + /** 외국인 최종 마스터 반영 */ public async saveForeignPopulationFinal( statsYr: string, regList: DomesticPopulationMappingItem[], ): Promise<{ status: string; message?: string }> { - const response = await stClient.post<{ status: string; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-final`, - { statsYr, regList }, - ); + const response = await stClient.post<{ + status: string; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/foreign-population-final`, { + statsYr, + regList, + }); return response.data; } - /* ════════════════════════════════════ 행정동갱신 ════════════════════════════════════ */ - + /** 행정동 갱신 — 감축/추가 행정구역 조회 * @param opt1 "1" = 추가된 행정구역, "2" = 감축된 행정구역 */ @@ -141,25 +147,31 @@ export class StatisticsPpltnApiService { statsYr: string, opt1: "1" | "2", ): Promise<{ status: string; data: object[]; message?: string }> { - const response = await stClient.get<{ status: string; data: object[]; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/search`, - { params: { statsYr, opt1 } }, - ); + const response = await stClient.get<{ + status: string; + data: object[]; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/search`, { + params: { statsYr, opt1 }, + }); return response.data; } - + /** 행정동 갱신 — 감축/추가 반영 */ public async saveChangedArea( reducedList: object[], addedList: object[], ): Promise<{ status: string; message?: string }> { - const response = await stClient.post<{ status: string; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/save`, - { reducedList, addedList }, - ); + const response = await stClient.post<{ + status: string; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/save`, { + reducedList, + addedList, + }); return response.data; } - + // /** 행정동 갱신 — 법정동코드 후보 조회 (행정동명 클릭 시) */ // public async getRenewalUpperCodesByName( // statsYr: string, @@ -167,29 +179,29 @@ export class StatisticsPpltnApiService { // ): Promise { // const response = await stClient.get( // `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/upper-codes-by-name`, - // { - // params: { statsYr, admdstNm } + // { + // params: { statsYr, admdstNm } // }, // ); // return response.data; // } /** 행정동 갱신 — 법정동코드 후보 조회 */ -public async getLawCdsByName( - adstCd : string, -): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/law-codes-by-name`, - { - params: { adstCd } - }, - ); - return response.data; -} - /* ════════════════════════════════════ + public async getLawCdsByName( + adstCd: string, + ): Promise { + const response = await stClient.get( + `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/law-codes-by-name`, + { + params: { adstCd }, + }, + ); + return response.data; + } + /* ════════════════════════════════════ 행정인구현황 ════════════════════════════════════ */ - + /** 행정인구현황 — 체크박스 조건에 따른 인구 현황 조회 */ public async searchPopByEachCondition( statsYr: string, @@ -198,18 +210,19 @@ public async getLawCdsByName( fMale: boolean, fFemale: boolean, ): Promise<{ status: string; data: object[]; message?: string }> { - const response = await stClient.get<{ status: string; data: object[]; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/pop-by-condition`, - { - params: { - statsYr, - oMale: oMale ? "TRUE" : "FALSE", - oFemale: oFemale ? "TRUE" : "FALSE", - fMale: fMale ? "TRUE" : "FALSE", - fFemale: fFemale ? "TRUE" : "FALSE", - } + const response = await stClient.get<{ + status: string; + data: object[]; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/pop-by-condition`, { + params: { + statsYr, + oMale: oMale ? "TRUE" : "FALSE", + oFemale: oFemale ? "TRUE" : "FALSE", + fMale: fMale ? "TRUE" : "FALSE", + fFemale: fFemale ? "TRUE" : "FALSE", }, - ); + }); return response.data; } @@ -230,21 +243,23 @@ public async getLawCdsByName( oFemale: oFemale ? "TRUE" : "FALSE", fMale: fMale ? "TRUE" : "FALSE", fFemale: fFemale ? "TRUE" : "FALSE", - } + }, }, ); return response.data; } /** 행정동 갱신 — MATERIALIZED VIEW 갱신 */ - public async refreshMaterializedViews(): Promise<{ status: string; message?: string }> { - const response = await stClient.post<{ status: string; message?: string }>( - `${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/refresh`, - ); + public async refreshMaterializedViews(): Promise<{ + status: string; + message?: string; + }> { + const response = await stClient.post<{ + status: string; + message?: string; + }>(`${ENDPOINT.ST_SERVICE.PPLTN}/admdst-renewal/refresh`); return response.data; } } - - -export const statisticsPpltnApi = new StatisticsPpltnApiService(); \ No newline at end of file +export const statisticsPpltnApi = new StatisticsPpltnApiService(); diff --git a/apps/st/src/entities/statistics/api/statistics-service.ts b/apps/st/src/entities/statistics/api/statistics-service.ts index 557c47150..5762b0bfe 100644 --- a/apps/st/src/entities/statistics/api/statistics-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-service.ts @@ -1,4 +1,4 @@ -import { client, stClient } from "@/shared/api/client"; +import { client, stClient } from "@/shared/api"; import { withAuthHeader } from "@/shared/api/with-auth-header"; import { ENDPOINT } from "@/shared/config"; @@ -98,7 +98,9 @@ export class StatisticsApiService implements StatisticsService { return response.data; } - public async getStatsInputPeriodDetail(params: StatsInputPeriodDetailRequest): Promise { + public async getStatsInputPeriodDetail( + params: StatsInputPeriodDetailRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.DASHBOARD}/schedule-info/detail`, withAuthHeader({ params }), @@ -122,10 +124,11 @@ export class StatisticsApiService implements StatisticsService { public async deleteStatsInputPeriod( param: StatsInputPeriodDeleteRequest, ): Promise { - const response = await stClient.delete( - `${ENDPOINT.ST_SERVICE.DASHBOARD}/schedule-info`, - withAuthHeader({ data: param }), - ); + const response = + await stClient.delete( + `${ENDPOINT.ST_SERVICE.DASHBOARD}/schedule-info`, + withAuthHeader({ data: param }), + ); return response.data; } @@ -241,7 +244,9 @@ export class StatisticsApiService implements StatisticsService { } const type = first.type; if (!items.every((i) => i.type === type)) { - throw new Error("saveInputReturn: 모든 항목의 type이 같아야 합니다."); + throw new Error( + "saveInputReturn: 모든 항목의 type이 같아야 합니다.", + ); } const body = items.map(({ type: _t, rjctOpnnCn, ...rest }) => { const row: Record = { @@ -288,7 +293,9 @@ export class StatisticsApiService implements StatisticsService { return response.data; } - public async getVerificationResultList(param: VerificationResultListRequest): Promise { + public async getVerificationResultList( + param: VerificationResultListRequest, + ): Promise { const { statsCd, ...rest } = param; const params: VerificationResultListRequest = { ...rest, @@ -301,7 +308,9 @@ export class StatisticsApiService implements StatisticsService { return response.data; } - public async SubmitVerifyException(param: SubmitVerifyExceptionRequest): Promise { + public async SubmitVerifyException( + param: SubmitVerifyExceptionRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUTVERIFY}/results/exception`, param, @@ -309,7 +318,9 @@ export class StatisticsApiService implements StatisticsService { return response.data; } - public async getReviewerInfo(param: ReviewerInfoRequest): Promise { + public async getReviewerInfo( + param: ReviewerInfoRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.REVIEW}/reviewer-info`, withAuthHeader({ params: param }), @@ -317,31 +328,40 @@ export class StatisticsApiService implements StatisticsService { return response.data; } - public async getStatiscicsManagementReviewHistory(param: StatiscicsManagementReviewHistoryRequest): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.REVIEW}/stats-review`, - { params: param }, - ); + public async getStatiscicsManagementReviewHistory( + param: StatiscicsManagementReviewHistoryRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.REVIEW}/stats-review`, + { params: param }, + ); return response.data; } - public async StatiscicsExceptionReset(param: StatiscicsExceptionResetRequest): Promise { + public async StatiscicsExceptionReset( + param: StatiscicsExceptionResetRequest, + ): Promise { const response = await stClient.put( `${ENDPOINT.ST_SERVICE.INPUTVERIFY}/results/exception/reset`, param, ); return response.data; } - - public async CheckStatusCode(param: CheckStatusCodeRequest): Promise { + + public async CheckStatusCode( + param: CheckStatusCodeRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.INPUTCOMMON}/status-code`, { params: param }, ); return response.data; } - - public async getUnSubmitData(param: unSubmitDataRequest): Promise { + + public async getUnSubmitData( + param: unSubmitDataRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.DASHBOARD}/submission-status`, { params: param }, diff --git a/apps/st/src/entities/statistics/api/statistics-sewerage-aggregate-summary-service.ts b/apps/st/src/entities/statistics/api/statistics-sewerage-aggregate-summary-service.ts index 1cbade954..1df4403b8 100644 --- a/apps/st/src/entities/statistics/api/statistics-sewerage-aggregate-summary-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-sewerage-aggregate-summary-service.ts @@ -1,4 +1,4 @@ -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { SEWERAGE_AGGREGATE_SUMMARY_EXCEL_MIME, @@ -17,7 +17,9 @@ const DOWNLOAD_TIMEOUT_MS = 3_600_000; function parseDownloadFileName(contentDisposition: string): string | undefined { if (!contentDisposition) return undefined; - const utf8Match = contentDisposition.match(/filename\*\s*=\s*UTF-8''([^;]+)/i); + const utf8Match = contentDisposition.match( + /filename\*\s*=\s*UTF-8''([^;]+)/i, + ); if (utf8Match?.[1]) { return decodeURIComponent(utf8Match[1].trim()); } @@ -44,13 +46,13 @@ async function parseBlobErrorMessage(data: Blob): Promise { } } -export class StatisticsSewerageAggregateSummaryApiService - implements StatisticsSewerageAggregateSummaryService -{ +export class StatisticsSewerageAggregateSummaryApiService implements StatisticsSewerageAggregateSummaryService { /** 하수도 통계 총괄표 — 통계항목(탭) 목록 */ public async getAggregateSummaryTabList(): Promise { const response = - await stClient.get(INDICATORS_URL); + await stClient.get( + INDICATORS_URL, + ); return response.data; } @@ -70,8 +72,12 @@ export class StatisticsSewerageAggregateSummaryApiService signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS), }); - const contentType = String(response.headers.get("content-type") ?? ""); - const contentDisposition = String(response.headers.get("content-disposition") ?? ""); + const contentType = String( + response.headers.get("content-type") ?? "", + ); + const contentDisposition = String( + response.headers.get("content-disposition") ?? "", + ); const data = await response.blob(); if (!response.ok) { @@ -87,7 +93,10 @@ export class StatisticsSewerageAggregateSummaryApiService fileName: parseDownloadFileName(contentDisposition), }; } catch (error) { - if (error instanceof DOMException && error.name === "TimeoutError") { + if ( + error instanceof DOMException && + error.name === "TimeoutError" + ) { throw new Error( "엑셀 생성 시간이 초과되었습니다. 선택 항목을 줄이거나 잠시 후 다시 시도해주세요.", ); diff --git a/apps/st/src/entities/statistics/api/statistics-total-service.ts b/apps/st/src/entities/statistics/api/statistics-total-service.ts index be7f839b9..df92096ec 100644 --- a/apps/st/src/entities/statistics/api/statistics-total-service.ts +++ b/apps/st/src/entities/statistics/api/statistics-total-service.ts @@ -1,111 +1,107 @@ +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; -import { stClient } from "@/shared/api/client"; - -import type { SewerageSupplyRateRequest, SewerageSupplyRateResponse } from "../model/statistics-total/statistics-sewage-supply-rate-total-interface"; -import type { - SewagePipeMaintainDredgingTotalResponse, - SewagePipeMaintainTotalRequest, - SewagePipeMaintainRepairTotalResponse, -} from "../model/statistics-total/statistics-sewage-pipe-maintain-total-interface"; -import type { - SewagePipeFactInstallStatusResponse, - SewagePipePipeDiamStatusResponse, - SewagePipePipeTypeFacilityStatusResponse, - FcltyManholeSummaryResponse, - SewagePipeTotalRequest, - SewagePipeTotalResponse, -} from "../model/statistics-total/statistics-sewage-pipe-total-interface"; -import type { - SewerageServiceLevelComplaintResponse, - SewerageServiceLevelRequest, - SewerageServiceLevelResidentFriendlyFactResponse -} from "../model/statistics-total/statistics-service-level-total-interface"; -import type { - PublicSewageInquirySummaryResponse -} from "../model/statistics-total/statistics-sewage-public-total-interface"; -import type { - SewerReservoirMaintainTotalRequest, - SewerReservoirStatusTotalResponse, - SewerPumpStationStatusTotalResponse -} from "../model/statistics-total/statistics-sewage-reservoir-total-interface"; - -import type { - MediationPumpMaintainTotalRequest, - MediationPumpStatusTotalResponse -} from "../model/statistics-total/statistics-mediation-pump-total-interface"; import type { ExcretaTreatmentMaintainTotalRequest, - ExcretaTreatmentStatusTotalResponse + ExcretaTreatmentStatusTotalResponse, } from "../model/statistics-total/statistics-excreta-treatment-total-interface"; - - +import type { + MediationPumpMaintainTotalRequest, + MediationPumpStatusTotalResponse, +} from "../model/statistics-total/statistics-mediation-pump-total-interface"; import type { PrivateSewageFacilitySummaryRequest, PrivateSewageTab1Response, PrivateSewageTab2Response, - PrivateSewageTab3Response + PrivateSewageTab3Response, } from "../model/statistics-total/statistics-private-sewage-total-interface"; - import type { - SewerageFinanceSummaryRequest, - SewerageFinanceSettlementResponse, + SewerageServiceLevelComplaintResponse, + SewerageServiceLevelRequest, + SewerageServiceLevelResidentFriendlyFactResponse, +} from "../model/statistics-total/statistics-service-level-total-interface"; +import type { + SewagePipeMaintainDredgingTotalResponse, + SewagePipeMaintainRepairTotalResponse, + SewagePipeMaintainTotalRequest, +} from "../model/statistics-total/statistics-sewage-pipe-maintain-total-interface"; +import type { + FcltyManholeSummaryResponse, + SewagePipeFactInstallStatusResponse, + SewagePipePipeDiamStatusResponse, + SewagePipePipeTypeFacilityStatusResponse, + SewagePipeTotalRequest, + SewagePipeTotalResponse, +} from "../model/statistics-total/statistics-sewage-pipe-total-interface"; +import type { PublicSewageInquirySummaryResponse } from "../model/statistics-total/statistics-sewage-public-total-interface"; +import type { + SewerPumpStationStatusTotalResponse, + SewerReservoirMaintainTotalRequest, + SewerReservoirStatusTotalResponse, +} from "../model/statistics-total/statistics-sewage-reservoir-total-interface"; +import type { + SewerageSupplyRateRequest, + SewerageSupplyRateResponse, +} from "../model/statistics-total/statistics-sewage-supply-rate-total-interface"; +import type { SewerageFeeResponse, + SewerageFinanceSettlementResponse, + SewerageFinanceSummaryRequest, + SewerageOrgCauseResponse, SewerageUsageFeeResponse, - SewerageOrgCauseResponse } from "../model/statistics-total/statistics-sewerage-finance-total-interface"; - import type { - WaterReuseSummaryRequest, - SewerageReuseStatusTab1Response, + HumanWasteCollectionTab3Response, + IndividualSewageTab4Response, + PublicHumanWasteStaffTab2Response, + PublicSewageStaffTab1Response, + SewerageIndustry, +} from "../model/statistics-total/statistics-sewerage-industry-interface"; +import type { GrayWaterStatusTab2Response, RainwaterUtilizationStatusTab3Response, SewageWwtRtlztnRegStatusTab4Response, - SewageWwtRtlztnSncnStatusTab5Response + SewageWwtRtlztnSncnStatusTab5Response, + SewerageReuseStatusTab1Response, + WaterReuseSummaryRequest, } from "../model/statistics-total/statistics-sewerage-reuse-total-interface"; - import type { - SludgeSummaryRequest, - SludgeProcessingTab1Response, DigestionTankOperTab2Response, + HumanWasteSludgeTab4Response, SewageSludgeOperTab3Response, - HumanWasteSludgeTab4Response + SludgeProcessingTab1Response, + SludgeSummaryRequest, } from "../model/statistics-total/statistics-sludge-total-interface"; -import type { - SewerageIndustry, - PublicSewageStaffTab1Response, - PublicHumanWasteStaffTab2Response, - HumanWasteCollectionTab3Response, - IndividualSewageTab4Response -} from "../model/statistics-total/statistics-sewerage-industry-interface"; - - export class StatisticsTotalApiService { - public async getSewerageSupplyRateList(params: SewerageSupplyRateRequest): Promise { - const response = await stClient.get ( + public async getSewerageSupplyRateList( + params: SewerageSupplyRateRequest, + ): Promise { + const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-supply-rate/summary`, - { params: params } + { params: params }, ); return response.data; } - public async getSewagePipeRegionalStatusList(params: SewagePipeTotalRequest): Promise { - const response = await stClient.get ( + public async getSewagePipeRegionalStatusList( + params: SewagePipeTotalRequest, + ): Promise { + const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/regional-status`, - { params: params } + { params: params }, ); return response.data; } - public async getSewagePipeFactInstallStatus( params: SewagePipeTotalRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/facility-installation-status`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/facility-installation-status`, + { params }, + ); return response.data; } @@ -113,10 +109,11 @@ export class StatisticsTotalApiService { public async getSewagePipePipeTypeFacilityStatus( params: SewagePipeTotalRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/pipe-type-facility-status`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/pipe-type-facility-status`, + { params }, + ); return response.data; } @@ -145,10 +142,11 @@ export class StatisticsTotalApiService { public async getSewagePipeMaintainRepairTotal( params: SewagePipeMaintainTotalRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe-mtc/repair`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe-mtc/repair`, + { params }, + ); return response.data; } @@ -156,10 +154,11 @@ export class StatisticsTotalApiService { public async getSewagePipeMaintainDredgingTotal( params: SewagePipeMaintainTotalRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe-mtc/dredging`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe-mtc/dredging`, + { params }, + ); return response.data; } @@ -178,10 +177,11 @@ export class StatisticsTotalApiService { public async getSewerPumpStationStatusTotalList( params: SewerReservoirMaintainTotalRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-reservoir-pump/pump-station-status`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewer-reservoir-pump/pump-station-status`, + { params }, + ); return response.data; } @@ -195,8 +195,8 @@ export class StatisticsTotalApiService { ); return response.data; } - /** - * ST00060001 —공공하수처리시설 */ + /** + * ST00060001 —공공하수처리시설 */ public async getSewagePublicFacillityTotal( params: SewagePipeMaintainTotalRequest, ): Promise { @@ -207,15 +207,15 @@ export class StatisticsTotalApiService { return response.data; } - /** ST00070001 — 분뇨처리시설 현황(합계) API */ public async getExcretaTreatmentStatusTotalList( params: ExcretaTreatmentMaintainTotalRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/excreta-treatment-status`, - { params }, - ); + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/excreta-treatment-status`, + { params }, + ); return response.data; } @@ -252,31 +252,51 @@ export class StatisticsTotalApiService { return response.data; } - /** ST00090001 — 하수도 재정결산 조회(Tab1) */ - public async getSewerageFinancialList(params: SewerageFinanceSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-financial`, { params }); + /** ST00090001 — 하수도 재정결산 조회(Tab1) */ + public async getSewerageFinancialList( + params: SewerageFinanceSummaryRequest, + ): Promise { + const response = await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-financial`, + { params }, + ); return response.data; } /** ST00090002 — 하수도 요금 조회(Tab2) */ - public async getSewerageFeeList(params: SewerageFinanceSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-fee`, { params }); + public async getSewerageFeeList( + params: SewerageFinanceSummaryRequest, + ): Promise { + const response = await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-fee`, + { params }, + ); return response.data; } /** ST00090003 — 하수도 사용료 조회(Tab3) */ - public async getSewerageUsageList(params: SewerageFinanceSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-usage`, { params }); + public async getSewerageUsageList( + params: SewerageFinanceSummaryRequest, + ): Promise { + const response = await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-usage`, + { params }, + ); return response.data; } /** ST00090004 — 원인자 부담금 조회(Tab4) */ - public async getSewerageOrgCauseList(params: SewerageFinanceSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-org-cause`, { params }); + public async getSewerageOrgCauseList( + params: SewerageFinanceSummaryRequest, + ): Promise { + const response = await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewerage-org-cause`, + { params }, + ); return response.data; } - /** ST00100001 — 물재이용 > 공공하수처리수 재이용 현황 조회(Tab1) */ + /** ST00100001 — 물재이용 > 공공하수처리수 재이용 현황 조회(Tab1) */ public async getSewerageReuseTab1List( params: WaterReuseSummaryRequest, ): Promise { @@ -290,30 +310,47 @@ export class StatisticsTotalApiService { * ST00100002 — 물재이용 > TAB2 중수도 현황 조회 */ async getGrayWaterStatusTab2List( - params: WaterReuseSummaryRequest - ): Promise { + params: WaterReuseSummaryRequest, + ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/gray-water-status`, { params }, ); return response.data; - } /** ★ ST00100003 — 물재이용 > TAB3 빗물이용시설현황 조회 */ - async getRainwaterStatusTab3List(params: WaterReuseSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/water-reuse`, { params }); + async getRainwaterStatusTab3List( + params: WaterReuseSummaryRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/water-reuse`, + { params }, + ); return response.data; } /** ★ ST00100004 — 물재이용 > TAB4 하·폐수처리수 재이용시설 시공업 등록현황 조회 */ - async getWwtRtlztnRegStatusTab4List(params: WaterReuseSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/wwt-rtlztn-reg`, { params }); + async getWwtRtlztnRegStatusTab4List( + params: WaterReuseSummaryRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/wwt-rtlztn-reg`, + { params }, + ); return response.data; } /** ★ ST00100005 — 물재이용 > TAB5 하·폐수처리수 재이용시설 시공업 인가현황 조회 */ - async getWwtRtlztnSncnStatusTab5List(params: WaterReuseSummaryRequest): Promise { - const response = await stClient.get(`${ENDPOINT.ST_SERVICE.TOTAL}/wwt-rtlztn-aprv`, { params }); + async getWwtRtlztnSncnStatusTab5List( + params: WaterReuseSummaryRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/wwt-rtlztn-aprv`, + { params }, + ); return response.data; } @@ -321,7 +358,7 @@ export class StatisticsTotalApiService { * ST00110001 — 하수및분뇨찌꺼기 > TAB1 찌꺼기처리시설현황 조회 */ async getSludgeProcessingTab1List( - params: SludgeSummaryRequest + params: SludgeSummaryRequest, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/sludge-processing`, @@ -333,7 +370,7 @@ export class StatisticsTotalApiService { * ST00110002 — 하수및분뇨찌꺼기 > TAB2 소화조 운영현황 조회 */ async getSludgeTab2List( - params: SludgeSummaryRequest + params: SludgeSummaryRequest, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/sludge-digestion-tank`, @@ -346,89 +383,94 @@ export class StatisticsTotalApiService { * ST00110003 — 하수및분뇨찌꺼기 > TAB3 하수찌꺼기 처리시설 운영현황 조회 */ async getSludgeTab3List( - params: SludgeSummaryRequest + params: SludgeSummaryRequest, ): Promise { // 제네릭을 추가하여 unknown 에러를 해결합니다. const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/sludge-facility-oper`, - { params } + { params }, ); return response.data; } - + /** * ST00110004 — 하수및분뇨찌꺼기 > TAB4 분뇨찌꺼기(슬러지)처리현황 */ async getSludgeTab4List( - params: SludgeSummaryRequest + params: SludgeSummaryRequest, ): Promise { - const response = await stClient.get( - `${ENDPOINT.ST_SERVICE.TOTAL}/sludge-human-waste`, - { params }, - ); - return response.data; + const response = await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sludge-human-waste`, + { params }, + ); + return response.data; } /** ST00120001[TAB1] 공공기관 하수분야 조회 */ async getPublicSewageStaffTab1List( - params: SewerageIndustry + params: SewerageIndustry, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/public-sewage-staff`, - { params } + { params }, ); return response.data; } /** ST00120002[TAB2] 공공기관 분뇨분야 조회 */ async getPublicHumanWasteStaffTab2List( - params: SewerageIndustry + params: SewerageIndustry, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/public-human-waste-staff`, - { params } + { params }, ); return response.data; } /** [TAB3] 분뇨수집·운반업 조회 */ async getHumanWasteCollectionTab3List( - params: SewerageIndustry + params: SewerageIndustry, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/human-waste-collection`, - { params } + { params }, ); return response.data; } /** [TAB4] 개인하수처리관련업 조회 */ async getIndividualSewageTab4List( - params: SewerageIndustry + params: SewerageIndustry, ): Promise { const response = await stClient.get( `${ENDPOINT.ST_SERVICE.TOTAL}/indv-swtrmt-rel-bsns`, - { params } + { params }, ); return response.data; } /** [TAB1] 하수도서비스수준 - 민원 조회 */ - public async getSewerageServiceLevelComplaint(params: SewerageServiceLevelRequest): Promise { - const response = await stClient.get ( - `${ENDPOINT.ST_SERVICE.TOTAL}/sewage-complaint`, - { params: params } - ); + public async getSewerageServiceLevelComplaint( + params: SewerageServiceLevelRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/sewage-complaint`, + { params: params }, + ); return response.data; } /** [TAB1] 하수도서비스수준 - 주민친화시설 조회 */ - public async getSewerageServiceLevelResidentFriendlyFact(params: SewerageServiceLevelRequest): Promise { - const response = await stClient.get ( - `${ENDPOINT.ST_SERVICE.TOTAL}/resident-friendly-facility`, - { params: params } - ); + public async getSewerageServiceLevelResidentFriendlyFact( + params: SewerageServiceLevelRequest, + ): Promise { + const response = + await stClient.get( + `${ENDPOINT.ST_SERVICE.TOTAL}/resident-friendly-facility`, + { params: params }, + ); return response.data; } - } +} - -export const statisticsTotalStatusApi = new StatisticsTotalApiService(); \ No newline at end of file +export const statisticsTotalStatusApi = new StatisticsTotalApiService(); diff --git a/apps/st/src/entities/statistics/api/verification-input-report-service.ts b/apps/st/src/entities/statistics/api/verification-input-report-service.ts index b8fba2b79..1a50b7131 100644 --- a/apps/st/src/entities/statistics/api/verification-input-report-service.ts +++ b/apps/st/src/entities/statistics/api/verification-input-report-service.ts @@ -1,8 +1,7 @@ -import { getUserInfo } from "../../../../../../packages/common/components/src/api"; - -import { stClient } from "@/shared/api/client"; +import { stClient } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; +import { getUserInfo } from "../../../../../../packages/common/components/src/api"; import type { VerificationInputReportRequest, VerificationInputReportResponse, @@ -39,4 +38,5 @@ export class VerificationInputReportApiService implements VerificationInputRepor } } -export const verificationInputReportApi = new VerificationInputReportApiService(); +export const verificationInputReportApi = + new VerificationInputReportApiService(); diff --git a/apps/st/src/shared/api/index.ts b/apps/st/src/shared/api/index.ts index 4ccba4f0b..8b84307d4 100644 --- a/apps/st/src/shared/api/index.ts +++ b/apps/st/src/shared/api/index.ts @@ -1,2 +1,2 @@ -export { client } from "./client"; +export { client, stClient } from "./client"; export { withAuthHeader } from "./with-auth-header"; From 4fa7542aca90cf35bba56ddfb9dcedee75ce49c6 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 8 Jul 2026 18:05:35 +0900 Subject: [PATCH 3/7] =?UTF-8?q?[st]=20feat:=20=ED=86=B5=EA=B3=84=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EB=A6=AC=ED=8F=AC=ED=8A=B8=20=EB=B0=98?= =?UTF-8?q?=EB=A0=A4=20=EC=B2=98=EB=A6=AC=20=EB=A1=9C=EC=A7=81=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../verification/StatisticsVerificationReport.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/st/src/components/statistics/verification/StatisticsVerificationReport.tsx b/apps/st/src/components/statistics/verification/StatisticsVerificationReport.tsx index 75416eb35..38797a591 100644 --- a/apps/st/src/components/statistics/verification/StatisticsVerificationReport.tsx +++ b/apps/st/src/components/statistics/verification/StatisticsVerificationReport.tsx @@ -173,6 +173,7 @@ function StatisticsVerificationReport() { ); const resultGridRef = useRef(null); const prevLengthRef = useRef(0); + const rejectedVrfcSnRef = useRef>(new Set()); const { data: sidoData } = useStAnlsSidoCombo(); const { data: sigunguData } = useStAnlsSigunguCombo( @@ -299,10 +300,14 @@ function StatisticsVerificationReport() { dataProvider.addRows?.(mergedNewRows); } else { // 초기 조회 또는 재조회 시 데이터 처리 - const checkedKeys = captureCheckedVrfcSn(); + const rejectedKeys = rejectedVrfcSnRef.current; + const checkedKeys = captureCheckedVrfcSn().filter( + (key) => !rejectedKeys.has(key), + ); const mergedRows = mergeWithEditedMap(nextRows); dataProvider.setRows?.(mergedRows); restoreCheckedVrfcSn(checkedKeys, mergedRows); + rejectedKeys.clear(); } prevLengthRef.current = nextRows.length; @@ -514,6 +519,10 @@ function StatisticsVerificationReport() { try { if (await confirm("반려하시겠습니까?")) { await onRejectStats(rejectRequests); + rejectRequests.forEach(({ vrfcSn }) => { + if (!Number.isNaN(vrfcSn)) + rejectedVrfcSnRef.current.add(vrfcSn); + }); } } catch { alert("반려 중 오류가 발생했습니다."); From c74917d1d9ec21f30c7d216cf379ef645bfadf11 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 8 Jul 2026 18:16:24 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[cs]=20remove:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EB=9D=BC=EC=9A=B0=ED=84=B0=20=ED=95=B8?= =?UTF-8?q?=EB=93=A4=EB=9F=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cs/app/api/auth/logout/route.ts | 17 ----------------- apps/cs/src/entities/auth/api/auth-service.ts | 11 ----------- 2 files changed, 28 deletions(-) delete mode 100644 apps/cs/app/api/auth/logout/route.ts diff --git a/apps/cs/app/api/auth/logout/route.ts b/apps/cs/app/api/auth/logout/route.ts deleted file mode 100644 index fdcc9df7c..000000000 --- a/apps/cs/app/api/auth/logout/route.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { cookies } from "next/headers"; -import { NextResponse } from "next/server"; -import { - ACCESS_TOKEN, - AUTH_USER_ID, - CLAIM_NAME, - REFRESH_TOKEN, -} from "@/shared/config"; - -export async function POST() { - const cookieStore = await cookies(); - cookieStore.delete(ACCESS_TOKEN); - cookieStore.delete(REFRESH_TOKEN); - cookieStore.delete(AUTH_USER_ID); - cookieStore.delete(CLAIM_NAME); - return NextResponse.json({ message: "Logged out" }, { status: 200 }); -} diff --git a/apps/cs/src/entities/auth/api/auth-service.ts b/apps/cs/src/entities/auth/api/auth-service.ts index a94ae9541..3efb1bf85 100644 --- a/apps/cs/src/entities/auth/api/auth-service.ts +++ b/apps/cs/src/entities/auth/api/auth-service.ts @@ -1,6 +1,5 @@ import { ACCESS_TOKEN, - AUTH_LOGIN_REDIRECT_URL, AUTH_USER_ID, CLAIM_NAME, ENDPOINT, @@ -105,22 +104,12 @@ async function silentRefresh(): Promise { } async function logout(): Promise { - try { - await fetch("/api/auth/logout", { - method: "POST", - credentials: "include", - }); - } catch (error) { - console.error("Logout API failed:", error); - } - tokenManager.clearAuthToken(); removeToken("site-id-key"); removeToken("site-theme-key"); if (typeof window !== "undefined") { window.dispatchEvent(new CustomEvent("auth:logout")); - window.location.href = AUTH_LOGIN_REDIRECT_URL; } } From 843519c3b5bbf12d5740b2b469610dce8195ddeb Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 8 Jul 2026 18:17:03 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[as]=20remove:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EB=9D=BC=EC=9A=B0=ED=84=B0=20=ED=95=B8?= =?UTF-8?q?=EB=93=A4=EB=9F=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/as/app/api/auth/logout/route.ts | 18 -------------- apps/as/src/entities/auth/api/auth-service.ts | 24 ++++--------------- .../as/src/entities/auth/lib/token-manager.ts | 1 - 3 files changed, 4 insertions(+), 39 deletions(-) delete mode 100644 apps/as/app/api/auth/logout/route.ts diff --git a/apps/as/app/api/auth/logout/route.ts b/apps/as/app/api/auth/logout/route.ts deleted file mode 100644 index d040a8f49..000000000 --- a/apps/as/app/api/auth/logout/route.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { cookies } from "next/headers"; -import { NextResponse } from "next/server"; - -import { - ACCESS_TOKEN, - AUTH_USER_ID, - CLAIM_NAME, - REFRESH_TOKEN, -} from "@/shared/config"; - -export async function POST() { - const cookieStore = await cookies(); - cookieStore.delete(ACCESS_TOKEN); - cookieStore.delete(REFRESH_TOKEN); - cookieStore.delete(AUTH_USER_ID); - cookieStore.delete(CLAIM_NAME); - return NextResponse.json({ message: "Logged out" }, { status: 200 }); -} diff --git a/apps/as/src/entities/auth/api/auth-service.ts b/apps/as/src/entities/auth/api/auth-service.ts index 80090f82f..97b664d6f 100644 --- a/apps/as/src/entities/auth/api/auth-service.ts +++ b/apps/as/src/entities/auth/api/auth-service.ts @@ -1,18 +1,12 @@ -import { - ACCESS_TOKEN, - AUTH_LOGIN_REDIRECT_URL, - AUTH_USER_ID, - CLAIM_NAME, - ENDPOINT, -} from "@/shared/config"; +import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME, ENDPOINT } from "@/shared/config"; import { type AuthPayload, type AuthService, getRemainingMs } from "@common/auth"; import { - clearAuthToken, clearRefreshTimer, removeToken, setToken, setupRefreshTimer, + tokenManager, } from "../lib/token-manager"; async function login(payload: AuthPayload): Promise { @@ -69,7 +63,7 @@ async function silentRefresh(): Promise { } } catch (error) { console.error(`[silentRefresh] Failed at ${new Date().toISOString()}`, error); - clearAuthToken(); + tokenManager.clearAuthToken(); if (typeof window !== "undefined") { window.dispatchEvent(new CustomEvent("auth:logout")); } @@ -77,22 +71,12 @@ async function silentRefresh(): Promise { } async function logout(): Promise { - try { - await fetch("/api/auth/logout", { - method: "POST", - credentials: "include", - }); - } catch (error) { - console.error("Logout API failed:", error); - } - - clearAuthToken(); + tokenManager.clearAuthToken(); removeToken("site-id-key"); removeToken("site-theme-key"); if (typeof window !== "undefined") { window.dispatchEvent(new CustomEvent("auth:logout")); - window.location.href = AUTH_LOGIN_REDIRECT_URL; } } diff --git a/apps/as/src/entities/auth/lib/token-manager.ts b/apps/as/src/entities/auth/lib/token-manager.ts index cd468f1aa..78d24bd5e 100644 --- a/apps/as/src/entities/auth/lib/token-manager.ts +++ b/apps/as/src/entities/auth/lib/token-manager.ts @@ -9,7 +9,6 @@ export const { removeToken, setupRefreshTimer, clearRefreshTimer, - clearAuthToken, getAccessToken, getRefreshToken, getUserId, From aa5f85a3c13b0b6828b6da1d76cc6dfdd01bc0cc Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 8 Jul 2026 18:21:00 +0900 Subject: [PATCH 6/7] =?UTF-8?q?[st]=20remove:=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20=ED=95=B8?= =?UTF-8?q?=EB=93=A4=EB=9F=AC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/st/app/api/auth/logout/route.ts | 17 ----------------- apps/st/src/entities/auth/api/auth-service.ts | 10 +++++++--- apps/st/src/entities/auth/lib/token-manager.ts | 1 - 3 files changed, 7 insertions(+), 21 deletions(-) delete mode 100644 apps/st/app/api/auth/logout/route.ts diff --git a/apps/st/app/api/auth/logout/route.ts b/apps/st/app/api/auth/logout/route.ts deleted file mode 100644 index fdcc9df7c..000000000 --- a/apps/st/app/api/auth/logout/route.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { cookies } from "next/headers"; -import { NextResponse } from "next/server"; -import { - ACCESS_TOKEN, - AUTH_USER_ID, - CLAIM_NAME, - REFRESH_TOKEN, -} from "@/shared/config"; - -export async function POST() { - const cookieStore = await cookies(); - cookieStore.delete(ACCESS_TOKEN); - cookieStore.delete(REFRESH_TOKEN); - cookieStore.delete(AUTH_USER_ID); - cookieStore.delete(CLAIM_NAME); - return NextResponse.json({ message: "Logged out" }, { status: 200 }); -} diff --git a/apps/st/src/entities/auth/api/auth-service.ts b/apps/st/src/entities/auth/api/auth-service.ts index ea77f8a36..48ead6a84 100644 --- a/apps/st/src/entities/auth/api/auth-service.ts +++ b/apps/st/src/entities/auth/api/auth-service.ts @@ -12,10 +12,11 @@ import { } from "@common/auth"; import { - clearAuthToken, clearRefreshTimer, + removeToken, setToken, setupRefreshTimer, + tokenManager, } from "../lib/token-manager"; import { clearTabStorePersist } from "@/store/tab-store"; @@ -83,7 +84,7 @@ async function silentRefresh(): Promise { `[silentRefresh] Failed at ${new Date().toISOString()}`, error, ); - clearAuthToken(); + tokenManager.clearAuthToken(); if (typeof window !== "undefined") { window.dispatchEvent(new CustomEvent("auth:logout")); } @@ -91,7 +92,10 @@ async function silentRefresh(): Promise { } export async function logout(): Promise { - clearAuthToken(); + tokenManager.clearAuthToken(); + removeToken("site-id-key"); + removeToken("site-theme-key"); + if (typeof window !== "undefined") { window.dispatchEvent(new CustomEvent("auth:logout")); } diff --git a/apps/st/src/entities/auth/lib/token-manager.ts b/apps/st/src/entities/auth/lib/token-manager.ts index 85574f244..83affbcaf 100644 --- a/apps/st/src/entities/auth/lib/token-manager.ts +++ b/apps/st/src/entities/auth/lib/token-manager.ts @@ -9,7 +9,6 @@ export const { removeToken, setupRefreshTimer, clearRefreshTimer, - clearAuthToken, getAccessToken, getRefreshToken, getUserId, From 0dfd5efa974c7a3f21185c70ae34ddf757d0514a Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 8 Jul 2026 18:52:30 +0900 Subject: [PATCH 7/7] =?UTF-8?q?[cm]=20feat:=20auth=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20jwt=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EB=A7=8C=EB=A3=8C=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cm/.env.example | 4 +- apps/cm/app/(with-base-layout)/layout.tsx | 2 + apps/cm/middleware.ts | 34 +++-- apps/cm/package.json | 3 +- apps/cm/src/entities/auth/api/auth-service.ts | 121 ++++++++++++++++++ .../cm/src/entities/auth/api/login-service.ts | 85 ------------ apps/cm/src/entities/auth/index.ts | 3 +- .../cm/src/entities/auth/lib/auth-wrapper.tsx | 94 +++++++++----- .../cm/src/entities/auth/lib/token-manager.ts | 95 ++------------ .../entities/auth/model/login-interface.ts | 9 -- apps/cm/src/pages/auth/login/ui/OtpModal.tsx | 48 +++---- .../cm/src/pages/auth/login/ui/login-page.tsx | 4 +- .../src/pages/dashboard/ui/dashboard-page.tsx | 10 +- apps/cm/src/shared/config/api.ts | 1 - apps/cm/src/shared/config/auth.ts | 17 +++ apps/cm/src/shared/config/env.ts | 3 + pnpm-lock.yaml | 11 +- 17 files changed, 270 insertions(+), 274 deletions(-) create mode 100644 apps/cm/src/entities/auth/api/auth-service.ts delete mode 100644 apps/cm/src/entities/auth/api/login-service.ts delete mode 100644 apps/cm/src/entities/auth/model/login-interface.ts create mode 100644 apps/cm/src/shared/config/auth.ts diff --git a/apps/cm/.env.example b/apps/cm/.env.example index 5d9747b57..0da6c0f8a 100644 --- a/apps/cm/.env.example +++ b/apps/cm/.env.example @@ -1,10 +1,10 @@ # apps/cs/src/shared/config/env.ts 참고 +NEXT_PUBLIC_AUTH_LOGIN_REDIRECT_URL=/auth/login NEXT_PUBLIC_PORT=3001 NEXT_PUBLIC_PROXY_HOST=http://localhost:3001 NEXT_PUBLIC_SITE_ID=CM NEXT_PUBLIC_SUB_DOMAIN=http://localhost:13000 -# NEXT_PUBLIC_SERVER_API_URL=http://localhost:8000 -NEXT_PUBLIC_SERVER_API_URL=http://dev.onasys.co.kr:8000 +SERVER_API_URL=http://dev.onasys.co.kr:8000 NEXT_PUBLIC_LINK_BACKEND_API_HOST=http://rsone.iptime.org:10014 NEXT_PUBLIC_TINY_API_KEY=t9nc4z6inquvvd5pq1vea8wcp7lb01qmqseh6egms9vpaju2 diff --git a/apps/cm/app/(with-base-layout)/layout.tsx b/apps/cm/app/(with-base-layout)/layout.tsx index 481d8f30c..732769718 100644 --- a/apps/cm/app/(with-base-layout)/layout.tsx +++ b/apps/cm/app/(with-base-layout)/layout.tsx @@ -4,6 +4,7 @@ import { usePathname, useRouter } from "next/navigation"; import { useQueryClient } from "@tanstack/react-query"; import { NoLNBLayout } from "@common/components"; import type { MenuItem } from "@/entities/menu"; +import { authService } from "@/entities/auth"; import { useMenuStore } from "@/shared/lib"; import { PageLayout } from "@/shared/ui/page-layout"; @@ -26,6 +27,7 @@ export default function WithBaseLayout({ return ( diff --git a/apps/cm/middleware.ts b/apps/cm/middleware.ts index 241df1e74..bae4e6579 100644 --- a/apps/cm/middleware.ts +++ b/apps/cm/middleware.ts @@ -8,20 +8,16 @@ import { SITE_ID, } from "./src/shared/config"; -const serverApiUrl = - process.env.NEXT_PUBLIC_SERVER_API_URL ?? "http://localhost:3000"; +const serverApiUrl = process.env.SERVER_API_URL; - const serverApiUrl2 = - process.env.NEXT_PUBLIC_SERVER_API_URL2 ?? serverApiUrl; +const serverApiUrl2 = process.env.NEXT_PUBLIC_SERVER_API_URL2 ?? serverApiUrl; - const serverApiUrl3 = - process.env.NEXT_PUBLIC_SERVER_API_URL3 ?? serverApiUrl; +const serverApiUrl3 = process.env.NEXT_PUBLIC_SERVER_API_URL3 ?? serverApiUrl; - // const serverApiUrl4 = - // process.env.NEXT_PUBLIC_SERVER_API_URL4 ?? serverApiUrl; +// const serverApiUrl4 = +// process.env.NEXT_PUBLIC_SERVER_API_URL4 ?? serverApiUrl; - const serverApiUrl5 = - process.env.NEXT_PUBLIC_SERVER_API_URL5 ?? serverApiUrl; +const serverApiUrl5 = process.env.NEXT_PUBLIC_SERVER_API_URL5 ?? serverApiUrl; export function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; @@ -51,7 +47,6 @@ export function middleware(req: NextRequest) { }); } - if (pathname.startsWith("/server/sewerage-service")) { const requestHeaders = new Headers(req.headers); const token = req.cookies.get(CLAIM_NAME)?.value; @@ -173,7 +168,6 @@ export function middleware(req: NextRequest) { return NextResponse.rewrite(new URL(newUrl)); } - if (pathname === "/") { return NextResponse.redirect(new URL("/dashboard", req.url)); } @@ -184,11 +178,13 @@ export function middleware(req: NextRequest) { } export const config = { - matcher: ["/server/:path*", - "/attach-service/:path*", - "/user-service/:path*", - "/sewerage-service/:path*", - "/reuse-service/:path*", - "/operation-service/:path*", - "/"], + matcher: [ + "/server/:path*", + "/attach-service/:path*", + "/user-service/:path*", + "/sewerage-service/:path*", + "/reuse-service/:path*", + "/operation-service/:path*", + "/", + ], }; diff --git a/apps/cm/package.json b/apps/cm/package.json index 5eaca0435..ba980d55c 100644 --- a/apps/cm/package.json +++ b/apps/cm/package.json @@ -3,13 +3,14 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", + "dev": "next dev -p 3001", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "@common/assets": "workspace:*", + "@common/auth": "workspace:*", "@common/components": "workspace:*", "@common/config": "workspace:*", "@dnd-kit/core": "^6.3.1", diff --git a/apps/cm/src/entities/auth/api/auth-service.ts b/apps/cm/src/entities/auth/api/auth-service.ts new file mode 100644 index 000000000..a8fa70622 --- /dev/null +++ b/apps/cm/src/entities/auth/api/auth-service.ts @@ -0,0 +1,121 @@ +import { + ACCESS_TOKEN, + AUTH_USER_ID, + CLAIM_NAME, + ENDPOINT, +} from "@/shared/config"; +import { + type AuthPayload, + type AuthService, + getRemainingMs, +} from "@common/auth"; + +import { + clearRefreshTimer, + removeToken, + setToken, + setupRefreshTimer, + tokenManager, +} from "../lib/token-manager"; + +function resolveLoginError(message: string | undefined): string { + switch (message) { + case "Invalid Credentials": + return "아이디와 비밀번호가 일치하지 않습니다."; + case "User not found": + return "존재하지 않는 아이디입니다."; + case "User is not active": + return "활성화되지 않은 계정입니다."; + case "User is not verified": + return "이메일 인증이 필요합니다."; + default: + return message ?? "로그인에 실패했습니다."; + } +} + +function completeSession(accessToken: string, tokenId: string): void { + setToken(CLAIM_NAME, accessToken); + setToken(AUTH_USER_ID, tokenId); + + const remainingMs = getRemainingMs(accessToken); + if (remainingMs > 0) { + setupRefreshTimer(silentRefresh, remainingMs); + } +} + +async function login(payload: AuthPayload): Promise { + const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.LOGIN}`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(payload), + }); + + const data = await response.json(); + + if (!response.ok) { + throw new Error(resolveLoginError(data?.message)); + } + + const accessToken = data[ACCESS_TOKEN] as string | undefined; + const tokenId = data[AUTH_USER_ID] as string | undefined; + + if (!accessToken || !tokenId) { + throw new Error("인증 토큰을 받지 못했습니다."); + } + + completeSession(accessToken, tokenId); +} + +async function silentRefresh(): Promise { + console.log(`[silentRefresh] Called at ${new Date().toISOString()}`); + try { + const response = await fetch( + `/api/proxy${ENDPOINT.USER_SERVICE.SILENT_REFRESH}`, + { method: "PUT" }, + ); + + const data = await response.json(); + + if (!response.ok) { + throw new Error(data?.message ?? "토큰 갱신에 실패했습니다."); + } + + const accessToken = data[ACCESS_TOKEN] as string | undefined; + const tokenId = data[AUTH_USER_ID] as string | undefined; + + if (!accessToken || !tokenId) { + throw new Error("갱신된 인증 토큰을 받지 못했습니다."); + } + + completeSession(accessToken, tokenId); + } catch (error) { + console.error( + `[silentRefresh] Failed at ${new Date().toISOString()}`, + error, + ); + tokenManager.clearAuthToken(); + if (typeof window !== "undefined") { + window.dispatchEvent(new CustomEvent("auth:logout")); + } + } +} + +async function logout(): Promise { + tokenManager.clearAuthToken(); + removeToken("site-id-key"); + removeToken("site-theme-key"); + + if (typeof window !== "undefined") { + window.dispatchEvent(new CustomEvent("auth:logout")); + } +} + +export const authService: AuthService & { + completeSession: typeof completeSession; +} = { + login, + silentRefresh, + declineSessionExtend: clearRefreshTimer, + logout, + completeSession, +}; diff --git a/apps/cm/src/entities/auth/api/login-service.ts b/apps/cm/src/entities/auth/api/login-service.ts deleted file mode 100644 index c1968fe36..000000000 --- a/apps/cm/src/entities/auth/api/login-service.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { AxiosError } from "axios"; -import { - ENDPOINT, - JWT_EXPIRATION_TIME, - ACCESS_TOKEN, - AUTH_USER_ID, - CLAIM_NAME, -} from "@/shared/config"; -import type { LoginService, ILogin } from "../model/login-interface"; -import { tokenManager } from "../lib/token-manager"; - -export class LoginApiService implements LoginService { - private static instance: LoginApiService; - - private constructor() {} - - public static getInstance(): LoginApiService { - if (!LoginApiService.instance) { - LoginApiService.instance = new LoginApiService(); - } - return LoginApiService.instance; - } - - public async login(payload: ILogin): Promise { - try { - const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.LOGIN}`, { - method: "POST", - body: JSON.stringify({ - userId: payload.userId, - password: payload.password, - }), - }); - - const data = await response.json(); - const accessToken = data[ACCESS_TOKEN]; - const tokenId = data[AUTH_USER_ID]; - - if (!accessToken || !tokenId) { - throw new Error("Missing required authentication tokens"); - } - - tokenManager.setToken(CLAIM_NAME, accessToken); - tokenManager.setToken(AUTH_USER_ID, tokenId); - tokenManager.setupRefreshTimer( - () => this.silentRefresh(), - JWT_EXPIRATION_TIME, - ); - } catch (error) { - if (error instanceof AxiosError) { - throw new Error(`Login failed: ${error.response?.data?.message}`); - } - throw new Error(`Login failed: ${error}`); - } - } - - public async silentRefresh(): Promise { - try { - const response = await fetch( - `/api/proxy${ENDPOINT.USER_SERVICE.SILENT_REFRESH}`, - { method: "PUT" }, - ); - - const data = await response.json(); - const accessToken = data[ACCESS_TOKEN]; - const tokenId = data[AUTH_USER_ID]; - - if (!accessToken || !tokenId) { - throw new Error("Missing required authentication tokens"); - } - - tokenManager.setToken(CLAIM_NAME, accessToken); - tokenManager.setToken(AUTH_USER_ID, tokenId); - } catch (error) { - tokenManager.clearAuthToken(); - if (error instanceof AxiosError) { - throw new Error( - `Silent refresh failed: ${error.response?.data?.message}`, - ); - } - throw new Error(`Silent refresh failed: ${error}`); - } - } -} - -export const LoginApi = LoginApiService.getInstance(); diff --git a/apps/cm/src/entities/auth/index.ts b/apps/cm/src/entities/auth/index.ts index 97e142225..7f0d0081a 100644 --- a/apps/cm/src/entities/auth/index.ts +++ b/apps/cm/src/entities/auth/index.ts @@ -1,2 +1,3 @@ -export { LoginApi } from "./api/login-service"; +export { authService } from "./api/auth-service"; export { AuthWrapper } from "./lib/auth-wrapper"; +export { tokenManager } from "./lib/token-manager"; diff --git a/apps/cm/src/entities/auth/lib/auth-wrapper.tsx b/apps/cm/src/entities/auth/lib/auth-wrapper.tsx index 5366696f7..d1a2a48c3 100644 --- a/apps/cm/src/entities/auth/lib/auth-wrapper.tsx +++ b/apps/cm/src/entities/auth/lib/auth-wrapper.tsx @@ -2,44 +2,80 @@ import { useEffect } from "react"; import { useRouter } from "next/navigation"; + +import { isAxiosError } from "axios"; + import { client } from "@/shared/api"; +import { + AUTH_LOGIN_REDIRECT_URL, + AUTH_USER_ID, + CLAIM_NAME, + ENDPOINT, +} from "@/shared/config"; +import { useUserStore } from "@/shared/lib"; import type { IUserInfo } from "@/shared/store"; -import { getCookie, useUserStore } from "@/shared/lib"; +import { getRemainingMs } from "@common/auth"; import { isAtLoginRedirectUrl } from "@common/network"; -import { ENDPOINT, AUTH_USER_ID } from "@/shared/config"; + +import { authService } from "../api/auth-service"; + +import { getToken, setupRefreshTimer } from "./token-manager"; const AuthWrapper = ({ children }: { children: React.ReactNode }) => { const router = useRouter(); - const { userInfo, setUserInfo } = useUserStore((state) => state); - - async function authCheck() { - if (isAtLoginRedirectUrl("/auth/login")) { - return; - } - - const userId = getCookie(AUTH_USER_ID); - if (!userId) { - throw new Error("Missing required authentication tokens"); - } - - const response = await client.get( - `${ENDPOINT.USER_SERVICE.USERS}/info/me`, - ); - if (!userInfo) setUserInfo(response.data); - } + const userInfo = useUserStore((state) => state.userInfo); + const setUserInfo = useUserStore((state) => state.setUserInfo); useEffect(() => { - (async () => { - try { - await authCheck(); - } catch (error) { - console.error(error); - setUserInfo(null); - if (!isAtLoginRedirectUrl("/auth/login")) { - router.push("/auth/login"); - } + const token = getToken(CLAIM_NAME); + if (token) { + const remainingMs = getRemainingMs(token); + if (remainingMs > 0) { + console.log( + `[AuthWrapper] Refresh timer set: ${remainingMs}ms (${remainingMs / 1000}s)`, + ); + setupRefreshTimer(authService.silentRefresh, remainingMs); } - })(); + } + + if (isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) return; + + async function authCheck() { + const userId = getToken(AUTH_USER_ID); + if (!userId) { + router.replace(AUTH_LOGIN_REDIRECT_URL); + return; + } + + if (userInfo) return; + + const response = await client.get( + `${ENDPOINT.USER_SERVICE.USERS}/info/me`, + ); + setUserInfo(response.data); + } + + authCheck().catch((error) => { + if (isAxiosError(error) && error.response?.status === 401) return; + + console.error(error); + setUserInfo(null); + if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) { + router.replace(AUTH_LOGIN_REDIRECT_URL); + } + }); + }, []); + + useEffect(() => { + function handleAuthLogout() { + setUserInfo(null); + if (!isAtLoginRedirectUrl(AUTH_LOGIN_REDIRECT_URL)) { + router.replace(AUTH_LOGIN_REDIRECT_URL); + } + } + + window.addEventListener("auth:logout", handleAuthLogout); + return () => window.removeEventListener("auth:logout", handleAuthLogout); }, []); return <>{children}; diff --git a/apps/cm/src/entities/auth/lib/token-manager.ts b/apps/cm/src/entities/auth/lib/token-manager.ts index 8fcf21984..78d24bd5e 100644 --- a/apps/cm/src/entities/auth/lib/token-manager.ts +++ b/apps/cm/src/entities/auth/lib/token-manager.ts @@ -1,84 +1,15 @@ -import { ACCESS_TOKEN, AUTH_USER_ID, CLAIM_NAME, REFRESH_TOKEN } from "@/shared/config"; -import { getCookie, setCookie, removeCookie } from "@/shared/lib"; +import { authConfig } from "@/shared/config/auth"; +import { createTokenManager } from "@common/auth"; -export class TokenManager { - private static instance: TokenManager; - private refreshTimer: NodeJS.Timeout | null = null; +export const tokenManager = createTokenManager(authConfig); - private constructor() {} - - public static getInstance(): TokenManager { - if (!TokenManager.instance) { - TokenManager.instance = new TokenManager(); - } - return TokenManager.instance; - } - - public getToken(key: string): string | undefined { - return getCookie(key); - } - - public setToken(key: string, value: string): void { - // 환경에 따른 도메인 설정 - const domain = this.getCookieDomain(); - - setCookie(key, value, { - secure: window.location.protocol === "https:", - sameSite: "lax", - domain: domain, - path: "/", // 모든 경로에서 접근 가능 - }); - } - - private getCookieDomain(): string | undefined { - const hostname = window.location.hostname; - - // 개발 환경에서는 localhost 도메인 사용 - if (hostname === "localhost" || hostname === "127.0.0.1") { - return undefined; // localhost에서는 도메인 설정하지 않음 - } - - // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 - if (hostname.includes("hasuon.or.kr")) { - return ".hasuon.or.kr"; - } - - // 기타 환경에서는 현재 호스트명 사용 - return hostname; - } - - public removeToken(key: string): void { - const domain = this.getCookieDomain(); - removeCookie(key, { domain, path: "/" }); - } - - public setupRefreshTimer( - callback: () => Promise, - expirationTime: number, - ): void { - if (this.refreshTimer) { - clearTimeout(this.refreshTimer); - } - - this.refreshTimer = setTimeout(() => { - callback().catch((error) => { - console.error("Silent refresh failed:", error); - this.clearAuthToken(); - }); - }, expirationTime - 60000); - } - - public clearAuthToken(): void { - if (this.refreshTimer) { - clearTimeout(this.refreshTimer); - this.refreshTimer = null; - } - - this.removeToken(CLAIM_NAME); - this.removeToken(AUTH_USER_ID); - this.removeToken(REFRESH_TOKEN); - this.removeToken(ACCESS_TOKEN); - } -} - -export const tokenManager = TokenManager.getInstance(); +export const { + getToken, + setToken, + removeToken, + setupRefreshTimer, + clearRefreshTimer, + getAccessToken, + getRefreshToken, + getUserId, +} = tokenManager; diff --git a/apps/cm/src/entities/auth/model/login-interface.ts b/apps/cm/src/entities/auth/model/login-interface.ts deleted file mode 100644 index 5aaf53044..000000000 --- a/apps/cm/src/entities/auth/model/login-interface.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface ILogin { - userId: string; - password: string; -} - -export interface LoginService { - login(payload: ILogin): Promise; - silentRefresh(): Promise; -} diff --git a/apps/cm/src/pages/auth/login/ui/OtpModal.tsx b/apps/cm/src/pages/auth/login/ui/OtpModal.tsx index 7c6aeb9af..39a343850 100644 --- a/apps/cm/src/pages/auth/login/ui/OtpModal.tsx +++ b/apps/cm/src/pages/auth/login/ui/OtpModal.tsx @@ -1,6 +1,6 @@ import { useState } from "react"; -import { ACCESS_TOKEN, AUTH_USER_ID, REFRESH_TOKEN, CLAIM_NAME } from "@/shared/config"; -import { tokenManager } from "@/entities/auth/lib/token-manager"; +import { ACCESS_TOKEN, AUTH_USER_ID, ENDPOINT } from "@/shared/config"; +import { authService } from "@/entities/auth"; import { Button, Dialog, @@ -33,7 +33,7 @@ export default function OtpModal({ onClose, onSuccess, open, onOpenChange }: Otp } // Proxy를 통해 OTP 인증 처리 - const response = await fetch(`/api/proxy/user-service/api/v1/auth/2fa/verify`, { + const response = await fetch(`/api/proxy${ENDPOINT.USER_SERVICE.OTP_VERIFY}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -57,37 +57,19 @@ export default function OtpModal({ onClose, onSuccess, open, onOpenChange }: Otp console.log("Response data keys:", Object.keys(data)); console.log("Full response data:", JSON.stringify(data, null, 2)); - // 2FA 응답에서는 access-token만 있고 token-id는 없을 수 있음 - const accessToken = data[ACCESS_TOKEN] || data.accessToken || data.access_token || data.token || data['ss-token']; - - console.log("Extracted accessToken:", !!accessToken); - console.log("Token value - accessToken:", accessToken?.substring(0, 20) + "..."); - - // access-token이 있는 경우 저장 - if (accessToken) { - console.log("Saving access token from OTP verification"); - tokenManager.setToken(CLAIM_NAME, accessToken); // Authorization으로 저장 - - // 리프레시 토큰도 확인 - const refreshToken = data[REFRESH_TOKEN] || data.refreshToken || data.refresh_token; - if (refreshToken) { - console.log("Saving refresh token"); - tokenManager.setToken(REFRESH_TOKEN, refreshToken); - } - - // userId는 원래 로그인 응답에서 가져온 값 사용 - const originalUserId = data.userId; - if (originalUserId) { - console.log("Saving userId from original login response"); - tokenManager.setToken(AUTH_USER_ID, originalUserId); - } - - console.log("All tokens saved successfully"); - } else { - console.log("No access token in OTP response"); - console.log("Available data keys:", Object.keys(data)); - console.log("Data values:", Object.entries(data).map(([k, v]) => `${k}: ${typeof v === 'string' ? v.substring(0, 20) + '...' : v}`)); + const accessToken = + data[ACCESS_TOKEN] || + data.accessToken || + data.access_token || + data.token || + data["ss-token"]; + const tokenId = data[AUTH_USER_ID] || data.userId; + + if (!accessToken || !tokenId) { + throw new Error("인증 토큰을 받지 못했습니다."); } + + authService.completeSession(accessToken, tokenId); onSuccess(); } catch (error: unknown) { diff --git a/apps/cm/src/pages/auth/login/ui/login-page.tsx b/apps/cm/src/pages/auth/login/ui/login-page.tsx index f7f613086..d01bc4867 100644 --- a/apps/cm/src/pages/auth/login/ui/login-page.tsx +++ b/apps/cm/src/pages/auth/login/ui/login-page.tsx @@ -3,7 +3,7 @@ import { useState, useEffect } from "react"; import Image from "next/image"; import { images } from "@common/assets"; -import { LoginApi } from "@/entities/auth"; +import { authService } from "@/entities/auth"; import { ENDPOINT } from "@/shared/config"; import OtpModal from "./OtpModal"; import TwoFAModal from "./TwoFAModal"; @@ -96,7 +96,7 @@ function LoginPage() { } else { // 기본 로그인 - proxy를 통해 처리 console.log("Starting basic login..."); - await LoginApi.login({ userId, password }); + await authService.login({ userId, password }); window.location.href = "/dashboard"; } } catch (error: unknown) { diff --git a/apps/cm/src/pages/dashboard/ui/dashboard-page.tsx b/apps/cm/src/pages/dashboard/ui/dashboard-page.tsx index 9d5e9179a..fe8a7f6c8 100644 --- a/apps/cm/src/pages/dashboard/ui/dashboard-page.tsx +++ b/apps/cm/src/pages/dashboard/ui/dashboard-page.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { useRouter } from "next/navigation"; import Image from "next/image"; -import { tokenManager } from "@/entities/auth/lib/token-manager"; +import { authService, tokenManager } from "@/entities/auth"; import { client } from "@/shared/api"; import { ENDPOINT } from "@/shared/config"; import { KoreaBasinMap } from "../lib/korea-basin-map"; @@ -120,13 +120,11 @@ function DashboardPage() { fetchUserInfo(); }, [router]); - const handleLogout = () => { + const handleLogout = async () => { console.log("Logging out..."); - // localStorage 정리 localStorage.removeItem("tempToken"); - // tokenManager를 통해 쿠키 정리 - tokenManager.clearAuthToken(); - router.push("/auth/logout"); + await authService.logout(); + router.push("/auth/login"); }; const handleChangePassword = () => { diff --git a/apps/cm/src/shared/config/api.ts b/apps/cm/src/shared/config/api.ts index 3cdb96d0c..26d5b8e95 100644 --- a/apps/cm/src/shared/config/api.ts +++ b/apps/cm/src/shared/config/api.ts @@ -97,4 +97,3 @@ export const ENDPOINT = { }; -export const JWT_EXPIRATION_TIME = 1800000; diff --git a/apps/cm/src/shared/config/auth.ts b/apps/cm/src/shared/config/auth.ts new file mode 100644 index 000000000..f743b9f61 --- /dev/null +++ b/apps/cm/src/shared/config/auth.ts @@ -0,0 +1,17 @@ +import type { AuthConfig } from "@common/auth"; + +import { + ACCESS_TOKEN, + AUTH_USER_ID, + CLAIM_NAME, + COOKIE_DOMAIN, + REFRESH_TOKEN, +} from "./env"; + +export const authConfig: AuthConfig = { + authUserId: AUTH_USER_ID, + claimName: CLAIM_NAME, + cookieDomain: COOKIE_DOMAIN, + accessToken: ACCESS_TOKEN, + refreshToken: REFRESH_TOKEN, +}; diff --git a/apps/cm/src/shared/config/env.ts b/apps/cm/src/shared/config/env.ts index c6373724f..5e1392b4d 100644 --- a/apps/cm/src/shared/config/env.ts +++ b/apps/cm/src/shared/config/env.ts @@ -2,6 +2,8 @@ export const PORT = process.env.NEXT_PUBLIC_PORT || "3000"; export const PROXY_HOST = process.env.NEXT_PUBLIC_PROXY_HOST || `http://localhost:${PORT}`; export const SERVER_API_URL = process.env.NEXT_PUBLIC_SERVER_API_URL; +export const AUTH_LOGIN_REDIRECT_URL = + process.env.NEXT_PUBLIC_AUTH_LOGIN_REDIRECT_URL || "/auth/login"; export const SITE_ID = process.env.NEXT_PUBLIC_SITE_ID || "CS"; export const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization"; export const ACCESS_TOKEN = @@ -9,3 +11,4 @@ export const ACCESS_TOKEN = export const REFRESH_TOKEN = process.env.NEXT_PUBLIC_REFRESH_TOKEN || "refresh-token"; export const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id"; +export const COOKIE_DOMAIN = process.env.NEXT_PUBLIC_COOKIE_DOMAIN; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d914bd2bc..bdd4c4d8e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -104,10 +104,10 @@ importers: devDependencies: eslint: specifier: ^9.0.0 - version: 9.39.4(jiti@1.21.7) + version: 9.39.4(jiti@2.6.1) eslint-config-next: specifier: 15.3.8 - version: 15.3.8(eslint@9.39.4(jiti@1.21.7))(typescript@5.9.3) + version: 15.3.8(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3) postcss: specifier: ^8.4.49 version: 8.5.8 @@ -235,6 +235,9 @@ importers: '@common/assets': specifier: workspace:* version: link:../../packages/common/assets + '@common/auth': + specifier: workspace:* + version: link:../../packages/common/auth '@common/components': specifier: workspace:* version: link:../../packages/common/components @@ -364,10 +367,10 @@ importers: version: 5.28.5 eslint: specifier: ^9.0.0 - version: 9.39.4(jiti@2.6.1) + version: 9.39.4(jiti@1.21.7) eslint-config-next: specifier: 15.3.8 - version: 15.3.8(eslint@9.39.4(jiti@2.6.1))(typescript@5.9.3) + version: 15.3.8(eslint@9.39.4(jiti@1.21.7))(typescript@5.9.3) postcss: specifier: ^8.4.49 version: 8.5.8