260812_01_ENH: 배정·진행 현황 개선 및 예약/이벤트 이력 기능 추가
- 프로젝트별 외주사·필드워커 배정 현황 및 미배정 건수 UI 추가 - 현장 면접 진행 여부와 사용자 권한에 따른 배정 탭·필터·컬럼 노출 제어 - 컨택 마지막 이벤트 일자 필터·정렬 및 결과/일자 컬럼 분리 - 컨택·면접·발송 현황의 날짜 범위 선택 optional 처리 - 진행 현황의 미배정 표시 및 일자별 미사용 결과 제외 - 전역 예약 기간 조회·이동 및 5분 단위 예약 알림 추가 - 내부 관리자용 이벤트 이력 단건 삭제 기능 추가 - 리스트 필터 UI 및 일반 헤더 정렬 기준 개선 - 프로젝트 저장 시 선택 프로젝트 정보 동기화
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useMemo, useState } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useMounted } from '@kri/common/hooks'
|
||||
import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
@@ -17,6 +17,7 @@ import { useResetListAssignMutation, useUpsertListAssignMutation } from '@/query
|
||||
import { ListHeaderAssignConst, LIST_HEADER_TYPE_LABEL } from '@/const/listConst'
|
||||
import { createEmptyListFilter, type ListFilter, type ListHeaderAssignType, type listHeader } from '@/types/list'
|
||||
import type { ResultCode } from '@/types/project'
|
||||
import { isExternalManager } from '@/utils/userRole'
|
||||
|
||||
const ASSIGN_TAB_TYPES: ListHeaderAssignType[] = [
|
||||
ListHeaderAssignConst.CONTACT_INTERVIEWER,
|
||||
@@ -36,8 +37,15 @@ const ListAssignPage = () => {
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0
|
||||
const enabled = mounted && prjctIdx > 0
|
||||
const userRole = auth?.user?.userRole ?? 0
|
||||
const isExternalUser = isExternalManager(userRole)
|
||||
|
||||
const [assignType, setAssignType] = useState<ListHeaderAssignType>(ListHeaderAssignConst.CONTACT_INTERVIEWER)
|
||||
const effectiveAssignType =
|
||||
selectedProject?.ff === false && assignType === ListHeaderAssignConst.FIELD_INTERVIEWER
|
||||
? ListHeaderAssignConst.CONTACT_INTERVIEWER
|
||||
: isExternalUser && assignType === ListHeaderAssignConst.OUTSOURCE
|
||||
? ListHeaderAssignConst.CONTACT_INTERVIEWER
|
||||
: assignType
|
||||
const [selectedAssignId, setSelectedAssignId] = useState<string | undefined>(undefined)
|
||||
const [assignFilterIds, setAssignFilterIds] = useState<string[]>([])
|
||||
const [transferResve, setTransferResve] = useState(false)
|
||||
@@ -49,11 +57,34 @@ const ListAssignPage = () => {
|
||||
const listHeaderQuery = useListHeaderQuery(prjctIdx, enabled)
|
||||
const upsertListAssignMutation = useUpsertListAssignMutation(prjctIdx)
|
||||
const resetListAssignMutation = useResetListAssignMutation(prjctIdx)
|
||||
const assignTargetRows = useAssignTargetRows({ prjctIdx, enabled, assignType })
|
||||
const assignTargetRows = useAssignTargetRows({ prjctIdx, enabled, assignType: effectiveAssignType })
|
||||
|
||||
const resultCodeArray = useMemo<ResultCode[]>(() => resultCodesQuery.data ?? [], [resultCodesQuery.data])
|
||||
const surveyArray = useMemo(() => projectInfoQuery.data?.surveys ?? [], [projectInfoQuery.data])
|
||||
const listHeaders = useMemo<listHeader[]>(() => listHeaderQuery.data ?? [], [listHeaderQuery.data])
|
||||
const assignTabTypes = useMemo(
|
||||
() =>
|
||||
ASSIGN_TAB_TYPES.filter((type) => {
|
||||
if (type === ListHeaderAssignConst.FIELD_INTERVIEWER && selectedProject?.ff === false) return false
|
||||
if (type === ListHeaderAssignConst.OUTSOURCE && isExternalUser) return false
|
||||
return true
|
||||
}),
|
||||
[selectedProject?.ff, isExternalUser],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedProject?.ff === false && assignType === ListHeaderAssignConst.FIELD_INTERVIEWER) {
|
||||
setAssignType(ListHeaderAssignConst.CONTACT_INTERVIEWER)
|
||||
setSelectedAssignId(undefined)
|
||||
setAssignFilterIds([])
|
||||
return
|
||||
}
|
||||
if (isExternalUser && assignType === ListHeaderAssignConst.OUTSOURCE) {
|
||||
setAssignType(ListHeaderAssignConst.CONTACT_INTERVIEWER)
|
||||
setSelectedAssignId(undefined)
|
||||
setAssignFilterIds([])
|
||||
}
|
||||
}, [assignType, selectedProject?.ff, isExternalUser])
|
||||
|
||||
const handleTabChange = (value: string) => {
|
||||
setAssignType(Number(value) as ListHeaderAssignType)
|
||||
@@ -81,13 +112,13 @@ const ListAssignPage = () => {
|
||||
|
||||
const externalAssignFilter = useMemo(() => {
|
||||
if (assignFilterIds[0] === ASSIGNED_SENTINEL) {
|
||||
return { type: assignType, values: [] as string[], condition: 'assigned' as const }
|
||||
return { type: effectiveAssignType, values: [] as string[], condition: 'assigned' as const }
|
||||
}
|
||||
if (assignFilterIds[0] === UNASSIGNED_SENTINEL) {
|
||||
return { type: assignType, values: [] as string[], condition: 'unassigned' as const }
|
||||
return { type: effectiveAssignType, values: [] as string[], condition: 'unassigned' as const }
|
||||
}
|
||||
return { type: assignType, values: assignFilterIds }
|
||||
}, [assignType, assignFilterIds])
|
||||
return { type: effectiveAssignType, values: assignFilterIds }
|
||||
}, [effectiveAssignType, assignFilterIds])
|
||||
|
||||
const hasNoAppliedFilter = () => filterSummary.length === 0 && assignFilterIds.length === 0
|
||||
|
||||
@@ -103,8 +134,8 @@ const ListAssignPage = () => {
|
||||
await upsertListAssignMutation.mutateAsync({
|
||||
assignId: selectedAssignId,
|
||||
request: {
|
||||
assignType,
|
||||
transferResve: assignType === ListHeaderAssignConst.OUTSOURCE? false : transferResve,
|
||||
assignType: effectiveAssignType,
|
||||
transferResve: effectiveAssignType === ListHeaderAssignConst.OUTSOURCE? false : transferResve,
|
||||
listFilter: currentListFilter,
|
||||
},
|
||||
})
|
||||
@@ -118,7 +149,7 @@ const ListAssignPage = () => {
|
||||
if (!confirm('정말 배정을 초기화 하시겠습니까?')) return
|
||||
|
||||
await resetListAssignMutation.mutateAsync({
|
||||
assignType,
|
||||
assignType: effectiveAssignType,
|
||||
listFilter: currentListFilter,
|
||||
})
|
||||
alert('배정이 초기화 되었습니다.')
|
||||
@@ -129,9 +160,9 @@ const ListAssignPage = () => {
|
||||
return (
|
||||
<div className="flex gap-4 text-sm">
|
||||
<div className="w-72 shrink-0 space-y-2">
|
||||
<Tabs value={String(assignType)} onValueChange={handleTabChange}>
|
||||
<TabsList className="grid w-full grid-cols-3">
|
||||
{ASSIGN_TAB_TYPES.map((type) => (
|
||||
<Tabs value={String(effectiveAssignType)} onValueChange={handleTabChange}>
|
||||
<TabsList className={`grid w-full ${assignTabTypes.length === 2 ? 'grid-cols-2' : assignTabTypes.length === 1 ? 'grid-cols-1' : 'grid-cols-3'}`}>
|
||||
{assignTabTypes.map((type) => (
|
||||
<TabsTrigger key={type} value={String(type)}>
|
||||
{LIST_HEADER_TYPE_LABEL[type]}
|
||||
</TabsTrigger>
|
||||
@@ -142,7 +173,8 @@ const ListAssignPage = () => {
|
||||
<AssignTargetList
|
||||
prjctIdx={prjctIdx}
|
||||
enabled={enabled}
|
||||
assignType={assignType}
|
||||
assignType={effectiveAssignType}
|
||||
userRole={userRole}
|
||||
selectedId={selectedAssignId}
|
||||
onSelect={setSelectedAssignId}
|
||||
/>
|
||||
@@ -158,10 +190,11 @@ const ListAssignPage = () => {
|
||||
resultCodes={resultCodeArray}
|
||||
surveys={surveyArray}
|
||||
listHeaders={listHeaders}
|
||||
fieldInterviewEnabled={selectedProject.ff !== false}
|
||||
selectMode="none"
|
||||
onCurrentFilterChange={setCurrentListFilter}
|
||||
onFilterSummaryChange={setFilterSummary}
|
||||
excludeFilterHeaderTypes={[assignType]}
|
||||
excludeFilterHeaderTypes={[effectiveAssignType]}
|
||||
externalAssignFilter={externalAssignFilter}
|
||||
filterActions={
|
||||
<KriMultiSelect
|
||||
@@ -170,14 +203,14 @@ const ListAssignPage = () => {
|
||||
onChange={handleAssignFilterChange}
|
||||
getValue={(item) => item.id}
|
||||
getLabel={(item) => item.name}
|
||||
placeholder={`${LIST_HEADER_TYPE_LABEL[assignType]} 필터`}
|
||||
placeholder={`${LIST_HEADER_TYPE_LABEL[effectiveAssignType]} 필터`}
|
||||
widthClassName="w-56"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
}
|
||||
rightActions={
|
||||
<>
|
||||
{assignType === ListHeaderAssignConst.CONTACT_INTERVIEWER && (
|
||||
{effectiveAssignType === ListHeaderAssignConst.CONTACT_INTERVIEWER && (
|
||||
<label className="flex items-center gap-2 text-base cursor-pointer">
|
||||
<Checkbox
|
||||
checked={transferResve}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { UserInfo } from "@/types/user";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { KriSelect, KriSelectItem } from "@/components/common/KriSelect";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import {CONTACT_INTERVIEWER_ROLE} from "@/const/userConst";
|
||||
import { CONTACT_INTERVIEWER_ROLE, FIELD_INTERVIEWER_ROLE } from "@/const/userConst";
|
||||
|
||||
import {
|
||||
useFieldworkUsersQuery,
|
||||
@@ -61,8 +61,9 @@ const ProjectAssignPage = () => {
|
||||
const roles = roleQuery.data ?? [];
|
||||
return roles
|
||||
.filter(r => isFieldWorkUser(r.roleCd))
|
||||
.filter(r => selectedProject?.ff !== false || r.roleCd !== FIELD_INTERVIEWER_ROLE)
|
||||
.map(r => ({ value: String(r.roleCd), label: r.roleNm }));
|
||||
}, [roleQuery.data]);
|
||||
}, [roleQuery.data, selectedProject?.ff]);
|
||||
|
||||
const [companyFilter, setCompanyFilter] = useState<string>('');
|
||||
const [roleFilter, setRoleFilter] = useState<KriSelectItem | undefined>(undefined);
|
||||
@@ -233,8 +234,8 @@ const ProjectAssignPage = () => {
|
||||
}, [auth.user?.userCmpn, companyArray, companyFilter]);
|
||||
|
||||
useEffect(() => {
|
||||
if (roleFilter) return;
|
||||
if (roleArray.length === 0) return;
|
||||
if (roleFilter && roleArray.some(role => role.value === roleFilter.value)) return;
|
||||
|
||||
const contactRole = roleArray.find(r => r.value === String(CONTACT_INTERVIEWER_ROLE));
|
||||
setRoleFilter(contactRole ?? roleArray[0]);
|
||||
|
||||
@@ -2,19 +2,17 @@
|
||||
|
||||
import { Suspense, useEffect, useMemo, useState } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { ArrowLeft, CalendarClock, RefreshCw } from "lucide-react";
|
||||
import { ArrowLeft, RefreshCw } from "lucide-react";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import { LoadingOverlayAdapter } from "@/components/app-shell/LoadingOverlayAdapter";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { useDialog } from "@/hooks/useDialog";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { useListDetailQuery, useListHeaderQuery, useListReserveByUserQuery, useUpdateListMutation } from "@/query/list";
|
||||
import { useListDetailQuery, useListHeaderQuery, useUpdateListMutation } from "@/query/list";
|
||||
import { useProjectInfoQuery, useResultCodesQuery } from "@/query/project";
|
||||
import ListContactInfoPanel, { buildInitialValues } from "@/components/list-contact/ListContactInfoPanel";
|
||||
import ListContactEventPanel from "@/components/list-contact/ListContactEventPanel";
|
||||
import ListUpdateHistoryPanel from "@/components/list-contact/ListUpdateHistoryPanel";
|
||||
import ReservationListDialog from "@/components/dialog/ReservationListDialog";
|
||||
import { createEmptyListFilter, type listHeader } from "@/types/list";
|
||||
import type { ResultCode } from "@/types/project";
|
||||
import { isManager } from "@/utils/userRole";
|
||||
@@ -31,7 +29,6 @@ const ListContactPageContent = () => {
|
||||
const mounted = useMounted();
|
||||
const { auth } = useAuth();
|
||||
const { selectedProject } = useSelectedProject();
|
||||
const { isDialogOpen, showDialog } = useDialog();
|
||||
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
||||
const prjctCd = selectedProject?.prjctCd ?? "";
|
||||
@@ -116,9 +113,6 @@ const ListContactPageContent = () => {
|
||||
const resultCodesQuery = useResultCodesQuery(prjctIdx, queriesEnabled);
|
||||
const updateListMutation = useUpdateListMutation(prjctIdx);
|
||||
|
||||
const reservationDialogOpen = isDialogOpen('reservationListDialog');
|
||||
const reserveByUserQuery = useListReserveByUserQuery(prjctIdx, userId, reservationDialogOpen);
|
||||
|
||||
const listHeaders = useMemo<listHeader[]>(() => listHeaderQuery.data ?? [], [listHeaderQuery.data]);
|
||||
const resultCodeArray = useMemo<ResultCode[]>(() => resultCodesQuery.data ?? [], [resultCodesQuery.data]);
|
||||
|
||||
@@ -139,14 +133,6 @@ const ListContactPageContent = () => {
|
||||
router.push("/list/manage");
|
||||
}, [sid, router]);
|
||||
|
||||
const handleNavigateToSid = (nextSid: string) => {
|
||||
if(shouldBlockNavigation){
|
||||
alert("통화 중에는 이동할 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
router.push(`/list/contact?sid=${encodeURIComponent(nextSid)}`);
|
||||
};
|
||||
|
||||
const handleGoToListManage = () => {
|
||||
if(shouldBlockNavigation){
|
||||
alert("통화 중에는 이동할 수 없습니다.");
|
||||
@@ -206,10 +192,6 @@ const ListContactPageContent = () => {
|
||||
<RefreshCw className={`h-4 w-4 ${listDetailQuery.isFetching ? "animate-spin" : ""}`} />
|
||||
</Button>
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('reservationListDialog')}>
|
||||
<CalendarClock className="h-4 w-4" />
|
||||
예약리스트 조회
|
||||
</Button>
|
||||
{isEditing ? (
|
||||
<Button type="button" variant="outline" disabled={updateListMutation.isPending} onClick={handleCancelEdit}>
|
||||
취소
|
||||
@@ -258,8 +240,6 @@ const ListContactPageContent = () => {
|
||||
detail={listDetailQuery.data}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ReservationListDialog reservations={reserveByUserQuery.data ?? []} onSelectReservation={handleNavigateToSid} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -68,6 +68,7 @@ const downloadArrayBuffer = (buffer: ArrayBuffer, filename: string, type = 'appl
|
||||
const createEmptySearchUiState = (): ListSearchUiState => ({
|
||||
searchText: '',
|
||||
searchContactResult: [],
|
||||
searchContactDateRange: { from: '', to: '' },
|
||||
searchInterviewResult: [],
|
||||
surveyResultSelections: {},
|
||||
filterRows: [],
|
||||
@@ -284,6 +285,7 @@ const ListManagePage = () => {
|
||||
resultCodes={resultCodeArray}
|
||||
surveys={surveyArray}
|
||||
listHeaders={headerManageRows}
|
||||
fieldInterviewEnabled={selectedProject?.ff !== false}
|
||||
enableBatchEdit={canManageList}
|
||||
selectMode={canManageList ? 'multi' : 'click-event'}
|
||||
refreshKey={listRefreshKey}
|
||||
|
||||
@@ -49,28 +49,15 @@ const buildRows = (data: SendResultSummaryResponse[]): SummaryRow[] =>
|
||||
const moneyUnit = (value: number) => `${value.toLocaleString()}원`;
|
||||
const caseUnit = (value: number) => `${value.toLocaleString()}건`;
|
||||
|
||||
const getFirstDayOfMonth = (date: Date) => {
|
||||
const d = new Date(date.getFullYear(), date.getMonth(), 1);
|
||||
return d.toISOString().slice(0, 10);
|
||||
};
|
||||
|
||||
const getLastDayOfMonth = (date: Date) => {
|
||||
const d = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
||||
return d.toISOString().slice(0, 10);
|
||||
};
|
||||
|
||||
const MessageProgressPage = () => {
|
||||
const mounted = useMounted();
|
||||
const { selectedProject } = useSelectedProject();
|
||||
|
||||
const [dateRange, setDateRange] = useState(() => {
|
||||
const now = new Date();
|
||||
return { from: getFirstDayOfMonth(now), to: getLastDayOfMonth(now) };
|
||||
});
|
||||
const [dateRange, setDateRange] = useState({ from: "", to: "" });
|
||||
|
||||
const prjctCd = selectedProject?.prjctCd ?? "";
|
||||
const itrntPrjctCd = selectedProject?.itrntPrjctCd ?? "";
|
||||
const enabled = mounted && !!prjctCd && !!dateRange.from && !!dateRange.to;
|
||||
const enabled = mounted && !!prjctCd;
|
||||
|
||||
const summaryQuery = useSendResultSummaryQuery(
|
||||
{
|
||||
|
||||
@@ -333,7 +333,7 @@ const SurveyCard = ({ survey, index, itrntPrjctCd, userTeam, invalidField, onReg
|
||||
const ProjectInfoPage = () => {
|
||||
const router = useRouter();
|
||||
const mounted = useMounted();
|
||||
const {selectedProject} = useSelectedProject();
|
||||
const {selectedProject, setSelectedProject} = useSelectedProject();
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
const {users} = useItrntUserList();
|
||||
const {auth} = useAuth();
|
||||
@@ -544,6 +544,16 @@ const ProjectInfoPage = () => {
|
||||
}
|
||||
|
||||
await updateMutation.mutateAsync(requestUpdateProject);
|
||||
const savedProjectInfo = requestUpdateProject.projectInfo;
|
||||
setSelectedProject({
|
||||
prjctIdx: savedProjectInfo.prjctIdx,
|
||||
prjctCd: savedProjectInfo.prjctCd,
|
||||
prjctName: savedProjectInfo.prjctName,
|
||||
itrntPrjctCd: savedProjectInfo.itrntPrjctCd,
|
||||
ownerDept: savedProjectInfo.ownerDept,
|
||||
ownerFw: savedProjectInfo.ownerFw,
|
||||
ff: savedProjectInfo.ff,
|
||||
});
|
||||
initialProjectInfoRef.current = projectInfo;
|
||||
alert("저장되었습니다.");
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import {RouteContext} from "@/types/common";
|
||||
import {createContactApi} from "@/lib/http-server";
|
||||
import {errorToResponse} from "@kri/common/http";
|
||||
import type {ProjectCompanyAssignSummary, ProjectFieldworkAssignSummary} from "@/types/list";
|
||||
|
||||
export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
@@ -19,6 +20,25 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "prjct-cmpn-summary" && slug.length === 2) {
|
||||
const result = await contactApi.get<ProjectCompanyAssignSummary>(`/assign/prjct-cmpn-summary/${slug[1]}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "prjct-fieldwork-summary" && slug.length === 2) {
|
||||
const assignType = req.nextUrl.searchParams.get("assignType");
|
||||
const cmpnIds = req.nextUrl.searchParams.get("cmpnIds");
|
||||
if (!assignType) {
|
||||
return NextResponse.json({ message: "assignType이 필요합니다." }, { status: 400 });
|
||||
}
|
||||
|
||||
const query = `?assignType=${assignType}${cmpnIds ? `&cmpnIds=${encodeURIComponent(cmpnIds)}` : ""}`;
|
||||
const result = await contactApi.get<ProjectFieldworkAssignSummary>(
|
||||
`/assign/prjct-fieldwork-summary/${slug[1]}${query}`,
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
|
||||
@@ -30,6 +30,23 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const DELETE = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
const [action] = slug;
|
||||
const contactApi = await createContactApi();
|
||||
|
||||
if (action === "event" && slug.length === 2) {
|
||||
await contactApi.del(`/list-hist/event/${slug[1]}`);
|
||||
return new NextResponse(null, { status: 204 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
}
|
||||
};
|
||||
|
||||
export const PUT = async (req: NextRequest, context: RouteContext) => {
|
||||
try {
|
||||
const { slug = [] } = await context.params;
|
||||
|
||||
@@ -17,11 +17,31 @@ export const GET = async (req: NextRequest, context: RouteContext) => {
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "user" && slug.length === 3 && slug[2] === "search") {
|
||||
const fromDt = req.nextUrl.searchParams.get("fromDt");
|
||||
const toDt = req.nextUrl.searchParams.get("toDt");
|
||||
if (!fromDt || !toDt) {
|
||||
return NextResponse.json({ message: "fromDt, toDt가 필요합니다." }, { status: 400 });
|
||||
}
|
||||
|
||||
const result = await contactApi.get<ListReserve[]>(
|
||||
`/reserve/user/${encodeURIComponent(slug[1])}/search?fromDt=${fromDt}&toDt=${toDt}`,
|
||||
);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "user" && slug.length === 3) {
|
||||
const result = await contactApi.get<ListReserve[]>(`/reserve/${slug[1]}/user/${slug[2]}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
if (action === "user" && slug.length === 2) {
|
||||
const requestPast = req.nextUrl.searchParams.get("requestPast");
|
||||
const query = requestPast !== null ? `?requestPast=${requestPast}` : "";
|
||||
const result = await contactApi.get<ListReserve[]>(`/reserve/user/${encodeURIComponent(slug[1])}${query}`);
|
||||
return NextResponse.json(result, { status: 200 });
|
||||
}
|
||||
|
||||
return NextResponse.json({ message: "Not found" }, { status: 404 });
|
||||
} catch (error: unknown) {
|
||||
return errorToResponse(error);
|
||||
|
||||
@@ -251,3 +251,4 @@
|
||||
.ProseMirror [data-resize-container][data-resize-state="resizing"] {
|
||||
outline: 1px dashed #0ea5e9;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user