-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: 분실물 API 2차 기능 추가(습득물, 학생 작성) #1224
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
분실물 신고 기능과 몇몇 파일이 겹쳐서 추후 병합이 필요할 것 같긴 하네요 ㅠ
@PostMapping("/lost-item") | ||
public ResponseEntity<LostItemArticleResponse> createLostItemArticle( | ||
@Auth(permit = {COUNCIL}) Integer councilId, | ||
@Auth(permit = {STUDENT, COUNCIL}) Integer studentId, | ||
@RequestBody @Valid LostItemArticlesRequest lostItemArticlesRequest | ||
) { | ||
LostItemArticleResponse response = articleService.createLostItemArticle(councilId, lostItemArticlesRequest); | ||
LostItemArticleResponse response = articleService.createLostItemArticle(studentId, lostItemArticlesRequest); | ||
return ResponseEntity.status(HttpStatus.CREATED).body(response); | ||
} | ||
|
||
@DeleteMapping("/lost-item/{id}") | ||
public ResponseEntity<Void> deleteLostItemArticle( | ||
@PathVariable("id") Integer articleId, | ||
@Auth(permit = {COUNCIL}) Integer councilId | ||
@Auth(permit = {STUDENT, COUNCIL}) Integer userId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C
studentId
or userId
한 가지로 통일하면 좋을 것 같아요
@NotNull(message = "게시글 타입은 필수로 입력해야 합니다.") | ||
@Schema(description = "게시글 타입", example = "LOST", requiredMode = NOT_REQUIRED) | ||
String type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C
requireMode = REQUIRED
이어야 하지 않나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type 필드가 없는 기존 버전의 하위호환성을 위해 null 처리를 추가해서, 해당 필드의 requireMode를 NOT_REQUIRED로 지정했습니다!
@@ -42,6 +44,13 @@ default Article getById(Integer articleId) { | |||
return found; | |||
} | |||
|
|||
@Query( | |||
value = "SELECT a.* FROM new_articles a JOIN lost_item_articles la ON a.id = la.article_id WHERE la.type = :type", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A
page 쿼리 시 네이티브 쿼리를 사용하는 이유가 있나요? 몰라서 여쭤봅니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Page 쿼리 시 반드시 사용해야 할 이유는 없습니다!
전 두 테이블의 조인을 위해 네이티브 쿼리를 썼어요.
분실물/습득물 필터링에서는 LostItemArticle
의 type
필드를 통해 필터링된 Article
을 받아야 하기 때문입니다.
또, naticeQuery
속성은 제 쿼리에는 필수가 아니었지만,
Page는 필터링과 함께 하는 경우가 많고, 필터링을 위한 쿼리에는 MATCH
와 같이 특정 DB에서 사용하는 단어가 포함되는 경우가 많아서 Page에 네이티브 쿼리가 자주 보이는 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다!
@PathVariable("id") Integer articleId, | ||
@Auth(permit = {STUDENT, COUNCIL}, anonymous = true) Integer userId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
토큰을 받는다면 로그인 하지 않은 사용자는 게시글을 볼 수 없지 않나요?
🔥 연관 이슈
🚀 작업 내용
💬 리뷰 중점사항
참고) 분실물 API 2차 명세