From 79bb8ce98bc80e4acdb96cc00bf22e08a26c58c4 Mon Sep 17 00:00:00 2001 From: jjangminii Date: Thu, 16 Jul 2026 15:46:03 +0900 Subject: [PATCH] =?UTF-8?q?fix(web):=20=EB=B0=98=EB=B3=B5=20=ED=88=AC?= =?UTF-8?q?=EB=91=90=20=ED=83=80=EC=9D=B4=EB=A8=B8=20=EC=8B=9C=EC=9E=91=20?= =?UTF-8?q?=EC=8B=9C=20=EC=9E=AC=EC=83=9D=ED=95=9C=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=EC=9D=98=20=EB=82=A0=EC=A7=9C=EB=A1=9C=20=EA=B7=80=EC=86=8D?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=ED=95=9C=EB=8B=A4=20(#254)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 타이머 시작 API에 추가된 date 쿼리 파라미터를 반영하도록 orval 코드를 재생성했습니다 - Home/Today/Focus에서 타이머를 시작할 때 재생한 카드의 날짜를 함께 전송하도록 수정해, 반복 투두를 오늘이 아닌 날짜에서 재생해도 해당 날짜에 정확히 귀속되도록 했습니다 --- .../api/generated/endpoints/timer/timer.ts | 25 ++++++++++++------- .../generated/endpoints/timer/timer.zod.ts | 9 ++++++- apps/timo-web/api/generated/models/index.ts | 1 + .../api/generated/models/startTimerParams.ts | 14 +++++++++++ .../home/_hooks/use-home-todos-by-date.ts | 2 +- .../today/_hooks/useTodayTodoList.ts | 2 +- .../(main)/focus/_hooks/use-focus-session.ts | 4 ++- 7 files changed, 44 insertions(+), 13 deletions(-) create mode 100644 apps/timo-web/api/generated/models/startTimerParams.ts diff --git a/apps/timo-web/api/generated/endpoints/timer/timer.ts b/apps/timo-web/api/generated/endpoints/timer/timer.ts index 68c2c738..76aa765e 100644 --- a/apps/timo-web/api/generated/endpoints/timer/timer.ts +++ b/apps/timo-web/api/generated/endpoints/timer/timer.ts @@ -17,6 +17,7 @@ import type { BaseResponseTimerStartResponse, BaseResponseTimerStatusResponse, ErrorDto, + StartTimerParams, TimerActionRequest, TimerExtendRequest, } from "../../models"; @@ -59,17 +60,23 @@ const withQueryKey = ( * 투두의 타이머를 시작합니다. * 한 번에 한 개의 타이머만 실행 가능하며, 이미 실행/일시정지 중인 타이머가 있으면 409를 반환합니다. * - * 응답의 date는 타이머가 귀속되는 날짜(사용자 시간대 기준 시작일)입니다. * 반복 투두는 여러 날짜에 같은 todoId로 노출되므로, 실행중 표시는 todoId가 아닌 (todoId, date) 조합으로 구분해야 합니다. + * 쿼리 파라미터 date로 타이머가 상태를 반영할 대상 날짜를 지정할 수 있으며(미래/과거 포함), 미지정 시 사용자 타임존 기준 오늘로 처리됩니다. 이후 일시정지/재개/완료/중지는 이 날짜를 그대로 사용합니다. * @summary 타이머 시작 */ export const startTimer = ( todoId: number, + params?: StartTimerParams, options?: SecondParameter, signal?: AbortSignal, ) => { return customInstance( - { url: `/api/v1/todos/${todoId}/timers/start`, method: "POST", signal }, + { + url: `/api/v1/todos/${todoId}/timers/start`, + method: "POST", + params, + signal, + }, options, ); }; @@ -81,14 +88,14 @@ export const getStartTimerMutationOptions = < mutation?: UseMutationOptions< Awaited>, TError, - { todoId: number }, + { todoId: number; params?: StartTimerParams }, TContext >; request?: SecondParameter; }): UseMutationOptions< Awaited>, TError, - { todoId: number }, + { todoId: number; params?: StartTimerParams }, TContext > => { const mutationKey = ["startTimer"]; @@ -102,11 +109,11 @@ export const getStartTimerMutationOptions = < const mutationFn: MutationFunction< Awaited>, - { todoId: number } + { todoId: number; params?: StartTimerParams } > = (props) => { - const { todoId } = props ?? {}; + const { todoId, params } = props ?? {}; - return startTimer(todoId, requestOptions); + return startTimer(todoId, params, requestOptions); }; return { mutationFn, ...mutationOptions }; @@ -126,7 +133,7 @@ export const useStartTimer = , TContext = unknown>( mutation?: UseMutationOptions< Awaited>, TError, - { todoId: number }, + { todoId: number; params?: StartTimerParams }, TContext >; request?: SecondParameter; @@ -135,7 +142,7 @@ export const useStartTimer = , TContext = unknown>( ): UseMutationResult< Awaited>, TError, - { todoId: number }, + { todoId: number; params?: StartTimerParams }, TContext > => { return useMutation(getStartTimerMutationOptions(options), queryClient); diff --git a/apps/timo-web/api/generated/endpoints/timer/timer.zod.ts b/apps/timo-web/api/generated/endpoints/timer/timer.zod.ts index 644d29f4..3cbf1c48 100644 --- a/apps/timo-web/api/generated/endpoints/timer/timer.zod.ts +++ b/apps/timo-web/api/generated/endpoints/timer/timer.zod.ts @@ -11,14 +11,21 @@ import * as zod from "zod"; * 투두의 타이머를 시작합니다. * 한 번에 한 개의 타이머만 실행 가능하며, 이미 실행/일시정지 중인 타이머가 있으면 409를 반환합니다. * - * 응답의 date는 타이머가 귀속되는 날짜(사용자 시간대 기준 시작일)입니다. * 반복 투두는 여러 날짜에 같은 todoId로 노출되므로, 실행중 표시는 todoId가 아닌 (todoId, date) 조합으로 구분해야 합니다. + * 쿼리 파라미터 date로 타이머가 상태를 반영할 대상 날짜를 지정할 수 있으며(미래/과거 포함), 미지정 시 사용자 타임존 기준 오늘로 처리됩니다. 이후 일시정지/재개/완료/중지는 이 날짜를 그대로 사용합니다. * @summary 타이머 시작 */ export const StartTimerParams = zod.object({ todoId: zod.number().describe("타이머를 시작할 투두 ID"), }); +export const StartTimerQueryParams = zod.object({ + date: zod.iso + .date() + .optional() + .describe("타이머가 상태를 반영할 대상 날짜(미지정 시 오늘). ISO 형식"), +}); + export const StartTimerResponse = zod.object({ status: zod.number().optional(), message: zod.string().optional(), diff --git a/apps/timo-web/api/generated/models/index.ts b/apps/timo-web/api/generated/models/index.ts index ba4eace1..c6eed87f 100644 --- a/apps/timo-web/api/generated/models/index.ts +++ b/apps/timo-web/api/generated/models/index.ts @@ -61,6 +61,7 @@ export * from "./recommendDurationRequest"; export * from "./recommendDurationResponse"; export * from "./repeatResponse"; export * from "./repeatResponseWeekdaysItem"; +export * from "./startTimerParams"; export * from "./statisticsCalendarResponse"; export * from "./statisticsDailyResponse"; export * from "./statisticsSummaryResponse"; diff --git a/apps/timo-web/api/generated/models/startTimerParams.ts b/apps/timo-web/api/generated/models/startTimerParams.ts new file mode 100644 index 00000000..3d5e484c --- /dev/null +++ b/apps/timo-web/api/generated/models/startTimerParams.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v8.20.0 🍺 + * Do not edit manually. + * Timo API + * Timo 서버 API 명세서 + * OpenAPI spec version: v1 + */ + +export interface StartTimerParams { + /** + * 타이머가 상태를 반영할 대상 날짜(미지정 시 오늘). ISO 형식 + */ + date?: string; +} diff --git a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_hooks/use-home-todos-by-date.ts b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_hooks/use-home-todos-by-date.ts index cedc0fe9..2372754d 100644 --- a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_hooks/use-home-todos-by-date.ts +++ b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_hooks/use-home-todos-by-date.ts @@ -209,7 +209,7 @@ export const useHomeTodosByDate = ( } startTimer( - { todoId }, + { todoId, params: { date: dateKey } }, { onSuccess: () => invalidateTodoDetail(dateKey, todoId), onError: (error: ApiError) => { diff --git a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.ts b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.ts index d263c2ac..99b4cf8b 100644 --- a/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.ts +++ b/apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/today/_hooks/useTodayTodoList.ts @@ -194,7 +194,7 @@ export const useTodayTodoList = ( } startTimer( - { todoId }, + { todoId, params: { date: dateKey } }, { onSuccess: () => invalidateTodoDetail(todoId, dateKey), onError: (error: ErrorType) => { diff --git a/apps/timo-web/app/[locale]/(main)/focus/_hooks/use-focus-session.ts b/apps/timo-web/app/[locale]/(main)/focus/_hooks/use-focus-session.ts index 66230d81..b52bb217 100644 --- a/apps/timo-web/app/[locale]/(main)/focus/_hooks/use-focus-session.ts +++ b/apps/timo-web/app/[locale]/(main)/focus/_hooks/use-focus-session.ts @@ -178,7 +178,9 @@ export const useFocusSession = ({ stopTimer, changeTodoStatus, onNoTimer: () => { - if (todo) startTimer({ todoId: todo.todoId }); + if (todo) { + startTimer({ todoId: todo.todoId, params: { date: focusView.date } }); + } }, });