feat(flow): focus session api v2 웹 계약 전환

This commit is contained in:
2026-03-16 17:30:52 +09:00
parent f4910238a0
commit 38abc1e0c7
30 changed files with 390 additions and 702 deletions

View File

@@ -9,7 +9,7 @@ interface RawFocusSession {
id: number | string;
sceneId: string;
goal: string;
timerPresetId: string;
atmosphereId?: string | null;
soundPresetId: string | null;
focusPlanItemId?: number | null;
microStep?: string | null;
@@ -35,7 +35,7 @@ export interface FocusSession {
id: string;
sceneId: string;
goal: string;
timerPresetId: string;
atmosphereId?: string | null;
soundPresetId: string | null;
focusPlanItemId?: string | null;
microStep?: string | null;
@@ -55,7 +55,8 @@ export interface FocusSession {
export interface StartFocusSessionRequest {
sceneId: string;
goal: string;
timerPresetId: string;
focusDurationMinutes: number;
atmosphereId: string;
soundPresetId?: string | null;
focusPlanItemId?: string;
microStep?: string | null;
@@ -71,6 +72,7 @@ export interface CompleteFocusSessionRequest {
export interface UpdateCurrentFocusSessionSelectionRequest {
sceneId?: string;
atmosphereId?: string | null;
soundPresetId?: string | null;
}
@@ -86,8 +88,9 @@ export interface ExtendCurrentPhaseRequest {
export interface AdvanceCurrentGoalRequest {
completedGoal: string;
nextGoal: string;
sceneId: string;
timerPresetId: string;
sceneId?: string;
focusDurationMinutes?: number;
atmosphereId?: string | null;
soundPresetId?: string | null;
focusPlanItemId?: string;
}

View File

@@ -1,17 +1,16 @@
import {
DEFAULT_PRESET_OPTIONS,
NOTIFICATION_INTENSITY_OPTIONS,
} from '@/shared/config/settingsOptions';
import { copy } from '@/shared/i18n';
import { apiClient } from '@/shared/lib/apiClient';
export type NotificationIntensity = (typeof NOTIFICATION_INTENSITY_OPTIONS)[number];
export type DefaultPresetId = (typeof DEFAULT_PRESET_OPTIONS)[number]['id'];
export interface UserFocusPreferences {
reduceMotion: boolean;
notificationIntensity: NotificationIntensity;
defaultPresetId: DefaultPresetId;
defaultAtmosphereId?: string | null;
defaultDurationMinutes?: number | null;
defaultSceneId: string | null;
defaultSoundPresetId: string | null;
}
@@ -21,7 +20,8 @@ export type UpdateUserFocusPreferencesRequest = Partial<UserFocusPreferences>;
export const DEFAULT_USER_FOCUS_PREFERENCES: UserFocusPreferences = {
reduceMotion: false,
notificationIntensity: copy.preferences.defaultNotificationIntensity,
defaultPresetId: DEFAULT_PRESET_OPTIONS[0].id,
defaultAtmosphereId: null,
defaultDurationMinutes: null,
defaultSceneId: null,
defaultSoundPresetId: null,
};
@@ -30,7 +30,7 @@ export const preferencesApi = {
/**
* Backend Codex:
* - 로그인한 사용자의 집중 관련 개인 설정을 반환한다.
* - 최소 reduceMotion, notificationIntensity, defaultPresetId를 포함한다.
* - 최소 reduceMotion, notificationIntensity, defaultAtmosphereId, defaultDurationMinutes를 포함한다.
* - 아직 저장된 값이 없으면 서버 기본값을 내려주거나 null 필드 없이 기본 스키마로 응답한다.
*/
getFocusPreferences: async (): Promise<UserFocusPreferences> => {

View File

@@ -86,8 +86,11 @@ export interface WeeklyReviewViewModel {
completionQuality: WeeklyReviewSection;
carryForward: {
hintKey: ReviewCarryHint;
presetId: string;
presetLabel: string;
atmosphereId: string;
atmosphereLabel: string;
sceneId: string;
soundPresetId: string | null;
durationMinutes: number;
keepDoing: string;
tryNext: string;
ctaLabel: string;
@@ -256,13 +259,17 @@ const buildCarryForward = (summary: FocusStatsSummary): WeeklyReviewViewModel['c
const params = new URLSearchParams({
review: 'weekly',
carryHint: hintKey,
entryPreset: 'forest-50-10',
entryAtmosphereId: 'forest-draft',
entryDurationMinutes: '50',
});
return {
hintKey,
presetId: 'forest-50-10',
presetLabel: 'Forest · Forest Birds',
atmosphereId: 'forest-draft',
atmosphereLabel: 'Forest Draft',
sceneId: 'forest',
soundPresetId: 'forest-birds',
durationMinutes: 50,
keepDoing,
tryNext,
ctaLabel: copy.stats.reviewCarryCta,