Skip to content

#138 - 쪽지 답장을 사용한적이 있는지 확인하는 API를 구현합니다. #163

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

Merged
merged 2 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ description: Request new Feature
title: "[feature]: "
labels: ["🌱기능🌱"]
body:
- type: input
id: parentKey
attributes:
label: Epic/Story Ticket Number
description: WS-75 - 회원가입/로그인 | WS-79 - 투표 홈 | WS-88 - 쪽지 홈 | WS-104 - 알림 | WS-131 - 투표 결과 | WS-132 - 전체 | WS-134 - 쪽지 보관함
placeholder: WS-132
validations:
required: true
# - type: input
# id: parentKey
# attributes:
# label: Epic/Story Ticket Number
# description: WS-75 - 회원가입/로그인 | WS-79 - 투표 홈 | WS-88 - 쪽지 홈 | WS-104 - 알림 | WS-131 - 투표 결과 | WS-132 - 전체 | WS-134 - 쪽지 보관함
# placeholder: WS-132
# validations:
# required: true
- type: markdown
attributes:
value: |
Expand All @@ -22,15 +22,15 @@ body:
description: 어떤 기능을 추가할건가요?
validations:
required: true
- type: textarea
id: todo
attributes:
label: Todo
description: 작업사항을 나누어 작성해주세요!
value: |
- [ ] todo1
- type: textarea
id: etc
attributes:
label: 기타사항
description: 추가로 기록이 필요한 경우 작성해주세요!
# - type: textarea
# id: todo
# attributes:
# label: Todo
# description: 작업사항을 나누어 작성해주세요!
# value: |
# - [ ] todo1
# - type: textarea
# id: etc
# attributes:
# label: 기타사항
# description: 추가로 기록이 필요한 경우 작성해주세요!
8 changes: 1 addition & 7 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@
## 2. 📄 구현한 내용 또는 수정한 내용
<!-- 구현 내용을 리뷰어가 확인할 수 있도록 스크린샷 혹은 gif 등을 활용해 자유롭게 보여주세요. -->

## 3. 🙌 추가적으로 알리고 싶은 내용

## 4. 🙄 TODO / 고민하고 있는 것들

## 5. ✅ 배포 Checklist
## 3. ✅ 배포 Checklist
<!-- 확인이 된 부분에 모두 [x]로 변경하여 확인했다는 사실을 알려주세요. -->

- [ ] 본인을 Assign 해주세요.
- [ ] 본인을 제외한 백엔드 개발자를 리뷰어로 지정해주세요.
- [ ] 변경된 DB 업데이트 해주세요. (꼭 해주세요 배포 안돼요!!!)
23 changes: 23 additions & 0 deletions app/src/main/kotlin/com/wespot/user/UsedAnswerMessageController.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.wespot.user

import com.wespot.user.port.`in`.UsedAnswerMessageUseCase
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController


@RestController
@RequestMapping("/api/v2/messages/answer/first")
Copy link
Preview

Copilot AI May 6, 2025

Choose a reason for hiding this comment

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

[nitpick] The endpoint path '/api/v2/messages/answer/first' does not clearly indicate that it checks for the usage of the answer message feature. Consider renaming the path to something more descriptive, such as '/api/v2/messages/answer/feature-status', to better convey its purpose.

Suggested change
@RequestMapping("/api/v2/messages/answer/first")
@RequestMapping("/api/v2/messages/answer/feature-status")

Copilot uses AI. Check for mistakes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No Thanks

class UsedAnswerMessageController(
private val usedAnswerMessageUseCase: UsedAnswerMessageUseCase,
) {

@GetMapping
fun isUsedAnswerMessageFeature(): ResponseEntity<Boolean> {
val response = usedAnswerMessageUseCase.isUsedAnswerMessageFeature()

return ResponseEntity.ok(response)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wespot.user.port.`in`

interface UsedAnswerMessageUseCase {

fun isUsedAnswerMessageFeature(): Boolean

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ interface UsedAnswerMessagePort {

fun existsByUserId(userId: Long): Boolean

fun findByUserId(userId: Long): UsedAnswerMessage?

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.wespot.user.service

import com.wespot.auth.service.SecurityUtils
import com.wespot.user.port.`in`.UsedAnswerMessageUseCase
import com.wespot.user.port.out.UsedAnswerMessagePort
import com.wespot.user.port.out.UserPort
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

@Service
class UsedAnswerMessageService(
private val userPort: UserPort,
private val usedAnswerMessagePort: UsedAnswerMessagePort
) : UsedAnswerMessageUseCase {

@Transactional(readOnly = true)
override fun isUsedAnswerMessageFeature(): Boolean {
val loginUser = SecurityUtils.getLoginUser(userPort = userPort)

return usedAnswerMessagePort.findByUserId(userId = loginUser.id)
?.isUsedAnswerMessageFeature
?: false
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ class UsedAnswerMessagePersistenceAdapter(
return usedAnswerMessageJpaRepository.existsByUserId(userId = userId)
}

override fun findByUserId(userId: Long): UsedAnswerMessage? {
return usedAnswerMessageJpaRepository.findByUserId(userId = userId)
?.let { UsedAnswerMessageMapper.mapToDomainEntity(it) }
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ interface UsedAnswerMessageJpaRepository : JpaRepository<UsedAnswerMessageJpaEnt

fun existsByUserId(userId: Long): Boolean

fun findByUserId(userId: Long): UsedAnswerMessageJpaEntity?

}