Skip to content

[Feat] 세모피드 도메인 구현#98

Merged
howooyeon merged 4 commits into
developfrom
feat/#91-semofeed
May 23, 2026
Merged

[Feat] 세모피드 도메인 구현#98
howooyeon merged 4 commits into
developfrom
feat/#91-semofeed

Conversation

@howooyeon

@howooyeon howooyeon commented May 23, 2026

Copy link
Copy Markdown
Contributor

🧾 요약

  • 세모피드(SemoFeed) 도메인 신규 구현 — 트래킹 사진으로 생성된 이미지 저장 및 공개 피드 조회

🔗 이슈

✨ 변경 내용

  • SemoFeed 엔티티 및 마이그레이션(V14) 추가
  • 세모피드 CRUD API 구현 (저장, 내 목록 조회, 공개 목록 조회, 공개/비공개 토글, 삭제)
  • Swagger 문서화 (SemoFeedControllerDocs)
  • SuccessStatus, ErrorStatus에 세모피드 관련 코드 추가

✅ 확인

  • 빌드 OK
  • 테스트 OK

Summary by CodeRabbit

  • New Features
    • SemoFeed: create posts from image URLs, browse public feeds with pagination, view your posts, toggle public/private, and delete posts.
  • Bug Fixes
    • Improved error handling for missing tracking photos and clearer not-found/forbidden responses for SemoFeed operations.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 23, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c5c2053e-3a2f-450f-8a51-c52cbfba9c7f

📥 Commits

Reviewing files that changed from the base of the PR and between 6f4bdaf and 90cb499.

📒 Files selected for processing (1)
  • src/main/java/com/semosan/api/domain/semofeed/controller/SemoFeedController.java

📝 Walkthrough

Walkthrough

This PR implements a new SemoFeed feature: DB migration, JPA entity, repository, service, controller with Swagger docs, DTOs, and status code additions for SemoFeed and tracking-photo not-found.

Changes

SemoFeed API Feature

Layer / File(s) Summary
Error and Success Status Codes
src/main/java/com/semosan/api/common/status/ErrorStatus.java, src/main/java/com/semosan/api/common/status/SuccessStatus.java
Adds SEMOFEED_NOT_FOUND (404) and SEMOFEED_FORBIDDEN (403) error statuses, five SuccessStatus entries for SemoFeed operations (create/list/my-list/toggle-public/delete), and TRACKING_PHOTO_NOT_FOUND (404).
Database Schema
src/main/resources/db/migration/V14__create_semo_feeds.sql
Creates semo_feeds table with user_id FK, image_url, is_public boolean default false, timestamps, and indexes including a partial index for public rows.
Entity Model
src/main/java/com/semosan/api/domain/semofeed/entity/SemoFeed.java
Defines SemoFeed JPA entity with lazy User relation, imageUrl, isPublic flag, create(user,imageUrl) factory, togglePublic(), and isOwnedBy(userId).
Repository Layer
src/main/java/com/semosan/api/domain/semofeed/repository/SemoFeedRepository.java
Spring Data JPA repository with findPublic(Pageable) for paginated public feeds and findByUserId(Long) for user feeds, both ordered by createdAt desc.
Service Layer
src/main/java/com/semosan/api/domain/semofeed/service/SemoFeedService.java
Provides create, listPublic, listMine, togglePublic, and delete; central findOwned enforces existence and ownership, throwing SEMOFEED_NOT_FOUND or SEMOFEED_FORBIDDEN.
API Documentation
src/main/java/com/semosan/api/domain/semofeed/controller/docs/SemoFeedControllerDocs.java
Adds Swagger/OpenAPI interface documenting five endpoints with request/response schemas, status codes, and authentication parameter usage.
DTO and REST Controller
src/main/java/com/semosan/api/domain/semofeed/dto/SemoFeedResponse.java, src/main/java/com/semosan/api/domain/semofeed/controller/SemoFeedController.java
Adds SemoFeedResponse record and controller endpoints (POST create, GET public list with pageable, GET /me, PATCH toggle public, DELETE) returning results wrapped in ApiResponse/PageResponse and capping page size to 100.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I stitched a SemoFeed with pixels bright,
A toggle for public under moonlight,
Create, list, and delete with care,
Owners can guard what they share,
Hopping joy for each small bite of light.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title '[Feat] 세모피드 도메인 구현' clearly describes the main change: implementing the SemoFeed domain with CRUD API endpoints, database migration, and related status codes.
Linked Issues check ✅ Passed The PR fully implements the SemoFeed domain feature from issue #91, including entity creation, database migration, CRUD API endpoints, service layer, controller with documentation, and status code additions.
Out of Scope Changes check ✅ Passed All changes are scoped to SemoFeed domain implementation: entity, repository, service, controller, DTOs, migrations, and status codes. No unrelated changes detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#91-semofeed

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

