Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Commit b444edb

Browse files
authored
Merge pull request #108 from ASAP-Lettering/ASAP-324
ASAP-324 feat: 카카오 웹훅 end point 추가
2 parents 2e9b36d + 9c12eb7 commit b444edb

89 files changed

Lines changed: 586 additions & 125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.asap.application.letter.port.`in`
2+
3+
import com.asap.domain.letter.entity.LetterLogType
4+
5+
interface LetterLogUsecase {
6+
7+
fun log(request: LogRequest)
8+
9+
data class LogRequest(
10+
val letterCode: String,
11+
val logType: LetterLogType,
12+
val logContent: String,
13+
)
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.asap.application.letter.port.out
2+
3+
import com.asap.domain.letter.entity.LetterLog
4+
5+
interface LetterLogManagementPort {
6+
fun save(log: LetterLog): LetterLog
7+
8+
fun findAll(): List<LetterLog>
9+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.asap.application.letter.service
2+
3+
import com.asap.application.letter.port.`in`.LetterLogUsecase
4+
import com.asap.application.letter.port.out.LetterLogManagementPort
5+
import com.asap.application.letter.port.out.SendLetterManagementPort
6+
import com.asap.domain.letter.entity.LetterLog
7+
import org.springframework.stereotype.Service
8+
import org.springframework.transaction.annotation.Transactional
9+
10+
@Service
11+
@Transactional
12+
class LetterLogService(
13+
private val sendLetterManagementPort: SendLetterManagementPort,
14+
private val letterLogManagementPort: LetterLogManagementPort
15+
) : LetterLogUsecase {
16+
override fun log(request: LetterLogUsecase.LogRequest) {
17+
val letterCode = request.letterCode
18+
val letter = sendLetterManagementPort.getLetterByCodeNotNull(letterCode)
19+
20+
LetterLog.create(
21+
targetLetterId = letter.id,
22+
logType = request.logType,
23+
content = request.logContent
24+
).apply {
25+
letterLogManagementPort.save(this)
26+
}
27+
}
28+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.asap.application.letter.service
2+
3+
import com.asap.application.letter.port.`in`.LetterLogUsecase
4+
import com.asap.application.letter.port.out.LetterLogManagementPort
5+
import com.asap.application.letter.port.out.SendLetterManagementPort
6+
import com.asap.domain.LetterFixture
7+
import com.asap.domain.letter.entity.LetterLogType
8+
import io.kotest.core.spec.style.BehaviorSpec
9+
import io.mockk.every
10+
import io.mockk.mockk
11+
import io.mockk.verify
12+
13+
class LetterLogServiceTest : BehaviorSpec({
14+
15+
val letterLogManagementPort = mockk<LetterLogManagementPort>(relaxed = true)
16+
val mockSendLetterManagementPort = mockk<SendLetterManagementPort>(relaxed = true)
17+
18+
val letterLogService = LetterLogService(
19+
letterLogManagementPort = letterLogManagementPort,
20+
sendLetterManagementPort = mockSendLetterManagementPort,
21+
)
22+
23+
given("편지 관련 로그 서비스 테스트") {
24+
val request = LetterLogUsecase.LogRequest(
25+
letterCode = "letterCode",
26+
logType = LetterLogType.SHARE,
27+
logContent = "logContent",
28+
)
29+
30+
val mockSendLetter = LetterFixture.generateSendLetter()
31+
32+
every { mockSendLetterManagementPort.getLetterByCodeNotNull(any()) } returns mockSendLetter
33+
34+
`when`("편지를 저장 요청하면") {
35+
letterLogService.log(request)
36+
then("편지를 저장한다") {
37+
verify { letterLogManagementPort.save(any()) }
38+
}
39+
}
40+
}
41+
}) {
42+
}

Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/auth/api/AuthApi.kt renamed to Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/auth/api/AuthApi.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package com.asap.bootstrap.auth.api
1+
package com.asap.bootstrap.web.auth.api
22

3-
import com.asap.bootstrap.auth.dto.ReissueRequest
4-
import com.asap.bootstrap.auth.dto.ReissueResponse
5-
import com.asap.bootstrap.auth.dto.SocialLoginRequest
6-
import com.asap.bootstrap.auth.dto.SocialLoginResponse
73
import com.asap.bootstrap.common.exception.ExceptionResponse
4+
import com.asap.bootstrap.web.auth.dto.ReissueRequest
5+
import com.asap.bootstrap.web.auth.dto.ReissueResponse
6+
import com.asap.bootstrap.web.auth.dto.SocialLoginRequest
7+
import com.asap.bootstrap.web.auth.dto.SocialLoginResponse
88
import io.swagger.v3.oas.annotations.Operation
99
import io.swagger.v3.oas.annotations.media.Content
1010
import io.swagger.v3.oas.annotations.media.Schema

Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/auth/controller/AuthController.kt renamed to Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/auth/controller/AuthController.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
package com.asap.bootstrap.auth.controller
1+
package com.asap.bootstrap.web.auth.controller
22

33
import com.asap.application.user.port.`in`.ReissueTokenUsecase
44
import com.asap.application.user.port.`in`.SocialLoginUsecase
5-
import com.asap.bootstrap.auth.api.AuthApi
6-
import com.asap.bootstrap.auth.dto.ReissueRequest
7-
import com.asap.bootstrap.auth.dto.ReissueResponse
8-
import com.asap.bootstrap.auth.dto.SocialLoginRequest
9-
import com.asap.bootstrap.auth.dto.SocialLoginResponse
5+
import com.asap.bootstrap.web.auth.api.AuthApi
6+
import com.asap.bootstrap.web.auth.dto.ReissueRequest
7+
import com.asap.bootstrap.web.auth.dto.ReissueResponse
8+
import com.asap.bootstrap.web.auth.dto.SocialLoginRequest
9+
import com.asap.bootstrap.web.auth.dto.SocialLoginResponse
1010
import org.springframework.http.HttpStatus
1111
import org.springframework.http.ResponseEntity
1212
import org.springframework.web.bind.annotation.RestController

Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/auth/dto/ReissueRequest.kt renamed to Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/auth/dto/ReissueRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.asap.bootstrap.auth.dto
1+
package com.asap.bootstrap.web.auth.dto
22

33
data class ReissueRequest(
44
val refreshToken: String

Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/auth/dto/ReissueResponse.kt renamed to Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/auth/dto/ReissueResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.asap.bootstrap.auth.dto
1+
package com.asap.bootstrap.web.auth.dto
22

33
data class ReissueResponse(
44
val accessToken: String,

Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/auth/dto/SocialLoginRequest.kt renamed to Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/auth/dto/SocialLoginRequest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.asap.bootstrap.auth.dto
1+
package com.asap.bootstrap.web.auth.dto
22

33
import io.swagger.v3.oas.annotations.media.Schema
44

Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/auth/dto/SocialLoginResponse.kt renamed to Bootstrap-Module/src/main/kotlin/com/asap/bootstrap/web/auth/dto/SocialLoginResponse.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.asap.bootstrap.auth.dto
1+
package com.asap.bootstrap.web.auth.dto
22

33
import io.swagger.v3.oas.annotations.media.Schema
44

0 commit comments

Comments
 (0)