Files
contact-front/src/query/reserve.ts
kric_jspark 081b53945a 260812_01_ENH: 배정·진행 현황 개선 및 예약/이벤트 이력 기능 추가
- 프로젝트별 외주사·필드워커 배정 현황 및 미배정 건수 UI 추가
- 현장 면접 진행 여부와 사용자 권한에 따른 배정 탭·필터·컬럼 노출 제어
- 컨택 마지막 이벤트 일자 필터·정렬 및 결과/일자 컬럼 분리
- 컨택·면접·발송 현황의 날짜 범위 선택 optional 처리
- 진행 현황의 미배정 표시 및 일자별 미사용 결과 제외
- 전역 예약 기간 조회·이동 및 5분 단위 예약 알림 추가
- 내부 관리자용 이벤트 이력 단건 삭제 기능 추가
- 리스트 필터 UI 및 일반 헤더 정렬 기준 개선
- 프로젝트 저장 시 선택 프로젝트 정보 동기화
2026-08-12 08:41:27 +09:00

31 lines
1.0 KiB
TypeScript

"use client";
import { useQuery } from "@tanstack/react-query";
import { nextApi } from "@/lib/http-client";
import { qk } from "@/query/key/keys";
import type { ListReserve } from "@/types/list";
/**
* 헤더의 예약 조회 다이얼로그용: 전체 프로젝트 대상, 날짜 range로 조회.
*/
export function useReserveSearchQuery(userId: string, fromDt: string, toDt: string, enabled: boolean) {
return useQuery({
queryKey: qk.reserveSearch(userId, fromDt, toDt),
queryFn: () =>
nextApi.get<ListReserve[]>(`/reserve/user/${encodeURIComponent(userId)}/search?fromDt=${fromDt}&toDt=${toDt}`),
enabled,
staleTime: 0,
refetchOnMount: "always",
meta: { ignoreGlobalLoading: true },
});
}
/**
* 5분 정각 폴링용: react-query 캐시 없이 그때그때 호출한다(useReserveNotification 훅 전용).
*/
export function fetchReserveNotifications(userId: string, requestPast: boolean) {
return nextApi.get<ListReserve[]>(
`/reserve/user/${encodeURIComponent(userId)}?requestPast=${requestPast}`,
);
}