Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/highlights #21

Closed
wants to merge 10 commits into from
Closed

Feature/highlights #21

wants to merge 10 commits into from

Conversation

dida0423
Copy link
Collaborator

image
  • [POST] /highlight/new/{story_id} - 새로운 Highlight (Parameters: Highlight name, Cover image) 생성 및 Story 저장
    • Cover image 없을 시 스토리 이미지-> 커버 이미지 (스토리 여러개 있는 상태에서 커버 Story 삭제할 경우 exception handling 필요할 듯) (TODO)
    • Story 없이 Highlight 생성 불가
  • [PATCH] /highlight/add/{highlight_id}/{story_id} - 이미 존재하는 highlight에 story ID로 story 추가
  • [GET] /highlights/{user_id} - 특정 유저의 모든 Highlight 반환
  • [GET] /highlight/{highlight_id} - 특정 Highlight 반환
  • [DELETE] /highlight/{highlight_id} - 특정 Highlight 삭제
  • [DELETE] /highlightstory/{highlight_id}/{story_id} 특정 Highlight에서 Story 삭제
    • 모든 Story 삭제 시 Highlight 삭제 처리 필요 (TODO)

if type(highlight_create_request.cover_image) == UploadFile:
cover_image = await medium_service.create_medium(highlight_create_request.cover_image)
else:
story = await story_service.get_story(story_id=story_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
story = await story_service.get_story(story_id=story_id)
story = await story_service.get_story(story_id=story_id, current_user=user)

Copy link
Collaborator

@cloNoey cloNoey left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

  1. story_service.get_story(~) 에 current_user 변수 추가하도록 수정해주시면 될 것 같습니다.
  2. Add To Highlight에서 이미 하이라이트에 등록한 스토리의 경우, 해당 하이라이트에 다시 등록되지 못하도록 제한하는 예외처리도 추가해주시면 좋을 것 같아요! (프론트에서 해결할 수도 있을 것 같지만, 복잡하지 않다면 예외처리 해주시면 더 좋을 듯 합니다 :) )

Copy link
Collaborator

@MunJaeyoung MunJaeyoung left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

Comment on lines +141 to +142
if story.user_id != user.user_id or highlight.user_id != user.user_id:
raise StoryPermissionError()
Copy link
Collaborator

Choose a reason for hiding this comment

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

스토리를 삭제할 권한이 없다고 나와서 커스텀 에러 새로 정의해도 좋을 것 같아요. StoryPermissionError로 에러 처리되어 있는 부분에서 모두 같은 에러 메세지가 나와요.

dida0423 and others added 2 commits January 22, 2025 00:19
- Deleting story removes story from highlight
- Removing story with cover image from highlight selects new image from highlight
- Removing last story from highlight deletes highlight
- Highlight of the same name as the user's existing highlights cannot be created
- Same story cannot be added to the same story twice
@dida0423 dida0423 closed this Jan 24, 2025
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.

3 participants