Skip to content

Commit 114e3ce

Browse files
authored
Merge pull request #48 from EntryDSM/feature/47-swagger-set
누락된 Swagger 적용
2 parents a6b0fd3 + 5b74537 commit 114e3ce

12 files changed

Lines changed: 724 additions & 28 deletions

File tree

casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/admin/presentation/AdminController.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import hs.kr.entrydsm.application.domain.admin.presentation.dto.response.CreateA
77
import hs.kr.entrydsm.application.domain.admin.presentation.dto.response.CreateEducationalStatusResponse
88
import hs.kr.entrydsm.application.domain.admin.presentation.dto.response.CreatePrototypeResponse
99
import hs.kr.entrydsm.application.domain.admin.usecase.AdminUseCase
10+
import hs.kr.entrydsm.application.global.document.admin.AdminApiDocument
1011
import org.springframework.http.ResponseEntity
1112
import org.springframework.web.bind.annotation.PostMapping
1213
import org.springframework.web.bind.annotation.RequestBody
@@ -17,9 +18,9 @@ import org.springframework.web.bind.annotation.RestController
1718
@RequestMapping("/api/v1/admin")
1819
class AdminController(
1920
private val adminUseCase: AdminUseCase,
20-
) {
21+
) : AdminApiDocument {
2122
@PostMapping("/application-types")
22-
fun createApplicationType(
23+
override fun createApplicationType(
2324
@RequestBody request: CreateApplicationTypeRequest,
2425
): ResponseEntity<CreateApplicationTypeResponse> {
2526
val result = adminUseCase.createApplicationType(request.code, request.name)
@@ -37,7 +38,7 @@ class AdminController(
3738
}
3839

3940
@PostMapping("/educational-statuses")
40-
fun createEducationalStatus(
41+
override fun createEducationalStatus(
4142
@RequestBody request: CreateEducationalStatusRequest,
4243
): ResponseEntity<CreateEducationalStatusResponse> {
4344
val result = adminUseCase.createEducationalStatus(request.code, request.name)
@@ -55,7 +56,7 @@ class AdminController(
5556
}
5657

5758
@PostMapping("/prototypes")
58-
fun createPrototype(
59+
override fun createPrototype(
5960
@RequestBody request: CreatePrototypeRequest,
6061
): ResponseEntity<CreatePrototypeResponse> {
6162
val result =

casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/application/presentation/ApplicationQueryController.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import hs.kr.entrydsm.application.domain.application.presentation.dto.response.A
66
import hs.kr.entrydsm.application.domain.application.presentation.dto.response.CalculationHistoryResponse
77
import hs.kr.entrydsm.application.domain.application.presentation.dto.response.CalculationResponse
88
import hs.kr.entrydsm.application.domain.application.usecase.ApplicationQueryUseCase
9+
import hs.kr.entrydsm.application.global.document.application.ApplicationQueryApiDocument
910
import org.springframework.http.HttpStatus
1011
import org.springframework.http.ResponseEntity
1112
import org.springframework.web.bind.annotation.GetMapping
@@ -18,9 +19,9 @@ import org.springframework.web.bind.annotation.RestController
1819
@RequestMapping("/api/v1")
1920
class ApplicationQueryController(
2021
private val applicationQueryUseCase: ApplicationQueryUseCase,
21-
) {
22+
) : ApplicationQueryApiDocument {
2223
@GetMapping("/applications/{applicationId}")
23-
fun getApplication(
24+
override fun getApplication(
2425
@PathVariable applicationId: String?,
2526
): ResponseEntity<ApplicationDetailResponse> {
2627
return try {
@@ -46,7 +47,7 @@ class ApplicationQueryController(
4647
}
4748

4849
@GetMapping("/applications")
49-
fun getApplications(
50+
override fun getApplications(
5051
@RequestParam(required = false) applicationType: String?,
5152
@RequestParam(required = false) educationalStatus: String?,
5253
@RequestParam(defaultValue = "0") page: Int,
@@ -70,7 +71,7 @@ class ApplicationQueryController(
7071
}
7172

7273
@GetMapping("/users/{userId}/applications")
73-
fun getUserApplications(
74+
override fun getUserApplications(
7475
@PathVariable userId: String?,
7576
): ResponseEntity<ApplicationListResponse> {
7677
return try {
@@ -96,7 +97,7 @@ class ApplicationQueryController(
9697
}
9798

9899
@GetMapping("/applications/{applicationId}/scores")
99-
fun getApplicationScores(
100+
override fun getApplicationScores(
100101
@PathVariable applicationId: String?,
101102
): ResponseEntity<ApplicationScoresResponse> {
102103
return try {
@@ -122,7 +123,7 @@ class ApplicationQueryController(
122123
}
123124

124125
@GetMapping("/applications/{applicationId}/calculations")
125-
fun getCalculationResult(
126+
override fun getCalculationResult(
126127
@PathVariable applicationId: String?,
127128
): ResponseEntity<CalculationResponse> {
128129
return try {
@@ -148,7 +149,7 @@ class ApplicationQueryController(
148149
}
149150

150151
@GetMapping("/applications/{applicationId}/calculations/history")
151-
fun getCalculationHistory(
152+
override fun getCalculationHistory(
152153
@PathVariable applicationId: String?,
153154
): ResponseEntity<CalculationHistoryResponse> {
154155
return try {

casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/application/presentation/ApplicationSubmissionController.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package hs.kr.entrydsm.application.domain.application.presentation
33
import hs.kr.entrydsm.application.domain.application.presentation.dto.request.ApplicationSubmissionRequest
44
import hs.kr.entrydsm.application.domain.application.presentation.dto.response.ApplicationSubmissionResponse
55
import hs.kr.entrydsm.application.domain.application.usecase.CompleteApplicationUseCase
6+
import hs.kr.entrydsm.application.global.document.application.ApplicationSubmissionApiDocument
67
import org.springframework.http.HttpStatus
78
import org.springframework.http.ResponseEntity
89
import org.springframework.web.bind.annotation.PostMapping
@@ -15,9 +16,9 @@ import java.time.LocalDateTime
1516
@RequestMapping("/api/v1")
1617
class ApplicationSubmissionController(
1718
private val completeApplicationUseCase: CompleteApplicationUseCase,
18-
) {
19+
) : ApplicationSubmissionApiDocument {
1920
@PostMapping("/applications")
20-
fun submitApplication(
21+
override fun submitApplication(
2122
@RequestBody request: ApplicationSubmissionRequest?,
2223
): ResponseEntity<ApplicationSubmissionResponse> {
2324
return try {

casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/application/presentation/WebApplicationAdapter.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import hs.kr.entrydsm.application.domain.application.presentation.dto.response.P
55
import hs.kr.entrydsm.application.domain.application.presentation.dto.response.SupportedTypesResponse
66
import hs.kr.entrydsm.application.domain.application.presentation.dto.response.ValidationResponse
77
import hs.kr.entrydsm.application.domain.application.usecase.ApplicationUseCase
8+
import hs.kr.entrydsm.application.global.document.application.WebApplicationApiDocument
89
import hs.kr.entrydsm.domain.application.values.ApplicationTypeFilter
910
import org.springframework.http.ResponseEntity
1011
import org.springframework.web.bind.annotation.GetMapping
@@ -18,9 +19,9 @@ import org.springframework.web.bind.annotation.RestController
1819
@RequestMapping("/api/v1")
1920
class WebApplicationAdapter(
2021
private val applicationUseCase: ApplicationUseCase,
21-
) {
22+
) : WebApplicationApiDocument {
2223
@GetMapping("/prototypes")
23-
fun getPrototype(
24+
override fun getPrototype(
2425
@RequestParam applicationType: String,
2526
@RequestParam educationalStatus: String,
2627
@RequestParam(required = false) region: String?,
@@ -73,7 +74,7 @@ class WebApplicationAdapter(
7374
}
7475

7576
@GetMapping("/types")
76-
fun getSupportedTypes(): ResponseEntity<SupportedTypesResponse> {
77+
override fun getSupportedTypes(): ResponseEntity<SupportedTypesResponse> {
7778
val supportedTypes = applicationUseCase.getSupportedTypes()
7879

7980
val response =
@@ -102,7 +103,7 @@ class WebApplicationAdapter(
102103
}
103104

104105
@PostMapping("/validate")
105-
fun validateScoreData(
106+
override fun validateScoreData(
106107
@RequestBody request: ValidateScoreDataRequest,
107108
): ResponseEntity<ValidationResponse> {
108109
val filter =

casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/formula/presentation/FormulaSetController.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import hs.kr.entrydsm.application.domain.formula.presentation.dto.response.Formu
88
import hs.kr.entrydsm.application.domain.formula.presentation.dto.response.FormulaSetListResponse
99
import hs.kr.entrydsm.application.domain.formula.presentation.dto.response.FormulaSetResponse
1010
import hs.kr.entrydsm.application.domain.formula.usecase.FormulaSetUseCase
11+
import hs.kr.entrydsm.application.global.document.formula.FormulaSetApiDocument
1112
import org.springframework.http.HttpStatus
1213
import org.springframework.http.ResponseEntity
1314
import org.springframework.web.bind.annotation.DeleteMapping
@@ -24,9 +25,9 @@ import java.util.UUID
2425
@RequestMapping("/api/v1")
2526
class FormulaSetController(
2627
private val formulaSetUseCase: FormulaSetUseCase,
27-
) {
28+
) : FormulaSetApiDocument {
2829
@PostMapping("/formulas")
29-
fun createFormulaSet(
30+
override fun createFormulaSet(
3031
@RequestBody request: CreateFormulaSetRequest?,
3132
): ResponseEntity<FormulaSetResponse> {
3233
return try {
@@ -60,7 +61,7 @@ class FormulaSetController(
6061
}
6162

6263
@PutMapping("/formulas/{formulaSetId}")
63-
fun updateFormulaSet(
64+
override fun updateFormulaSet(
6465
@PathVariable formulaSetId: String?,
6566
@RequestBody request: UpdateFormulaSetRequest?,
6667
): ResponseEntity<FormulaSetResponse> {
@@ -99,7 +100,7 @@ class FormulaSetController(
99100
}
100101

101102
@GetMapping("/formulas")
102-
fun getFormulaSetList(): ResponseEntity<FormulaSetListResponse> {
103+
override fun getFormulaSetList(): ResponseEntity<FormulaSetListResponse> {
103104
return try {
104105
val response = formulaSetUseCase.getFormulaSetList()
105106
ResponseEntity.ok(response)
@@ -109,7 +110,7 @@ class FormulaSetController(
109110
}
110111

111112
@GetMapping("/formulas/{formulaSetId}")
112-
fun getFormulaSetDetail(
113+
override fun getFormulaSetDetail(
113114
@PathVariable formulaSetId: String?,
114115
): ResponseEntity<FormulaSetDetailResponse> {
115116
return try {
@@ -135,7 +136,7 @@ class FormulaSetController(
135136
}
136137

137138
@DeleteMapping("/formulas/{formulaSetId}")
138-
fun deleteFormulaSet(
139+
override fun deleteFormulaSet(
139140
@PathVariable formulaSetId: String?,
140141
): ResponseEntity<Void> {
141142
return try {
@@ -161,7 +162,7 @@ class FormulaSetController(
161162
}
162163

163164
@PostMapping("/formulas/{formulaSetId}/execute")
164-
fun executeFormulas(
165+
override fun executeFormulas(
165166
@PathVariable formulaSetId: String?,
166167
@RequestBody request: FormulaExecutionRequest?,
167168
): ResponseEntity<FormulaExecutionResponse> {

casper-application-infrastructure/src/main/kotlin/hs/kr/entrydsm/application/domain/user/presentation/UserController.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import hs.kr.entrydsm.application.domain.user.presentation.dto.response.CreateUs
55
import hs.kr.entrydsm.application.domain.user.presentation.dto.response.UserDetailResponse
66
import hs.kr.entrydsm.application.domain.user.presentation.dto.response.UsersListResponse
77
import hs.kr.entrydsm.application.domain.user.usecase.UserUseCase
8+
import hs.kr.entrydsm.application.global.document.user.UserApiDocument
89
import org.springframework.http.HttpStatus
910
import org.springframework.http.ResponseEntity
1011
import org.springframework.web.bind.annotation.GetMapping
@@ -18,9 +19,9 @@ import org.springframework.web.bind.annotation.RestController
1819
@RequestMapping("/api/v1/users")
1920
class UserController(
2021
private val userUseCase: UserUseCase,
21-
) {
22+
) : UserApiDocument {
2223
@PostMapping
23-
fun createUser(
24+
override fun createUser(
2425
@RequestBody request: CreateUserRequest?,
2526
): ResponseEntity<CreateUserResponse> {
2627
return try {
@@ -71,7 +72,7 @@ class UserController(
7172
}
7273

7374
@GetMapping("/{userId}")
74-
fun getUserById(
75+
override fun getUserById(
7576
@PathVariable userId: String?,
7677
): ResponseEntity<UserDetailResponse> {
7778
return try {
@@ -115,7 +116,7 @@ class UserController(
115116
}
116117

117118
@GetMapping
118-
fun getAllUsers(): ResponseEntity<UsersListResponse> {
119+
override fun getAllUsers(): ResponseEntity<UsersListResponse> {
119120
return try {
120121
val results = userUseCase.getAllUsers()
121122

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package hs.kr.entrydsm.application.global.document.admin
2+
3+
import hs.kr.entrydsm.application.domain.admin.presentation.dto.request.CreateApplicationTypeRequest
4+
import hs.kr.entrydsm.application.domain.admin.presentation.dto.request.CreateEducationalStatusRequest
5+
import hs.kr.entrydsm.application.domain.admin.presentation.dto.request.CreatePrototypeRequest
6+
import hs.kr.entrydsm.application.domain.admin.presentation.dto.response.CreateApplicationTypeResponse
7+
import hs.kr.entrydsm.application.domain.admin.presentation.dto.response.CreateEducationalStatusResponse
8+
import hs.kr.entrydsm.application.domain.admin.presentation.dto.response.CreatePrototypeResponse
9+
import io.swagger.v3.oas.annotations.Operation
10+
import io.swagger.v3.oas.annotations.media.Content
11+
import io.swagger.v3.oas.annotations.media.Schema
12+
import io.swagger.v3.oas.annotations.responses.ApiResponse
13+
import io.swagger.v3.oas.annotations.responses.ApiResponses
14+
import io.swagger.v3.oas.annotations.tags.Tag
15+
import org.springframework.http.ResponseEntity
16+
import org.springframework.web.bind.annotation.RequestBody
17+
18+
@Tag(name = "어드민 API", description = "어드민 관련 API")
19+
interface AdminApiDocument {
20+
21+
@Operation(summary = "전형 타입 생성", description = "새로운 전형 타입을 생성합니다.")
22+
@ApiResponses(
23+
value = [
24+
ApiResponse(
25+
responseCode = "200",
26+
description = "전형 타입 생성 성공",
27+
content = [Content(schema = Schema(implementation = CreateApplicationTypeResponse::class))]
28+
),
29+
ApiResponse(
30+
responseCode = "400",
31+
description = "잘못된 요청 데이터",
32+
content = [Content(schema = Schema(hidden = true))]
33+
),
34+
ApiResponse(
35+
responseCode = "500",
36+
description = "서버 내부 오류",
37+
content = [Content(schema = Schema(hidden = true))]
38+
)
39+
]
40+
)
41+
fun createApplicationType(
42+
@RequestBody request: CreateApplicationTypeRequest,
43+
): ResponseEntity<CreateApplicationTypeResponse>
44+
45+
@Operation(summary = "학력 상태 생성", description = "새로운 학력 상태를 생성합니다.")
46+
@ApiResponses(
47+
value = [
48+
ApiResponse(
49+
responseCode = "200",
50+
description = "학력 상태 생성 성공",
51+
content = [Content(schema = Schema(implementation = CreateEducationalStatusResponse::class))]
52+
),
53+
ApiResponse(
54+
responseCode = "400",
55+
description = "잘못된 요청 데이터",
56+
content = [Content(schema = Schema(hidden = true))]
57+
),
58+
ApiResponse(
59+
responseCode = "500",
60+
description = "서버 내부 오류",
61+
content = [Content(schema = Schema(hidden = true))]
62+
)
63+
]
64+
)
65+
fun createEducationalStatus(
66+
@RequestBody request: CreateEducationalStatusRequest,
67+
): ResponseEntity<CreateEducationalStatusResponse>
68+
69+
@Operation(summary = "프로토타입 생성", description = "새로운 프로토타입을 생성합니다.")
70+
@ApiResponses(
71+
value = [
72+
ApiResponse(
73+
responseCode = "200",
74+
description = "프로토타입 생성 성공",
75+
content = [Content(schema = Schema(implementation = CreatePrototypeResponse::class))]
76+
),
77+
ApiResponse(
78+
responseCode = "400",
79+
description = "잘못된 요청 데이터",
80+
content = [Content(schema = Schema(hidden = true))]
81+
),
82+
ApiResponse(
83+
responseCode = "500",
84+
description = "서버 내부 오류",
85+
content = [Content(schema = Schema(hidden = true))]
86+
)
87+
]
88+
)
89+
fun createPrototype(
90+
@RequestBody request: CreatePrototypeRequest,
91+
): ResponseEntity<CreatePrototypeResponse>
92+
}

0 commit comments

Comments
 (0)