fix:자료실 업로드 및 알림 목록 오류 수정(#71) - #72
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthrough자료실은 브라우저 직접 업로드, 링크 제공자 저장·표시, 다운로드 UI를 지원하도록 변경되었습니다. 알림은 전체 목록 페이지와 20건 단위 추가 조회, 읽음 처리를 지원하며 헤더와 패널이 실제 상태를 표시합니다. Changes자료실 리소스 관리
알림 전체 목록
Supabase 함수 타입 선언
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)파일 업로드sequenceDiagram
participant User
participant ResourceAddDialog
participant SupabaseStorage
participant createFileResource
User->>ResourceAddDialog: 파일 선택 또는 드롭
ResourceAddDialog->>SupabaseStorage: 검증된 파일 업로드
ResourceAddDialog->>createFileResource: storagePath 메타데이터 저장
createFileResource-->>ResourceAddDialog: 생성 결과 반환
전체 알림 조회sequenceDiagram
participant NotificationsPage
participant NotificationsView
participant getNotificationsPage
participant Supabase
NotificationsPage->>getNotificationsPage: 초기 알림 페이지 요청
NotificationsPage->>NotificationsView: initialData와 viewerId 전달
NotificationsView->>getNotificationsPage: 다음 offset 요청
getNotificationsPage->>Supabase: 사용자 알림 페이지 조회
Supabase-->>NotificationsView: notifications와 hasMore 반환
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/entities/resource/api/resource-actions.ts`:
- Around line 10-11: Define a single RESOURCE_LINK_PROVIDERS constant and derive
the ResourceLinkProvider type and Zod schema from it in
src/entities/resource/api/resource-actions.ts#L10-L11; reuse that type in
createLinkResource’s inline union. Replace the hardcoded provider array in
src/entities/resource/api/get-resource-library.ts#L19-L19, generate or type the
values in src/features/manage-resources/ui/ResourceAddDialog.tsx#L24-L26 from
the shared entity constant, and constrain LINK_PROVIDER_LABEL keys in
src/features/manage-resources/ui/ResourceList.tsx#L9-L14 with the shared type.
Preserve the FSD import direction by having features consume the entities
definition.
In `@src/features/manage-resources/model/use-resource-library-state.ts`:
- Around line 231-234: Update getFileExtension to verify that fileName contains
a dot before treating the final segment as an extension. Preserve the existing
lowercase and alphanumeric validation for dotted filenames, while returning an
empty string for names such as README, Dockerfile, or Makefile.
- Around line 82-84: Update getFileName in get-resource-library.ts to remove the
obsolete UUID-prefix parsing and return undefined, allowing the existing title
fallback from addResource to provide the original filename. Keep
resource.fileName behavior consistent so ResourceList.tsx does not display the
generated UUID.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e53facf4-5a80-4390-83ea-3c28c77991b5
📒 Files selected for processing (16)
next.config.tssrc/app/workspaces/[workspaceId]/notifications/page.tsxsrc/entities/notification/api/get-notifications.tssrc/entities/notification/index.tssrc/entities/notification/model/notification.types.tssrc/entities/resource/api/get-resource-library.tssrc/entities/resource/api/resource-actions.tssrc/features/manage-resources/model/use-resource-library-state.tssrc/features/manage-resources/ui/ResourceAddDialog.tsxsrc/features/manage-resources/ui/ResourceList.tsxsrc/features/workspace-notifications/ui/NotificationPanel.tsxsrc/shared/model/database.types.tssrc/views/notifications/index.tssrc/views/notifications/ui/NotificationsView.tsxsrc/widgets/workspace-shell/ui/WorkspaceHeader.tsxsupabase/migrations/20260720160000_add_resource_link_provider.sql
| const storagePath = `${workspaceId}/${crypto.randomUUID()}${getFileExtension( | ||
| values.file.name, | ||
| )}`; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Storage 키에 구분자가 없어 getFileName의 UUID 제거 로직이 더 이상 동작하지 않습니다.
이전에는 오브젝트명이 <uuid>-<원본파일명> 형태였고, get-resource-library.ts의 getFileName이 ^[0-9a-f-]{36}- 패턴으로 UUID 접두어를 제거해 원본 파일명을 노출했습니다. 이번 변경으로 storagePath가 ${uuid}${ext} (하이픈 없음) 형태가 되어, 해당 정규식이 더는 매치되지 않고 resource.fileName이 그대로 <uuid><ext>를 반환합니다. ResourceList.tsx에서 설명이 없는 파일 자료는 결국 이 값을 표시 폴백으로 사용하므로 사용자에게 무의미한 UUID 문자열이 노출됩니다.
title이 이미 원본 파일명을 폴백으로 담고 있으므로(addResource의 title 계산), get-resource-library.ts의 getFileName을 제거하거나 단순히 undefined를 반환하도록 정리하는 것을 권장합니다.
🐛 제안: getFileName 정리
-function getFileName(storagePath: string | null): string | undefined {
- const objectName = storagePath?.split('/').at(-1);
- return objectName?.replace(/^[0-9a-f-]{36}-/, '');
-}
+// UUID 기반 storagePath에는 원본 파일명이 더 이상 포함되지 않으므로,
+// title이 이미 담고 있는 이름을 표시용으로 사용한다.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/features/manage-resources/model/use-resource-library-state.ts` around
lines 82 - 84, Update getFileName in get-resource-library.ts to remove the
obsolete UUID-prefix parsing and return undefined, allowing the existing title
fallback from addResource to provide the original filename. Keep
resource.fileName behavior consistent so ResourceList.tsx does not display the
generated UUID.
Pull Request
작업 내용
작업 결과
변경 사항
Added
resources.link_provider마이그레이션Changed
Fixed
실행화면
테스트
npm run lintnpm run typechecknpm run build(.next/lock으로 재실행 보류)리뷰 체크리스트
feature/*->develop, 배포 시develop또는release/*->main)Type/#issue-number/description형식을 따릅니다.console.log, 주석, 임시 코드를 제거했습니다.리뷰 요청사항
link_provider마이그레이션을 중점 검토 부탁드립니다.관련 이슈
Closes #71