@howooyeon howooyeon changed the title feat: 세모피드 도메인 구현 [Feat] 세모피드 도메인 구현 May 23, 2026
@howooyeon howooyeon self-assigned this May 23, 2026
@howooyeon howooyeon added the enhancement New feature or request label May 23, 2026

@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: 1

🧹 Nitpick comments (1)
src/main/resources/db/migration/V14__create_semo_feeds.sql (1)

14-16: ⚡ Quick win

Align the public-feed index with the actual query sort.

Line 14–16 indexes only is_public; findPublic also orders by created_at DESC (src/main/java/com/semosan/api/domain/semofeed/repository/SemoFeedRepository.java, Line 13–14). This will still force sort work as data grows.

📌 Suggested migration adjustment
-CREATE INDEX IF NOT EXISTS idx_semo_feeds_public
-    ON semo_feeds (is_public)
-    WHERE is_public = true;
+CREATE INDEX IF NOT EXISTS idx_semo_feeds_public_created_at_desc
+    ON semo_feeds (created_at DESC)
+    WHERE is_public = true;
🤖 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/main/resources/db/migration/V14__create_semo_feeds.sql` around lines 14 -
16, The current migration creates idx_semo_feeds_public only on is_public which
doesn't support the ORDER BY used by findPublic; update the migration so the
index covers both is_public and created_at (preserving the WHERE is_public =
true predicate) so the query can use an index for the filtering and ordering;
reference the index name idx_semo_feeds_public, table semo_feeds and the
repository method findPublic to find where the change is needed and alter the
CREATE INDEX statement accordingly.
🤖 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/main/java/com/semosan/api/domain/semofeed/controller/SemoFeedController.java`:
- Around line 37-43: The listPublic controller currently relies on
`@PageableDefault`(size = 100) which is only a fallback; enforce the 100-item cap
by checking Pageable.getPageSize() inside listPublic and if it exceeds 100
replace the pageable with a new PageRequest (e.g.,
PageRequest.of(pageable.getPageNumber(), 100, pageable.getSort())) before
calling semoFeedService.listPublic(pageable); update the code path that builds
the PageResponse to use this capped pageable so clients cannot request size >
100.

---

Nitpick comments:
In `@src/main/resources/db/migration/V14__create_semo_feeds.sql`:
- Around line 14-16: The current migration creates idx_semo_feeds_public only on
is_public which doesn't support the ORDER BY used by findPublic; update the
migration so the index covers both is_public and created_at (preserving the
WHERE is_public = true predicate) so the query can use an index for the
filtering and ordering; reference the index name idx_semo_feeds_public, table
semo_feeds and the repository method findPublic to find where the change is
needed and alter the CREATE INDEX statement accordingly.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ce1a86a2-1fe9-4486-abd4-207795b0197e

📥 Commits

Reviewing files that changed from the base of the PR and between 48cfa7b and 6f4bdaf.

📒 Files selected for processing (9)
  • src/main/java/com/semosan/api/common/status/ErrorStatus.java
  • src/main/java/com/semosan/api/common/status/SuccessStatus.java
  • src/main/java/com/semosan/api/domain/semofeed/controller/SemoFeedController.java
  • src/main/java/com/semosan/api/domain/semofeed/controller/docs/SemoFeedControllerDocs.java
  • src/main/java/com/semosan/api/domain/semofeed/dto/SemoFeedResponse.java
  • src/main/java/com/semosan/api/domain/semofeed/entity/SemoFeed.java
  • src/main/java/com/semosan/api/domain/semofeed/repository/SemoFeedRepository.java
  • src/main/java/com/semosan/api/domain/semofeed/service/SemoFeedService.java
  • src/main/resources/db/migration/V14__create_semo_feeds.sql

@howooyeon
howooyeon merged commit 315ebde into develop May 23, 2026
1 check was pending
@howooyeon
howooyeon deleted the feat/#91-semofeed branch May 29, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] 세모피드 구현

1 participant