Skip to content

feat: study handwriting API 추가#289

Open
b0nsu wants to merge 1 commit intodevelopfrom
feat/mat-350-study-handwriting-api
Open

feat: study handwriting API 추가#289
b0nsu wants to merge 1 commit intodevelopfrom
feat/mat-350-study-handwriting-api

Conversation

@b0nsu
Copy link
Copy Markdown
Collaborator

@b0nsu b0nsu commented Apr 24, 2026

Summary

문제 풀기/포인팅 화면에서 필기 저장을 위한 study handwriting API hook을 추가합니다.

Linear

Changes

  • useGetStudyHandwriting: publishId/problemId 기반 필기 조회 hook (staleTime: Infinity, enabled 패턴)
  • putUpdateStudyHandwriting: 필기 저장 mutation + setQueryData로 캐시 즉시 반영
  • study/index.ts: 새 hook export 추가
  • schema.d.ts: pnpm openapi 재생성 (study handwriting 엔드포인트 타입 포함)

Testing

  • 타입 에러 없음 확인 (pnpm typecheck)
  • API hook 단독 추가이므로 기존 화면에 영향 없음

Risk / Impact

  • 영향 범위: study API layer (신규 추가)
  • 기존 코드에 영향 없음 (새 hook + export만 추가)

- useGetStudyHandwriting: publishId/problemId 기반 필기 조회 hook
- useUpdateStudyHandwriting: 필기 저장 mutation + setQueryData 캐시 즉시 반영
- study/index.ts: 새 hook export 추가
- schema.d.ts: openapi 타입 재생성

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 24, 2026

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pointer-admin Ready Ready Preview, Comment Apr 24, 2026 4:35am

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new student study handwriting API layer to the native app so problem-solving/pointing screens can fetch and persist handwriting tied to (publishId, problemId) using the existing OpenAPI + TanStack Query client setup.

Changes:

  • Added useGetStudyHandwriting query hook for fetching handwriting with staleTime: Infinity and enabled support.
  • Added useUpdateStudyHandwriting mutation hook to save/update handwriting and immediately update the query cache.
  • Regenerated OpenAPI types (schema.d.ts) and exported the new hooks from the study controller index.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
apps/native/src/types/api/schema.d.ts Adds Study handwriting endpoint types (and other regenerated schema changes).
apps/native/src/apis/controller/student/study/index.ts Exposes new handwriting hooks from the study controller entrypoint.
apps/native/src/apis/controller/student/study/handwriting/useGetStudyHandwriting.ts New query hook for (publishId, problemId) handwriting retrieval.
apps/native/src/apis/controller/student/study/handwriting/putUpdateStudyHandwriting.ts New mutation hook for saving handwriting + updating cached query data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to +47
onSuccess: (_, { publishId, problemId, request }) => {
queryClient.setQueryData(
TanstackQueryClient.queryOptions(
'get',
'/api/student/study/problem/{publishId}/{problemId}/handwriting',
{
params: { path: { publishId, problemId } },
}
).queryKey,
{ data: request.data }
);
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onSuccess updates the handwriting query cache with { data: request.data }, which does not match the query’s response type (StudyHandwritingResp includes publishId, problemId, and optionally updatedAt). This can leave the cache in an inconsistent shape and break consumers that expect those fields. Update the cache with the actual mutation response (or merge with existing cached value while preserving required fields).

Copilot uses AI. Check for mistakes.
},
{
enabled,
staleTime: Infinity,
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This query sets staleTime: Infinity but omits gcTime: Infinity, unlike other study hooks (e.g. useGetProblem) that keep these caches from being garbage-collected. With the default gcTime, handwriting may be evicted after inactivity and refetched unexpectedly. Consider setting gcTime: Infinity here as well to align with the surrounding study query caching strategy.

Suggested change
staleTime: Infinity,
staleTime: Infinity,
gcTime: Infinity,

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants