Skip to content

fix:근무 유형 및 업무 보드 RPC 보정(#68) - #68

Merged
seongjinss555 merged 3 commits into
developfrom
feat/#68/work-schedule-task-rpc-fix
Jul 16, 2026
Merged

fix:근무 유형 및 업무 보드 RPC 보정(#68)#68
seongjinss555 merged 3 commits into
developfrom
feat/#68/work-schedule-task-rpc-fix

Conversation

@seongjinss555

@seongjinss555 seongjinss555 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Pull Request

작업 내용

  • 근무 유형 추가 RPC의 반환 컬럼 충돌과 기본 이름 중복을 보정했습니다.
  • 업무 보드 상태값의 UI 표기(in-progress)를 DB enum 값(in_progress)으로 변환해 정렬 저장이 실패하지 않도록 수정했습니다.
  • 업무 생성·정렬 RPC의 생성자 및 멤버십 검증을 auth.uid() 기반으로 정리했습니다.

작업 결과

  • 동일 워크스페이스에서 근무 유형을 연속 추가해도 새 근무, 새 근무 2처럼 고유한 이름으로 생성됩니다.
  • 프로젝트 관리 보드에서 업무를 진행 중 열로 이동해도 task_status enum 변환 오류가 발생하지 않습니다.
  • 기존 원격 DB에는 새 마이그레이션 SQL 적용이 필요합니다.

변경 사항

Added

  • 근무 유형 생성 RPC 보정 마이그레이션
  • 업무 생성·보드 정렬 RPC 보안 및 상태값 정규화 마이그레이션

Changed

  • 업무 보드 RPC 호출 시 UI 상태값을 DB 상태값으로 변환
  • 업무 생성 RPC가 호출 인자 대신 인증 세션으로 생성자·담당자를 결정

Fixed

  • 근무 유형 생성 RPC의 id 컬럼 모호성 및 기본 이름 중복 오류
  • 업무 정렬 시 in-progress enum 변환 오류

실행화면

  • 별도 첨부 없음

테스트

  • npm run lint
  • npm run typecheck
  • git diff --check
  • Supabase SQL Editor에서 신규 마이그레이션 적용 후 근무 유형 추가 및 보드 정렬 수동 확인

리뷰 요청사항

  • 기존 원격 DB에 이미 생성된 RPC를 20260716000000, 20260716010000, 20260716020000 마이그레이션으로 안전하게 보정하는 흐름을 확인 부탁드립니다.

관련 이슈

Closes #68

Summary by CodeRabbit

  • 새 기능

    • 업무 생성 시 오늘 날짜가 자동으로 마감일에 반영됩니다.
    • 보드에서 업무 상태와 순서가 안정적으로 저장됩니다.
    • 새 근무유형 생성 시 이름이 자동으로 조정되어 중복을 방지합니다.
    • 근무유형 생성 시 주간 기본 일정이 함께 설정됩니다.
  • 버그 수정

    • 중복된 근무유형 이름 입력 시 이해하기 쉬운 안내 메시지를 제공합니다.
    • 업무 및 프로필 정보 접근 권한을 인증된 구성원 기준으로 강화했습니다.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seongjinss555, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1e98ef59-d893-4be2-995a-69666ca9f942

📥 Commits

Reviewing files that changed from the base of the PR and between 09ccb79 and f88e994.

📒 Files selected for processing (5)
  • src/entities/work-schedule/api/work-schedule-actions.ts
  • src/features/manage-work-schedule/ui/WorkScheduleBoard.tsx
  • supabase/migrations/20260716000000_fix_work_shift_type_default_name.sql
  • supabase/migrations/20260716010000_secure_task_rpcs.sql
  • supabase/migrations/20260716020000_normalize_task_board_status.sql
📝 Walkthrough

Walkthrough

업무 생성·보드 정렬 RPC가 인증 사용자와 워크스페이스 멤버십을 검증하도록 변경되었습니다. 보드 상태값은 DB enum 형식으로 정규화되며, 근무유형 이름 중복 처리와 중복 오류 메시지가 보완되었습니다.

Changes

RPC 보정

Layer / File(s) Summary
업무 생성 RPC 인증 주체 정리
src/entities/task/api/create-task.ts, supabase/migrations/20260714100000_..., supabase/migrations/20260716010000_...
create_task 호출에서 p_user_id를 제거하고 auth.uid() 기반으로 생성자와 담당자를 결정하며 워크스페이스 멤버십을 검증합니다.
업무 보드 상태 정규화
src/entities/task/api/update-task-board.ts, supabase/migrations/20260714100000_..., supabase/migrations/20260716010000_..., supabase/migrations/20260716020000_...
UI 상태값의 하이픈을 언더스코어로 변환해 DB enum으로 전달하고, 인증·멤버십 및 갱신 행 수를 검증합니다.
근무유형 이름 중복 처리
supabase/migrations/20260714024702_..., supabase/migrations/20260716000000_...
워크스페이스 잠금과 이름 후보 탐색을 통해 새 근무, 새 근무 2 등의 고유 이름을 생성합니다.
근무유형 중복 오류 처리
src/entities/work-schedule/api/work-schedule-actions.ts
생성 및 수정 과정에서 23505 오류를 별도의 사용자 안내 메시지로 변환합니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant TaskBoard
  participant updateTaskBoard
  participant update_task_board
  participant tasks
  TaskBoard->>updateTaskBoard: 상태와 정렬 순서 전달
  updateTaskBoard->>updateTaskBoard: UI 상태를 DB 상태로 변환
  updateTaskBoard->>update_task_board: p_workspace_id, p_tasks 전달
  update_task_board->>tasks: task 상태와 sort_order 갱신
  tasks-->>update_task_board: 갱신 행 수 반환
Loading

Possibly related PRs

  • TeampleRun/syncly#50: 근무유형 생성 RPC의 원자적 스케줄 생성과 동시성 제어를 수정했습니다.
  • TeampleRun/syncly#52: 업무 생성 및 보드 업데이트 서버 액션의 기반 흐름과 직접 연결됩니다.

Suggested reviewers: wjswlgh96

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning tasks/work-schedule 범위를 넘어 여러 테이블의 dev_full_access 제거와 profiles 정책 변경이 포함됩니다. 이 보안/RLS 변경은 별도 PR로 분리하거나, 현재 이슈와의 직접 연관성을 설명해 주세요.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 근무 유형 및 업무 보드 RPC 보정이라는 핵심 변경을 간결하게 잘 요약합니다.
Description check ✅ Passed 템플릿의 주요 섹션을 대부분 채웠고 작업 내용·결과·변경 사항·테스트·이슈도 포함합니다.
Linked Issues check ✅ Passed 근무 유형 중복 방지, in-progress 정규화, auth.uid() 기반 검증, 마이그레이션 적용 요구를 모두 충족합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#68/work-schedule-task-rpc-fix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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/work-schedule/api/work-schedule-actions.ts`:
- Around line 118-124: Update the work-schedule creation and update error flow
around the action’s duplicate-name handling and the WorkScheduleBoard.tsx
create/edit handlers so the handlers receive and display the user-facing
duplicate-name message instead of always showing a fixed toast. Preserve generic
error handling for other failures, and expose only a safe error code or message
suitable for UI branching.

In `@supabase/migrations/20260716000000_fix_work_shift_type_default_name.sql`:
- Line 2: Remove the explicit transaction boundaries from the migration by
deleting the BEGIN statement at the start and its matching COMMIT statement at
the end. Leave the migration statements and ordering unchanged so transaction
management remains with the migration runner.

In `@supabase/migrations/20260716010000_secure_task_rpcs.sql`:
- Line 2: 마이그레이션 파일의 중첩 트랜잭션을 제거하세요.
supabase/migrations/20260716010000_secure_task_rpcs.sql의 2-2와 126-126에서 각각
begin과 commit을 삭제하고,
supabase/migrations/20260716020000_normalize_task_board_status.sql의 2-2와
59-59에서도 각각 begin과 commit을 삭제하여 마이그레이션 도구가 트랜잭션을 관리하도록 하세요.
🪄 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: ef32be6a-a253-46da-8d70-b963f2db94de

📥 Commits

Reviewing files that changed from the base of the PR and between 8bd2313 and 09ccb79.

📒 Files selected for processing (8)
  • src/entities/task/api/create-task.ts
  • src/entities/task/api/update-task-board.ts
  • src/entities/work-schedule/api/work-schedule-actions.ts
  • supabase/migrations/20260714024702_make_work_shift_creation_atomic.sql
  • supabase/migrations/20260714100000_create_task_rpcs_and_restrict_browser_rls.sql
  • supabase/migrations/20260716000000_fix_work_shift_type_default_name.sql
  • supabase/migrations/20260716010000_secure_task_rpcs.sql
  • supabase/migrations/20260716020000_normalize_task_board_status.sql
💤 Files with no reviewable changes (1)
  • src/entities/task/api/create-task.ts

Comment thread src/entities/work-schedule/api/work-schedule-actions.ts Outdated
Comment thread supabase/migrations/20260716000000_fix_work_shift_type_default_name.sql Outdated
@@ -0,0 +1,126 @@
-- 원격 DB에 누락된 태스크 RPC를 추가하고, 생성자 식별을 auth.uid() 기준으로 고정한다.
begin;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

마이그레이션 파일 내부의 중첩 트랜잭션을 제거하세요.

마이그레이션 도구가 관리하는 트랜잭션을 직접 커밋하면 스키마 적용과 이력 기록의 원자성이 깨질 수 있습니다.

  • supabase/migrations/20260716010000_secure_task_rpcs.sql#L2-L2: begin을 제거하세요.
  • supabase/migrations/20260716010000_secure_task_rpcs.sql#L126-L126: commit을 제거하세요.
  • supabase/migrations/20260716020000_normalize_task_board_status.sql#L2-L2: begin을 제거하세요.
  • supabase/migrations/20260716020000_normalize_task_board_status.sql#L59-L59: commit을 제거하세요.
🧰 Tools
🪛 Squawk (2.59.0)

[warning] 2-2: There is an existing transaction already in progress, managed by your migration tool. Put migration statements in separate files to have them be in separate transactions or don't use the assume-in-transaction setting.

(transaction-nesting)

📍 Affects 2 files
  • supabase/migrations/20260716010000_secure_task_rpcs.sql#L2-L2 (this comment)
  • supabase/migrations/20260716010000_secure_task_rpcs.sql#L126-L126
  • supabase/migrations/20260716020000_normalize_task_board_status.sql#L2-L2
  • supabase/migrations/20260716020000_normalize_task_board_status.sql#L59-L59
🤖 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 `@supabase/migrations/20260716010000_secure_task_rpcs.sql` at line 2, 마이그레이션
파일의 중첩 트랜잭션을 제거하세요. supabase/migrations/20260716010000_secure_task_rpcs.sql의
2-2와 126-126에서 각각 begin과 commit을 삭제하고,
supabase/migrations/20260716020000_normalize_task_board_status.sql의 2-2와
59-59에서도 각각 begin과 commit을 삭제하여 마이그레이션 도구가 트랜잭션을 관리하도록 하세요.

Source: Linters/SAST tools

@JiWoongE
JiWoongE self-requested a review July 16, 2026 03:38

@JiWoongE JiWoongE left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

고생하셨습니다~

@seongjinss555
seongjinss555 merged commit 91ccb4a into develop Jul 16, 2026
1 check passed
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