백로그
0할 일
0진행 중
0리뷰
0완료 (15일)
3[P0-1] users 테이블 중복 컬럼 제거 마이그레이션
## 목표 users 테이블에서 user_settings와 중복되는 3개 컬럼을 제거하는 마이그레이션 생성 및 실행 ## 제거 대상 - `notification_enabled` (boolean, default: false) - `notification_time` (integer) - `current_session_id` (string) 이 3개 컬럼은 user_settings 테이블에도 동일하게 존재하며, 코드에서는 모두 `user_setting.xxx`로 접근합니다. ## 작업 순서 1. `grep -r "users\.\(notification_enabled\|notification_time\|current_session_id\)" app/` 로 코드 참조 없음 재확인 2. `bin/rails generate migration RemoveDuplicateColumnsFromUsers` 실행 3. 마이그레이션 파일에 remove_column 3개 작성 4. `bin/rails db:migrate` 실행 5. `bin/rails test` 전체 테스트 실행 → 0 failures 확인 ## 주의사항 - SQLite remove_column은 테이블 재생성 → uuid 타입 소실 가능성 확인 - db/structure.sql 자동 갱신 확인 - 마이그레이션 후 User 모델에서 해당 컬럼 참조가 없는지 확인 - seeds.rb에서 해당 컬럼 사용 여부 확인 ## 완료 기준 - 마이그레이션 성공 - 전체 테스트 통과 (430+ tests, 0 failures) - structure.sql에서 3개 컬럼 제거 확인
[P1-1] QT 세션 edit/update + 세션 스위처 + 빈 상태
## 목표 3가지 QT 세션 관련 기능을 구현합니다. ### 작업 1: QT 세션 수정/편집 (edit/update) 현재 `config/routes.rb`에서 sessions는 `only: [:index, :new, :create, :show]`만 있습니다. 1. **라우트 수정**: `config/routes.rb`에서 sessions에 `:edit, :update` 추가 2. **컨트롤러**: `app/controllers/qt/sessions_controller.rb`에 edit, update 액션 추가 - `edit`: set_session으로 세션 로드, @themes = QtTheme.active - `update`: session_params로 업데이트, creator만 수정 가능 - 권한 체크: `@session.creator_id != current_user.id` → redirect with alert 3. **뷰**: `app/views/qt/sessions/new.html.erb`의 폼을 `_form.html.erb` 파셜로 추출 - new.html.erb와 edit.html.erb 모두 _form 사용 - edit.html.erb 제목: "플랜 수정" 4. **show 페이지**: creator에게만 "수정" 버튼 표시 (shared/_button 파셜 사용) 5. **테스트**: `test/controllers/qt/sessions_controller_test.rb`에 추가 - test_edit_session, test_update_session_valid - test_update_non_creator_redirects (권한 체크) - test_update_invalid_params ### 작업 2: QT 세션 스위처 UI QT today 페이지(qt_controller.rb의 today 액션) 상단에 현재 참여 중인 세션 목록 드롭다운 추가. 1. 먼저 `app/controllers/qt_controller.rb`를 읽어서 today 액션과 뷰 위치 확인 2. today 뷰 상단에 세션 스위처 드롭다운 추가: - `current_user.qt_sessions.active.includes(:qt_theme)` 목록 - 현재 세션 표시 (user_setting.current_session_id) - 세션 선택 시 `POST /qt/sessions/:id/select`로 전환 후 리다이렉트 3. Stimulus 컨트롤러로 드롭다운 토글 (기존 dropdown controller가 있으면 재사용) ### 작업 3: QT 빈 상태 안내 참여 세션이 0개인 사용자가 /qt/today 접속 시 안내 화면. 1. today 뷰에서 `@session.nil?` 체크 2. shared/_empty_state 파셜 활용: ```erb <%= render "shared/empty_state", title: "참여 중인 플랜이 없습니다", description: "테마를 둘러보고 묵상 플랜을 시작하세요", action_text: "테마 둘러보기", action_path: qt_themes_path %> ``` 3. 참고: qt_themes_path는 theme-dev가 생성할 예정 → 임시로 qt_sessions_path 사용 가능 ## 파일 범위 (이 에이전트만 수정) - app/controllers/qt/sessions_controller.rb - app/controllers/qt_controller.rb (today 뷰에 스위처/빈상태 추가) - app/views/qt/sessions/ (new, edit, show, _form, _session_card) - app/views/qt/ (today 관련 뷰) - config/routes.rb (sessions only 수정) - test/controllers/qt/sessions_controller_test.rb ## 수정 금지 파일 - app/models/ (theme-dev 영역) - app/controllers/qt/themes_controller.rb (theme-dev 영역) - db/migrate/ (schema-dev 영역) ## 완료 기준 - edit/update 동작 + 권한 체크 - 세션 스위처 드롭다운 동작 - 빈 상태 안내 표시 - 전체 테스트 통과
[P1-2] QT 테마 브라우즈 + 상세 + 구독(플랜 시작)
## 목표 일반 사용자용 QT 테마 브라우즈 페이지와 테마 상세/구독 기능 구현 ### 작업 1: QT 테마 브라우즈 페이지 (/qt/themes) 1. **라우트**: `config/routes.rb`의 qt 네임스페이스에 추가 ```ruby namespace :qt do resources :themes, only: [:index, :show] do member do post :subscribe end end # 기존 sessions... end ``` 2. **컨트롤러**: `app/controllers/qt/themes_controller.rb` 생성 ```ruby class Qt::ThemesController < ApplicationController def index @themes = QtTheme.active.includes(:qt_contents).order(:created_at) end def show @theme = QtTheme.find(params[:id]) @contents = @theme.qt_contents.order(:day_number) @existing_session = current_user.qt_sessions.active.find_by(qt_theme: @theme) end def subscribe @theme = QtTheme.find(params[:id]) # 중복 체크 if current_user.qt_sessions.active.exists?(qt_theme: @theme) redirect_to qt_theme_path(@theme), alert: "이미 이 테마로 진행 중인 플랜이 있습니다." return end session = QtSession.create!( qt_theme: @theme, creator: current_user, title: @theme.title, start_date: Date.current, end_date: Date.current + (@theme.total_day - 1).days, total_days: @theme.total_day, status: :active ) session.qt_participants.create!(user: current_user, role: :creator) ensure_user_setting current_user.user_setting.update!(current_session_id: session.id) redirect_to qt_session_path(session), notice: "#{@theme.title} 플랜을 시작했습니다!" end private def ensure_user_setting current_user.create_user_setting! unless current_user.user_setting end end ``` 3. **뷰: index.html.erb** - 테마 카드 그리드 - shared/_card 파셜이 있으면 활용, 없으면 Tailwind 카드 직접 구현 - 각 카드: 제목, 설명(truncate 50), 총 일수, 성경 범위(bible_books) - 카드 클릭 → show 페이지 - 디자인 시스템의 시멘틱 토큰 사용 (bg-surface-default, text-text-primary 등) 4. **뷰: show.html.erb** - 테마 상세 - 테마 정보: 제목, 설명, 총 일수, 성경 범위 - 콘텐츠 목록: day_number, theme_title, bible_passage (접힌 아코디언 형태) - "이 테마로 플랜 시작" 버튼 (shared/_button 파셜, variant: :primary) - 이미 진행 중이면 "이미 진행 중인 플랜이 있습니다" 안내 + 해당 세션 링크 5. **테스트**: `test/controllers/qt/themes_controller_test.rb` 생성 - test_index_shows_active_themes - test_show_displays_theme_details - test_subscribe_creates_session_and_participant - test_subscribe_prevents_duplicate - test_unauthenticated_redirects ## 파일 범위 (이 에이전트만 수정) - app/controllers/qt/themes_controller.rb (신규 생성) - app/views/qt/themes/ (index.html.erb, show.html.erb 신규 생성) - config/routes.rb (qt 네임스페이스에 themes 추가만) - test/controllers/qt/themes_controller_test.rb (신규 생성) ## 수정 금지 파일 - app/controllers/qt/sessions_controller.rb (session-dev 영역) - app/controllers/qt_controller.rb (session-dev 영역) - db/migrate/ (schema-dev 영역) - app/models/ (수정 필요 없음, 기존 모델 사용) ## 참고 패턴 - sessions_controller.rb의 create 액션 참고 (세션 생성 로직) - shared/_button 파셜: `render "shared/button", text: "...", variant: :primary, tag: :a, href: ...` - shared/_empty_state 파셜: 빈 데이터 표시 - 디자인 시스템: bg-surface-default, text-text-primary, border-border-default 등 시멘틱 토큰 ## 완료 기준 - /qt/themes에서 활성 테마 카드 목록 표시 - /qt/themes/:id에서 테마 상세 + 콘텐츠 목록 - "플랜 시작" 시 세션+참여자 자동 생성 - 중복 구독 방지 - 전체 테스트 통과