커뮤니티 피드 — CommunityPostsController CRUD + post_type 필터 + 핀 고정 + 페이지네이션 + 테스트
ID: ade1575c-285e-416f-a4f9-4c9425434b38
## 목표
CommunityPosts CRUD. post_type별 필터(general/question/launch/share). 핀 게시글 상단 고정. 페이지네이션(Pagy 또는 간단 구현).
## 현재 상태
- CommunityPostsController 스텁 (7개 CRUD 액션)
- 라우트: `resources :community_posts do resources :community_comments, only: [:create, :destroy]; post :like, on: :member end`
- CommunityPost 모델: belongs_to :user, has_many :community_comments. post_type(default: "general"), title, content(not null), likes_count, comments_count, pinned. scope :pinned
- 공용 Partial: _button, _card, _input
## 구현 사항
### 1. CommunityPostsController
- index: post_type 필터(?type=general/question/launch/share), 핀 상단 고정, 최신순 정렬
- show: 게시글 + 댓글 목록 (댓글은 다음 티켓에서 구현 — 지금은 빈 영역)
- new/create: Current.user.community_posts.build, post_type 선택
- edit/update: 소유자만
- destroy: 소유자만
- like: likes_count 증가 (간단 구현)
- strong params: title, content, post_type
### 2. 뷰
- **index**: post_type 필터 탭 (전체/일반/질문/출시/공유), 핀 게시글 상단, 게시글 카드 리스트, "글쓰기" 버튼
- **show**: 게시글 상세, 좋아요 버튼, 수정/삭제(소유자), 댓글 영역(placeholder)
- **new/edit**: 폼 (_form partial — title, content textarea, post_type select)
- 다크 테마, 기존 Partial
### 3. 페이지네이션
- Pagy gem이 있으면 사용, 없으면 간단한 offset/limit 또는 Kaminari 없이 수동 구현
- 기본 20개씩
### 4. 핀 게시글
- pinned: true인 게시글을 상단에 고정 표시
- 일반 사용자는 pin 불가 (admin만 — 지금은 구현 안 해도 됨)
### ⚠️ 주의
- community_posts/ 범위만 (developer-2는 showcase_services/ 작업 중)
- CommunityComment는 다음 티켓 — 지금은 댓글 영역 placeholder만
- 소유자 접근제어 (edit/update/destroy)
- 한국어 Flash
### 테스트
- CRUD 전체, 인증 필요, 소유자 접근제어, post_type 필터, like 동작
### 완료 기준
- 게시글 CRUD + post_type 필터 + 핀 고정
- bin/rails test 전체 통과
첨부 이미지
이미지 추가 (Ctrl+V로 붙여넣기 또는 클릭)
JPEG, PNG, GIF, WebP / 최대 10MB
활동 로그
-
Ddeveloper-1 상태 변경: 할 일 → 리뷰
2026년 03월 26일 12:10:45