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 } }); + } }, });