From c3a5289f8203f638739b3c2e28494c2d8b61656e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 03:15:53 +0900 Subject: [PATCH 01/24] add s3 --- build.gradle.kts | 2 ++ buildSrc/src/main/kotlin/Dependencies.kt | 2 ++ buildSrc/src/main/kotlin/DependencyVersions.kt | 1 + 3 files changed, 5 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index c9206b90..8e352298 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -75,6 +75,8 @@ dependencies { implementation(Dependencies.APACHE_POI_OOXML) implementation(Dependencies.GSON) + + implementation(Dependencies.AWS) } tasks.withType { diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 2e15b3f7..5100a4d9 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -46,4 +46,6 @@ object Dependencies { const val APACHE_POI_OOXML = "org.apache.poi:poi-ooxml:${DependencyVersions.APACHE_POI}" const val GSON = "com.google.code.gson:gson:${DependencyVersions.GSON}" + + const val AWS = "com.amazonaws:aws-java-sdk-s3:${DependencyVersions.AWS}" } diff --git a/buildSrc/src/main/kotlin/DependencyVersions.kt b/buildSrc/src/main/kotlin/DependencyVersions.kt index 227bd3b1..0468ffff 100644 --- a/buildSrc/src/main/kotlin/DependencyVersions.kt +++ b/buildSrc/src/main/kotlin/DependencyVersions.kt @@ -10,4 +10,5 @@ object DependencyVersions { const val QUERYDSL = "5.0.0" const val APACHE_POI = "5.2.5" const val GSON = "2.8.7" + const val AWS = "1.12.281" } From cf921c490ec1b060295c3b9ba79feb34853dde4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 03:25:22 +0900 Subject: [PATCH 02/24] add :: exception --- .../global/error/exception/ErrorCode.kt | 36 ++++++++----------- .../s3/exception/BadFileExtensionException.kt | 8 +++++ .../s3/exception/EmptyFileException.kt | 8 +++++ 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/BadFileExtensionException.kt create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/EmptyFileException.kt diff --git a/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt b/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt index 790094d3..b1c9e3a2 100644 --- a/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt +++ b/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt @@ -4,41 +4,35 @@ enum class ErrorCode( val status: Int, val message: String ) { - FEIGN_BAD_REQUEST(400, "Feign Bad Request"), - FEIGN_UNAUTHORIZED(401, "Feign UnAuthorized"), FEIGN_FORBIDDEN(403, "Feign Forbidden"), - FEIGN_SERVER_ERROR(500, "Feign Server Error"), - USER_NOT_FOUND(404, "User Not Found"), + EXISTS_SELF_STUDY_TEACHER(409, "Exists Self Study Teacher"), + ALREADY_APPLYING_EARLY_RETURN(409, "Already applying For Early Return Application"), + ALREADY_APPLYING_PICNIC(409, "Already applying For Picnic Application"), + ALREADY_APPLYING_MOVEMENT(409, "Already applying for movement"), + + FEIGN_UNAUTHORIZED(401, "Feign UnAuthorized"), PASSWORD_MISS_MATCH(401, "Password Miss Match"), + INVALID_TOKEN(401, "Invalid Token"), + EXPIRED_TOKEN(401, "Expired Token"), + USER_NOT_FOUND(404, "User Not Found"), ADMIN_NOT_FOUND(404, "Admin Not Found"), - SELF_STUDY_NOT_FOUND(404, "Self Study Not Found"), - EXISTS_SELF_STUDY_TEACHER(409, "Exists Self Study Teacher"), - EARLY_RETURN_NOT_FOUND(404, "Early Return Application Not Found"), - ALREADY_APPLYING_EARLY_RETURN(409, "Already applying For Early Return Application"), - APPLICATION_NOT_FOUND(404, "Application Not Found"), - ALREADY_APPLYING_MOVEMENT(409, "Already applying for movement"), STATUS_NOT_FOUND(404, "Status Not Found"), - CLASSROOM_NOT_FOUND(404, "Classroom Not Found"), - WEEKEND_MEAL_NOT_FOUND(404, "WeekendMeal Not Found"), - - ALREADY_APPLYING_PICNIC(409, "Already applying For Picnic Application"), - - INVALID_TOKEN(401, "Invalid Token"), - EXPIRED_TOKEN(401, "Expired Token"), - CLUB_NOT_FOUND(404, "Club Not Found"), - NOTICE_NOT_FOUND(404, "Notice Not Found"), - SCHEDULE_NOT_FOUND(404, "Schedule Not Found"), + FEIGN_BAD_REQUEST(400, "Feign Bad Request"), + FILE_IS_EMPTY(400, "File does not exist"), + BAD_FILE_EXTENSION(400, "File Extension is invalid"), + // Internal Server Error - INTERNAL_SERVER_ERROR(500, "Internal Server Error") + INTERNAL_SERVER_ERROR(500, "Internal Server Error"), + FEIGN_SERVER_ERROR(500, "Feign Server Error"), } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/BadFileExtensionException.kt b/src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/BadFileExtensionException.kt new file mode 100644 index 00000000..af21356f --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/BadFileExtensionException.kt @@ -0,0 +1,8 @@ +package dsm.pick2024.infrastructure.s3.exception + +import dsm.pick2024.global.error.exception.ErrorCode +import dsm.pick2024.global.error.exception.PickException + +object BadFileExtensionException : PickException( + ErrorCode.BAD_FILE_EXTENSION +) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/EmptyFileException.kt b/src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/EmptyFileException.kt new file mode 100644 index 00000000..b6de0455 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/s3/exception/EmptyFileException.kt @@ -0,0 +1,8 @@ +package dsm.pick2024.infrastructure.s3.exception + +import dsm.pick2024.global.error.exception.ErrorCode +import dsm.pick2024.global.error.exception.PickException + +object EmptyFileException : PickException( + ErrorCode.FILE_IS_EMPTY +) From 6775ba49f12665fd034920d80684a22f2776070d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 03:25:34 +0900 Subject: [PATCH 03/24] add :: s3 --- .../pick2024/global/config/aws/AwsConfig.kt | 29 +++++++ .../pick2024/infrastructure/s3/FileUtil.kt | 83 +++++++++++++++++++ .../pick2024/infrastructure/s3/PathList.kt | 5 ++ 3 files changed, 117 insertions(+) create mode 100644 src/main/kotlin/dsm/pick2024/global/config/aws/AwsConfig.kt create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt diff --git a/src/main/kotlin/dsm/pick2024/global/config/aws/AwsConfig.kt b/src/main/kotlin/dsm/pick2024/global/config/aws/AwsConfig.kt new file mode 100644 index 00000000..498172c7 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/global/config/aws/AwsConfig.kt @@ -0,0 +1,29 @@ +package dsm.pick2024.global.config.aws + +import com.amazonaws.auth.AWSCredentials +import com.amazonaws.auth.AWSStaticCredentialsProvider +import com.amazonaws.auth.BasicAWSCredentials +import com.amazonaws.services.s3.AmazonS3 +import com.amazonaws.services.s3.AmazonS3ClientBuilder +import org.springframework.beans.factory.annotation.Value +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration + +@Configuration +class AwsConfig( + @Value("\${cloud.aws.credentials.accessKey}") + private val accessKey: String, + @Value("\${cloud.aws.credentials.secretKey}") + private val secretKey: String, + @Value("\${cloud.aws.region.static}") + private val region: String +) { + @Bean + fun amazonS3(): AmazonS3 { + val awsCredentials: AWSCredentials = BasicAWSCredentials(accessKey, secretKey) + return AmazonS3ClientBuilder.standard() + .withRegion(region) + .withCredentials(AWSStaticCredentialsProvider(awsCredentials)) + .build() + } +} diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt b/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt new file mode 100644 index 00000000..663cf7d6 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt @@ -0,0 +1,83 @@ +package dsm.pick2024.infrastructure.s3 + +import com.amazonaws.HttpMethod +import com.amazonaws.services.s3.AmazonS3 +import com.amazonaws.services.s3.model.CannedAccessControlList +import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest +import com.amazonaws.services.s3.model.ObjectMetadata +import com.amazonaws.services.s3.model.PutObjectRequest +import dsm.pick2024.infrastructure.s3.exception.BadFileExtensionException +import dsm.pick2024.infrastructure.s3.exception.EmptyFileException +import hs.kr.equus.feed.infrastructure.s3.exception.BadFileExtensionException +import hs.kr.equus.feed.infrastructure.s3.exception.EmptyFileException +import org.springframework.beans.factory.annotation.Value +import org.springframework.http.MediaType +import org.springframework.stereotype.Service +import org.springframework.web.multipart.MultipartFile +import java.io.ByteArrayInputStream +import java.io.InputStream +import java.util.* + +@Service +class FileUtil( + private val amazonS3: AmazonS3 +) { + @Value("\${cloud.aws.s3.bucket}") + lateinit var bucketName: String + + companion object { + const val EXP_TIME = 1000 * 60 * 2 + } + + fun upload(file: MultipartFile, path: String): String { + val ext = verificationFile(file) + + val randomName = UUID.randomUUID().toString() + val filename = "$randomName.$ext" + val inputStream: InputStream = ByteArrayInputStream(file.bytes) + + val metadata = ObjectMetadata().apply { + contentType = MediaType.IMAGE_PNG_VALUE + contentLength = file.size + contentDisposition = "inline" + } + + inputStream.use { + amazonS3.putObject( + PutObjectRequest(bucketName, "${path}$filename", it, metadata) + .withCannedAcl(CannedAccessControlList.AuthenticatedRead) + ) + } + + return filename + } + + fun delete(objectName: String, path: String) { + amazonS3.deleteObject(bucketName, path + objectName) + } + + fun generateObjectUrl(fileName: String, path: String): String { + val expiration = Date().apply { + time += EXP_TIME + } + + return amazonS3.generatePresignedUrl( + GeneratePresignedUrlRequest( + bucketName, + "${path}$fileName" + ).withMethod(HttpMethod.GET).withExpiration(expiration) + ).toString() + } + + private fun verificationFile(file: MultipartFile): String { + if (file.isEmpty || file.originalFilename == null) throw EmptyFileException + val originalFilename = file.originalFilename!! + val ext = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).lowercase(Locale.getDefault()) + + if (!(ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "heic" || ext == "hwp" || ext == "pptx")) { + throw BadFileExtensionException + } + + return ext + } +} diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt b/src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt new file mode 100644 index 00000000..66ea1722 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/s3/PathList.kt @@ -0,0 +1,5 @@ +package dsm.pick2024.infrastructure.s3 + +object PathList { + const val BUG = "BUG/" +} From 21a3df0aff079513d61a3bd5fd47af943d56a01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 03:26:17 +0900 Subject: [PATCH 04/24] refactor --- src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt b/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt index 663cf7d6..e6220e53 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/s3/FileUtil.kt @@ -8,8 +8,6 @@ import com.amazonaws.services.s3.model.ObjectMetadata import com.amazonaws.services.s3.model.PutObjectRequest import dsm.pick2024.infrastructure.s3.exception.BadFileExtensionException import dsm.pick2024.infrastructure.s3.exception.EmptyFileException -import hs.kr.equus.feed.infrastructure.s3.exception.BadFileExtensionException -import hs.kr.equus.feed.infrastructure.s3.exception.EmptyFileException import org.springframework.beans.factory.annotation.Value import org.springframework.http.MediaType import org.springframework.stereotype.Service From 759b58c7999b85ce0258d85f0503c96e731a9100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 03:30:54 +0900 Subject: [PATCH 05/24] add :: yaml --- src/main/resources/application.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 4a76098d..4cbe721f 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -48,3 +48,21 @@ discord: webhook: prod: ${WEBHOOK_PROD} stag: ${WEBHOOK_STAG} + +cloud: + aws: + credentials: + accessKey: ${AWS_ACCESS_KEY} + secretKey: ${AWS_SECRET_KEY} + s3: + bucket: ${AWS_BUCKET} + region: + static: ${AWS_STATIC} + stack: + auto: false + + +servlet: + multipart: + max-file-size: 10MB + max-request-size: 10MB From 80f3ecc89c69c833891347d0fa085d3a26c5fd5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 03:42:15 +0900 Subject: [PATCH 06/24] add :: upload bug image api --- .../domain/bug/UploadBugImageService.kt | 14 +++++++++++ .../domain/bug/presentation/BugController.kt | 24 +++++++++++++++++++ .../infrastructure/s3/ImageService.kt | 12 ++++++++++ 3 files changed, 50 insertions(+) create mode 100644 src/main/kotlin/dsm/pick2024/domain/bug/UploadBugImageService.kt create mode 100644 src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/s3/ImageService.kt diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/UploadBugImageService.kt b/src/main/kotlin/dsm/pick2024/domain/bug/UploadBugImageService.kt new file mode 100644 index 00000000..168049c4 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/domain/bug/UploadBugImageService.kt @@ -0,0 +1,14 @@ +package dsm.pick2024.domain.bug + +import dsm.pick2024.infrastructure.s3.ImageService +import dsm.pick2024.infrastructure.s3.PathList +import org.springframework.stereotype.Service +import org.springframework.web.multipart.MultipartFile + +@Service +class UploadBugImageService( + private val imageService: ImageService +) { + fun uploadBugImage(file: MultipartFile) = + imageService.uploadImage(file, PathList.BUG) +} diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt new file mode 100644 index 00000000..a428d117 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt @@ -0,0 +1,24 @@ +package dsm.pick2024.domain.bug.presentation + +import dsm.pick2024.domain.bug.UploadBugImageService +import org.springframework.http.HttpStatus +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.ResponseStatus +import org.springframework.web.bind.annotation.RestController +import org.springframework.web.multipart.MultipartFile + +@RestController +@RequestMapping("/bug") +class BugController( + private val uploadBugImageService: UploadBugImageService +) { + + @ResponseStatus(value = HttpStatus.OK) + @PostMapping("/upload") + fun uploadBugImage( + @RequestPart(name = "file") file: MultipartFile + ) = + uploadBugImageService.uploadBugImage(file) +} diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/s3/ImageService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/s3/ImageService.kt new file mode 100644 index 00000000..d5acfbc2 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/s3/ImageService.kt @@ -0,0 +1,12 @@ +package dsm.pick2024.infrastructure.s3 + +import org.springframework.stereotype.Service +import org.springframework.web.multipart.MultipartFile + +@Service +class ImageService( + private val fileUtil: FileUtil +) { + fun uploadImage(file: MultipartFile, path: String) = + fileUtil.upload(file, path) +} From aecbfd4104a38a679ea9210cdd9af29b82737edc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Sun, 21 Apr 2024 23:08:51 +0900 Subject: [PATCH 07/24] . --- .../dsm/pick2024/domain/bug/AddBugService.kt | 20 +++++++++++++++++++ .../dsm/pick2024/domain/bug/BugRequest.kt | 9 +++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt create mode 100644 src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt new file mode 100644 index 00000000..48e3729a --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt @@ -0,0 +1,20 @@ +package dsm.pick2024.domain.bug + +import dsm.pick2024.domain.user.facade.UserFacade +import dsm.pick2024.infrastructure.s3.FileUtil +import dsm.pick2024.infrastructure.s3.PathList +import org.springframework.stereotype.Service + +@Service +class AddBugService( + private val userFacade: UserFacade, + private val adminFacade: UserFacade, + private val fileUtil: FileUtil +) { + fun bugAlarm(request: BugRequest) { + val file = request.fileName?.let { + fileUtil.generateObjectUrl(request.fileName, PathList.BUG) + } + + } +} diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt b/src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt new file mode 100644 index 00000000..8abb68f6 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt @@ -0,0 +1,9 @@ +package dsm.pick2024.domain.bug + +import org.apache.logging.log4j.util.StringMap + +data class BugRequest ( + val title: String, + val content: String, + val fileName: String? +) From 022135d89ccbfd0ce725ccd5400a918f66b0ff5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Tue, 23 Apr 2024 19:20:33 +0900 Subject: [PATCH 08/24] add :: yaml --- src/main/resources/application.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 4cbe721f..d068598a 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -48,6 +48,7 @@ discord: webhook: prod: ${WEBHOOK_PROD} stag: ${WEBHOOK_STAG} + message: ${WEBHOOK_MESSAGE} cloud: aws: From cc2bc2ff7a8edab15aff685b038090af6ff2016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Tue, 23 Apr 2024 19:21:25 +0900 Subject: [PATCH 09/24] add :: feign client --- .../presentation/dto/request/DiscordMessage.kt | 7 +++++++ .../feign/client/DiscordMessageClient.kt | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt new file mode 100644 index 00000000..5980ae40 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt @@ -0,0 +1,7 @@ +package dsm.pick2024.domain.bug.presentation.dto.request + +data class DiscordMessage ( + val title: String, + val content: String, + val imageUrl: String? +) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt new file mode 100644 index 00000000..21516a88 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt @@ -0,0 +1,15 @@ +package dsm.pick2024.infrastructure.feign.client + +import dsm.pick2024.domain.bug.presentation.dto.request.DiscordMessage +import org.springframework.cloud.openfeign.FeignClient +import org.springframework.http.MediaType +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody + +@FeignClient(url = "\${discord.webhook.message}") +interface DiscordMessageClient { + @PostMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) + fun sendMessage( + @RequestBody discordMessage: DiscordMessage + ) +} From 51f7b26241774751c1610ceca3519ff07b35bece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Tue, 23 Apr 2024 19:24:03 +0900 Subject: [PATCH 10/24] add :: yaml --- src/main/resources/application.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index d068598a..7a66f182 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -62,7 +62,6 @@ cloud: stack: auto: false - servlet: multipart: max-file-size: 10MB From a8d0d8c58cda41a1b673ebb448a4c5ec307641f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Tue, 23 Apr 2024 20:13:30 +0900 Subject: [PATCH 11/24] add :: api --- .../dsm/pick2024/domain/bug/AddBugService.kt | 15 ++++++++------- .../kotlin/dsm/pick2024/domain/bug/BugRequest.kt | 9 --------- .../domain/bug/presentation/BugController.kt | 13 ++++++++++++- .../request/{DiscordMessage.kt => BugRequest.kt} | 4 ++-- .../pick2024/global/error/exception/ErrorCode.kt | 2 +- .../feign/client/DiscordMessageClient.kt | 6 +++--- 6 files changed, 26 insertions(+), 23 deletions(-) delete mode 100644 src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt rename src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/{DiscordMessage.kt => BugRequest.kt} (66%) diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt index 48e3729a..de67bf7c 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt @@ -1,20 +1,21 @@ package dsm.pick2024.domain.bug -import dsm.pick2024.domain.user.facade.UserFacade +import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest +import dsm.pick2024.infrastructure.feign.client.DiscordMessageClient import dsm.pick2024.infrastructure.s3.FileUtil import dsm.pick2024.infrastructure.s3.PathList import org.springframework.stereotype.Service @Service class AddBugService( - private val userFacade: UserFacade, - private val adminFacade: UserFacade, - private val fileUtil: FileUtil + private val fileUtil: FileUtil, + private val discordMessageClient: DiscordMessageClient ) { fun bugAlarm(request: BugRequest) { - val file = request.fileName?.let { - fileUtil.generateObjectUrl(request.fileName, PathList.BUG) - } + request.fileName?.let { + fileUtil.generateObjectUrl(request.fileName, PathList.BUG) + } + discordMessageClient.sendMessage(request) } } diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt b/src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt deleted file mode 100644 index 8abb68f6..00000000 --- a/src/main/kotlin/dsm/pick2024/domain/bug/BugRequest.kt +++ /dev/null @@ -1,9 +0,0 @@ -package dsm.pick2024.domain.bug - -import org.apache.logging.log4j.util.StringMap - -data class BugRequest ( - val title: String, - val content: String, - val fileName: String? -) diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt index a428d117..76f9c548 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt @@ -1,8 +1,11 @@ package dsm.pick2024.domain.bug.presentation +import dsm.pick2024.domain.bug.AddBugService import dsm.pick2024.domain.bug.UploadBugImageService +import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest import org.springframework.http.HttpStatus import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.ResponseStatus @@ -12,7 +15,8 @@ import org.springframework.web.multipart.MultipartFile @RestController @RequestMapping("/bug") class BugController( - private val uploadBugImageService: UploadBugImageService + private val uploadBugImageService: UploadBugImageService, + private val addBugService: AddBugService ) { @ResponseStatus(value = HttpStatus.OK) @@ -21,4 +25,11 @@ class BugController( @RequestPart(name = "file") file: MultipartFile ) = uploadBugImageService.uploadBugImage(file) + + @ResponseStatus(value = HttpStatus.CREATED) + @PostMapping("/message") + fun sendBugMessage( + @RequestBody bugRequest: BugRequest + ) = + addBugService.bugAlarm(bugRequest) } diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/BugRequest.kt similarity index 66% rename from src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt rename to src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/BugRequest.kt index 5980ae40..98a060a6 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/DiscordMessage.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/dto/request/BugRequest.kt @@ -1,7 +1,7 @@ package dsm.pick2024.domain.bug.presentation.dto.request -data class DiscordMessage ( +data class BugRequest( val title: String, val content: String, - val imageUrl: String? + val fileName: String? ) diff --git a/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt b/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt index 401a33b0..c1a42619 100644 --- a/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt +++ b/src/main/kotlin/dsm/pick2024/global/error/exception/ErrorCode.kt @@ -37,5 +37,5 @@ enum class ErrorCode( // Internal Server Error INTERNAL_SERVER_ERROR(500, "Internal Server Error"), - FEIGN_SERVER_ERROR(500, "Feign Server Error"), + FEIGN_SERVER_ERROR(500, "Feign Server Error") } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt index 21516a88..dfd43691 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt @@ -1,15 +1,15 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.domain.bug.presentation.dto.request.DiscordMessage +import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest import org.springframework.cloud.openfeign.FeignClient import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody -@FeignClient(url = "\${discord.webhook.message}") +@FeignClient(name = "feign-message", url = "\${discord.webhook.message}") interface DiscordMessageClient { @PostMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) fun sendMessage( - @RequestBody discordMessage: DiscordMessage + @RequestBody bugRequest: BugRequest ) } From f03d6ac1c770a3ceafa6cf5d4f5cdeb22eff848d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Wed, 24 Apr 2024 09:44:12 +0900 Subject: [PATCH 12/24] modify :: bug --- .../kotlin/dsm/pick2024/domain/bug/AddBugService.kt | 13 ++++++++++--- .../feign/client/DiscordMessageClient.kt | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt index de67bf7c..259f7bbb 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt @@ -12,10 +12,17 @@ class AddBugService( private val discordMessageClient: DiscordMessageClient ) { fun bugAlarm(request: BugRequest) { - request.fileName?.let { - fileUtil.generateObjectUrl(request.fileName, PathList.BUG) + val messageTitle = "Bug Report: ${request.title}" + val messageContent = buildString { + append("Title: ${request.title}\n") + append("Content: ${request.content}\n") + if (request.fileName != null) { + val fileUrl = fileUtil.generateObjectUrl(request.fileName, PathList.BUG) + append("File Name: ${request.fileName}\nFile URL: $fileUrl") + } } - discordMessageClient.sendMessage(request) + val message = mapOf("message" to messageTitle, "content" to messageContent) + discordMessageClient.sendMessage(message) } } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt index dfd43691..e8f43612 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt @@ -10,6 +10,6 @@ import org.springframework.web.bind.annotation.RequestBody interface DiscordMessageClient { @PostMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) fun sendMessage( - @RequestBody bugRequest: BugRequest + @RequestBody message: Map ) } From cc3a1cfc65f23d62bafdcaa89840ddff9ebf4bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 08:56:44 +0900 Subject: [PATCH 13/24] modify :: discord client --- .../client/{DiscordMessageClient.kt => DiscordBugClient.kt} | 4 ++-- .../feign/client/{DiscordClient.kt => DiscordStagClient.kt} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{DiscordMessageClient.kt => DiscordBugClient.kt} (79%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{DiscordClient.kt => DiscordStagClient.kt} (100%) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt similarity index 79% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt index e8f43612..9bd241ec 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordMessageClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt @@ -1,6 +1,6 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest +import dsm.pick2024.global.discord.DiscordMessage import org.springframework.cloud.openfeign.FeignClient import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping @@ -10,6 +10,6 @@ import org.springframework.web.bind.annotation.RequestBody interface DiscordMessageClient { @PostMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) fun sendMessage( - @RequestBody message: Map + @RequestBody message: DiscordMessage ) } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt similarity index 100% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordClient.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt From 3c78195a0617f599db32bd3d6d883620fa1bb137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 08:56:57 +0900 Subject: [PATCH 14/24] add :: api --- .../dsm/pick2024/domain/bug/AddBugService.kt | 42 ++++++++++++------- .../domain/bug/presentation/BugController.kt | 5 +++ 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt index 259f7bbb..b0b3fb96 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt @@ -1,28 +1,42 @@ package dsm.pick2024.domain.bug import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest -import dsm.pick2024.infrastructure.feign.client.DiscordMessageClient +import dsm.pick2024.domain.user.facade.UserFacade +import dsm.pick2024.global.discord.DiscordMessage +import dsm.pick2024.infrastructure.feign.client.DiscordBugClient import dsm.pick2024.infrastructure.s3.FileUtil import dsm.pick2024.infrastructure.s3.PathList +import org.springframework.scheduling.annotation.Async import org.springframework.stereotype.Service @Service class AddBugService( private val fileUtil: FileUtil, - private val discordMessageClient: DiscordMessageClient + private val discordBugClient: DiscordBugClient, + private val userFacade: UserFacade ) { + @Async fun bugAlarm(request: BugRequest) { - val messageTitle = "Bug Report: ${request.title}" - val messageContent = buildString { - append("Title: ${request.title}\n") - append("Content: ${request.content}\n") - if (request.fileName != null) { - val fileUrl = fileUtil.generateObjectUrl(request.fileName, PathList.BUG) - append("File Name: ${request.fileName}\nFile URL: $fileUrl") - } - } - - val message = mapOf("message" to messageTitle, "content" to messageContent) - discordMessageClient.sendMessage(message) + val message = DiscordMessage( + content = "# 🚨 버그 제보", + embeds = listOf( + DiscordMessage.Embed( + title = "ℹ️ 버그 정보", + description = """ + ### 🕖 버그 제목 + ${request.title} + ### 🔗 버그 내용 + ${request.content} + ### 📄 이미지 + ``` + ${request.fileName?.let { fileUtil.generateObjectUrl(request.fileName, PathList.BUG) }} + ``` + ### 🧑🏻‍💻 버그 제보자 + ${userFacade.currentUser().name} + """.trimIndent() + ) + ) + ) + discordBugClient.sendMessage(message) } } diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt index 76f9c548..95de86b3 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/presentation/BugController.kt @@ -3,6 +3,8 @@ package dsm.pick2024.domain.bug.presentation import dsm.pick2024.domain.bug.AddBugService import dsm.pick2024.domain.bug.UploadBugImageService import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest +import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.tags.Tag import org.springframework.http.HttpStatus import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody @@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.ResponseStatus import org.springframework.web.bind.annotation.RestController import org.springframework.web.multipart.MultipartFile +@Tag(name = "버그제보 api") @RestController @RequestMapping("/bug") class BugController( @@ -19,6 +22,7 @@ class BugController( private val addBugService: AddBugService ) { + @Operation(summary = "버그제보 이미지 업로드 API") @ResponseStatus(value = HttpStatus.OK) @PostMapping("/upload") fun uploadBugImage( @@ -26,6 +30,7 @@ class BugController( ) = uploadBugImageService.uploadBugImage(file) + @Operation(summary = "버그제부 문자 전송 API") @ResponseStatus(value = HttpStatus.CREATED) @PostMapping("/message") fun sendBugMessage( From a840d0c2c6d2c5078b401af2961d5112d6452d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 08:57:21 +0900 Subject: [PATCH 15/24] refactor :: discord client --- Dockerfile | 4 ++-- .../dsm/pick2024/global/discord/DiscordController.kt | 10 ++++++---- .../infrastructure/feign/client/DiscordBugClient.kt | 4 ++-- .../infrastructure/feign/client/DiscordProdClient.kt | 12 ++++++++++++ .../infrastructure/feign/client/DiscordStagClient.kt | 7 ++----- 5 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt diff --git a/Dockerfile b/Dockerfile index e5781a34..ee32e010 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,8 +51,8 @@ ENV WEBHOOK_PROD ${WEBHOOK_PROD} ARG WEBHOOK_STAG ENV WEBHOOK_STAG ${WEBHOOK_STAG} -ARG DISCORD -ENV DISCORD ${DISCORD} +ARG WEBHOOK_MESSAGE +ENV WEBHOOK_MESSAGE ${WEBHOOK_MESSAGE} ARG JAR_FILE=./build/libs/*.jar COPY ${JAR_FILE} application.jar diff --git a/src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt b/src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt index 6f06933e..79afb96e 100644 --- a/src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt +++ b/src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt @@ -1,7 +1,8 @@ package dsm.pick2024.global.discord import dsm.pick2024.global.discord.DiscordMessage.Embed -import dsm.pick2024.infrastructure.feign.client.DiscordClient +import dsm.pick2024.infrastructure.feign.client.DiscordProdClient +import dsm.pick2024.infrastructure.feign.client.DiscordStagClient import org.springframework.core.env.Environment import org.springframework.stereotype.Component import org.springframework.web.context.request.ServletWebRequest @@ -12,14 +13,15 @@ import java.time.LocalDateTime @Component class DiscordController( - private val discordClient: DiscordClient, + private val discordStagClient: DiscordStagClient, + private val discordProdClient: DiscordProdClient, private val environment: Environment ) { fun sendDiscordAlarm(e: Exception, request: WebRequest) { if (isProductionEnvironment()) { - discordClient.prodSendAlarm(createMessage(e, request)) + discordProdClient.prodSendAlarm(createMessage(e, request)) } else { - discordClient.stagSendAlarm(createMessage(e, request)) + discordStagClient.stagSendAlarm(createMessage(e, request)) } } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt index 9bd241ec..f979a739 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt @@ -6,8 +6,8 @@ import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody -@FeignClient(name = "feign-message", url = "\${discord.webhook.message}") -interface DiscordMessageClient { +@FeignClient(name = "discord-bug-message-client", url = "\${discord.webhook.message}") +interface DiscordBugClient { @PostMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) fun sendMessage( @RequestBody message: DiscordMessage diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt new file mode 100644 index 00000000..d12ad3e2 --- /dev/null +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt @@ -0,0 +1,12 @@ +package dsm.pick2024.infrastructure.feign.client + +import dsm.pick2024.global.discord.DiscordMessage +import org.springframework.cloud.openfeign.FeignClient +import org.springframework.web.bind.annotation.PostMapping +import org.springframework.web.bind.annotation.RequestBody + +@FeignClient(name = "discord-bug-prod-client", url = "\${discord.webhook.prod}") +interface DiscordProdClient { + @PostMapping + fun prodSendAlarm(@RequestBody message: DiscordMessage) +} diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt index 01316cc7..5fed8f84 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt @@ -5,11 +5,8 @@ import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody -@FeignClient(name = "discord-client", url = "\${url.discord}") -interface DiscordClient { - @PostMapping("\${discord.webhook.prod}") - fun prodSendAlarm(@RequestBody message: DiscordMessage) - +@FeignClient(name = "discord-bug-stag-message-client", url = "\${discord.webhook.stag}") +interface DiscordStagClient { @PostMapping("\${discord.webhook.stag}") fun stagSendAlarm(@RequestBody message: DiscordMessage) } From a34837b5f2a46590a1a52d55e740503281b4808c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 08:57:42 +0900 Subject: [PATCH 16/24] modify :: action, yml --- .github/workflows/git-action-prod.yml | 2 +- .github/workflows/git-action-stag.yml | 2 +- src/main/resources/application.yaml | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/git-action-prod.yml b/.github/workflows/git-action-prod.yml index bc363524..3bf4c790 100644 --- a/.github/workflows/git-action-prod.yml +++ b/.github/workflows/git-action-prod.yml @@ -56,7 +56,7 @@ jobs: DSM_LOGIN=${{ secrets.DSM_LOGIN }} NEIS_KEY=${{ secrets.NEIS_KEY }} WEBHOOK_PROD=${{ secrets.WEBHOOK_PROD }} - DISCORD=${{ secrets.DISCORD }} + WEBHOOK_MESSAGE=${{ secrets.WEBHOOK_MESSAGE }} - name: Discord Alert Success uses: sarisia/actions-status-discord@v1 diff --git a/.github/workflows/git-action-stag.yml b/.github/workflows/git-action-stag.yml index a3baf007..fc0bf2e6 100644 --- a/.github/workflows/git-action-stag.yml +++ b/.github/workflows/git-action-stag.yml @@ -56,7 +56,7 @@ jobs: DSM_LOGIN=${{ secrets.DSM_LOGIN }} NEIS_KEY=${{ secrets.NEIS_KEY }} WEBHOOK_STAG=${{ secrets.WEBHOOK_STAG }} - DISCORD=${{ secrets.DISCORD }} + WEBHOOK_MESSAGE=${{ secrets.WEBHOOK_MESSAGE }} - name: Discord Alert Success uses: sarisia/actions-status-discord@v1 diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 7a66f182..7cc0ae83 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -39,7 +39,6 @@ url: neis: ${NEIS_URL} daedongyeojido: ${DAE_URL} dsmlogin: ${DSM_LOGIN} - discord: ${DISCORD} open-feign: neis-key: ${NEIS_KEY} From 47792180b5557fdbedb45b80fd3888b60931001a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 10:33:27 +0900 Subject: [PATCH 17/24] refactor --- .../kotlin/dsm/pick2024/domain/bug/AddBugService.kt | 6 +++--- .../pick2024/global/error/GlobalExceptionHandler.kt | 6 +++--- .../discord/DiscordComponet.kt} | 11 ++++++----- .../feign/NeisMealFeignClientService.kt | 2 +- .../feign/NeisScheduleFeignClientService.kt | 2 +- .../feign/NeisTimetableFeignClientService.kt | 2 +- .../infrastructure/feign/client/DiscordBugClient.kt | 7 +++---- .../infrastructure/feign/client/DiscordProdClient.kt | 4 ++-- .../infrastructure/feign/client/DiscordStagClient.kt | 6 +++--- .../infrastructure/feign/client/XquareFeignClient.kt | 4 ++-- .../client/dto/request/DiscordMessageRequest.kt} | 4 ++-- .../NeisFeignClientMealServiceDietInfoResponse.kt | 2 +- .../response/NeisFeignClientScheduleResponse.kt | 2 +- .../response/NeisFeignClientTimetableResponse.kt | 2 +- .../feign/client/{ => dto}/response/XquareResponse.kt | 2 +- .../{ => dto}/response/XquareUserAllResponse.kt | 2 +- 16 files changed, 32 insertions(+), 32 deletions(-) rename src/main/kotlin/dsm/pick2024/{global/discord/DiscordController.kt => infrastructure/discord/DiscordComponet.kt} (88%) rename src/main/kotlin/dsm/pick2024/{global/discord/DiscordMessage.kt => infrastructure/feign/client/dto/request/DiscordMessageRequest.kt} (60%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/NeisFeignClientMealServiceDietInfoResponse.kt (86%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/NeisFeignClientScheduleResponse.kt (78%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/NeisFeignClientTimetableResponse.kt (86%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/XquareResponse.kt (83%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/XquareUserAllResponse.kt (74%) diff --git a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt index b0b3fb96..7e062657 100644 --- a/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt +++ b/src/main/kotlin/dsm/pick2024/domain/bug/AddBugService.kt @@ -2,7 +2,7 @@ package dsm.pick2024.domain.bug import dsm.pick2024.domain.bug.presentation.dto.request.BugRequest import dsm.pick2024.domain.user.facade.UserFacade -import dsm.pick2024.global.discord.DiscordMessage +import dsm.pick2024.infrastructure.feign.client.dto.request.DiscordMessageRequest import dsm.pick2024.infrastructure.feign.client.DiscordBugClient import dsm.pick2024.infrastructure.s3.FileUtil import dsm.pick2024.infrastructure.s3.PathList @@ -17,10 +17,10 @@ class AddBugService( ) { @Async fun bugAlarm(request: BugRequest) { - val message = DiscordMessage( + val message = DiscordMessageRequest( content = "# 🚨 버그 제보", embeds = listOf( - DiscordMessage.Embed( + DiscordMessageRequest.Embed( title = "ℹ️ 버그 정보", description = """ ### 🕖 버그 제목 diff --git a/src/main/kotlin/dsm/pick2024/global/error/GlobalExceptionHandler.kt b/src/main/kotlin/dsm/pick2024/global/error/GlobalExceptionHandler.kt index 4bd8d54d..9d55b466 100644 --- a/src/main/kotlin/dsm/pick2024/global/error/GlobalExceptionHandler.kt +++ b/src/main/kotlin/dsm/pick2024/global/error/GlobalExceptionHandler.kt @@ -1,6 +1,6 @@ package dsm.pick2024.global.error -import dsm.pick2024.global.discord.DiscordController +import dsm.pick2024.infrastructure.discord.DiscordComponet import dsm.pick2024.global.error.exception.PickException import org.springframework.context.MessageSource import org.springframework.core.env.Environment @@ -14,7 +14,7 @@ import java.io.Serializable @RestControllerAdvice class GlobalExceptionHandler( private val messageSource: MessageSource, - private val discordController: DiscordController, + private val discordComponet: DiscordComponet, private val environment: Environment ) { @@ -30,7 +30,7 @@ class GlobalExceptionHandler( @ExceptionHandler(Exception::class) fun exception(e: PickException, request: WebRequest): ResponseEntity? { if (!listOf(environment.activeProfiles).contains("local")) { - discordController.sendDiscordAlarm(e, request) + discordComponet.sendDiscordAlarm(e, request) return ResponseEntity( ErrorResponse(e.errorCode.status, e.message), HttpStatus.valueOf(e.errorCode.status) diff --git a/src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt b/src/main/kotlin/dsm/pick2024/infrastructure/discord/DiscordComponet.kt similarity index 88% rename from src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/discord/DiscordComponet.kt index 79afb96e..2cba8fd1 100644 --- a/src/main/kotlin/dsm/pick2024/global/discord/DiscordController.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/discord/DiscordComponet.kt @@ -1,8 +1,9 @@ -package dsm.pick2024.global.discord +package dsm.pick2024.infrastructure.discord -import dsm.pick2024.global.discord.DiscordMessage.Embed +import dsm.pick2024.infrastructure.feign.client.dto.request.DiscordMessageRequest.Embed import dsm.pick2024.infrastructure.feign.client.DiscordProdClient import dsm.pick2024.infrastructure.feign.client.DiscordStagClient +import dsm.pick2024.infrastructure.feign.client.dto.request.DiscordMessageRequest import org.springframework.core.env.Environment import org.springframework.stereotype.Component import org.springframework.web.context.request.ServletWebRequest @@ -12,7 +13,7 @@ import java.io.StringWriter import java.time.LocalDateTime @Component -class DiscordController( +class DiscordComponet( private val discordStagClient: DiscordStagClient, private val discordProdClient: DiscordProdClient, private val environment: Environment @@ -30,8 +31,8 @@ class DiscordController( return "prod" in activeProfiles } - private fun createMessage(e: Exception, request: WebRequest): DiscordMessage { - return DiscordMessage( + private fun createMessage(e: Exception, request: WebRequest): DiscordMessageRequest { + return DiscordMessageRequest( content = "# 🚨 에러 발생", embeds = listOf( Embed( diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt index 8d3a786e..f1abc990 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt @@ -4,7 +4,7 @@ import com.google.gson.Gson import dsm.pick2024.domain.meal.entity.MealJpaEntity import dsm.pick2024.infrastructure.feign.client.NeisFeignClient import dsm.pick2024.infrastructure.feign.client.property.NeisFeignClientRequestProperty -import dsm.pick2024.infrastructure.feign.client.response.NeisFeignClientMealServiceDietInfoResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.NeisFeignClientMealServiceDietInfoResponse import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Component import java.time.LocalDate diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt index 53fafa88..a1c4889e 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt @@ -4,7 +4,7 @@ import com.google.gson.Gson import dsm.pick2024.domain.schedule.entity.ScheduleJpaEntity import dsm.pick2024.infrastructure.feign.client.NeisFeignClient import dsm.pick2024.infrastructure.feign.client.property.NeisFeignClientRequestProperty -import dsm.pick2024.infrastructure.feign.client.response.NeisFeignClientScheduleResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.NeisFeignClientScheduleResponse import java.time.LocalDate import java.time.format.DateTimeFormatter import org.springframework.beans.factory.annotation.Value diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt index 2d44cdf4..91f28279 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt @@ -4,7 +4,7 @@ import com.google.gson.Gson import dsm.pick2024.domain.timetable.entity.TimetableJpaEntity import dsm.pick2024.infrastructure.feign.client.NeisFeignClient import dsm.pick2024.infrastructure.feign.client.property.NeisFeignClientRequestProperty -import dsm.pick2024.infrastructure.feign.client.response.NeisFeignClientTimetableResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.NeisFeignClientTimetableResponse import java.time.LocalDate import java.time.format.DateTimeFormatter import org.springframework.beans.factory.annotation.Value diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt index f979a739..6e2b8e7a 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordBugClient.kt @@ -1,15 +1,14 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.global.discord.DiscordMessage +import dsm.pick2024.infrastructure.feign.client.dto.request.DiscordMessageRequest import org.springframework.cloud.openfeign.FeignClient -import org.springframework.http.MediaType import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody @FeignClient(name = "discord-bug-message-client", url = "\${discord.webhook.message}") interface DiscordBugClient { - @PostMapping(produces = [MediaType.APPLICATION_JSON_VALUE]) + @PostMapping fun sendMessage( - @RequestBody message: DiscordMessage + @RequestBody message: DiscordMessageRequest ) } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt index d12ad3e2..3fe1f651 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordProdClient.kt @@ -1,6 +1,6 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.global.discord.DiscordMessage +import dsm.pick2024.infrastructure.feign.client.dto.request.DiscordMessageRequest import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody @@ -8,5 +8,5 @@ import org.springframework.web.bind.annotation.RequestBody @FeignClient(name = "discord-bug-prod-client", url = "\${discord.webhook.prod}") interface DiscordProdClient { @PostMapping - fun prodSendAlarm(@RequestBody message: DiscordMessage) + fun prodSendAlarm(@RequestBody message: DiscordMessageRequest) } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt index 5fed8f84..36a7b10b 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/DiscordStagClient.kt @@ -1,12 +1,12 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.global.discord.DiscordMessage +import dsm.pick2024.infrastructure.feign.client.dto.request.DiscordMessageRequest import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody @FeignClient(name = "discord-bug-stag-message-client", url = "\${discord.webhook.stag}") interface DiscordStagClient { - @PostMapping("\${discord.webhook.stag}") - fun stagSendAlarm(@RequestBody message: DiscordMessage) + @PostMapping + fun stagSendAlarm(@RequestBody message: DiscordMessageRequest) } diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt index f822246b..3f8dbd38 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt @@ -1,7 +1,7 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.infrastructure.feign.client.response.XquareResponse -import dsm.pick2024.infrastructure.feign.client.response.XquareUserAllResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.XquareResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.XquareUserAllResponse import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestParam diff --git a/src/main/kotlin/dsm/pick2024/global/discord/DiscordMessage.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/request/DiscordMessageRequest.kt similarity index 60% rename from src/main/kotlin/dsm/pick2024/global/discord/DiscordMessage.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/request/DiscordMessageRequest.kt index 21d54da6..7926667b 100644 --- a/src/main/kotlin/dsm/pick2024/global/discord/DiscordMessage.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/request/DiscordMessageRequest.kt @@ -1,6 +1,6 @@ -package dsm.pick2024.global.discord +package dsm.pick2024.infrastructure.feign.client.dto.request -data class DiscordMessage( +data class DiscordMessageRequest( val content: String, val embeds: List ) { diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientMealServiceDietInfoResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientMealServiceDietInfoResponse.kt similarity index 86% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientMealServiceDietInfoResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientMealServiceDietInfoResponse.kt index 8ddad955..97a65e67 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientMealServiceDietInfoResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientMealServiceDietInfoResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response data class NeisFeignClientMealServiceDietInfoResponse( val mealServiceDietInfo: List diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientScheduleResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientScheduleResponse.kt similarity index 78% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientScheduleResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientScheduleResponse.kt index 927a2c26..a9ccf341 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientScheduleResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientScheduleResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response data class NeisFeignClientScheduleResponse( val SchoolSchedule: List diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientTimetableResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientTimetableResponse.kt similarity index 86% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientTimetableResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientTimetableResponse.kt index 66afb9ac..6a6375f9 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientTimetableResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientTimetableResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response data class NeisFeignClientTimetableResponse( val hisTimetable: List diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt similarity index 83% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt index 0d2a4246..3ca3c3db 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response import java.time.LocalDate import java.util.* diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareUserAllResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareUserAllResponse.kt similarity index 74% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareUserAllResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareUserAllResponse.kt index cafe6f1a..60f4ac3f 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareUserAllResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareUserAllResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response import java.util.UUID From d378859858e92df79bbdece2e720c500fa28034c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 10:43:06 +0900 Subject: [PATCH 18/24] test --- .../pick2024/infrastructure/feign/client/XquareFeignClient.kt | 1 - .../feign/client/{dto/response => }/XquareResponse.kt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{dto/response => }/XquareResponse.kt (83%) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt index 3f8dbd38..c92dfd52 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt @@ -1,6 +1,5 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.infrastructure.feign.client.dto.response.XquareResponse import dsm.pick2024.infrastructure.feign.client.dto.response.XquareUserAllResponse import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.GetMapping diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt similarity index 83% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt index 3ca3c3db..a487786a 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.dto.response +package dsm.pick2024.infrastructure.feign.client import java.time.LocalDate import java.util.* From 5dd292972bb85f560f10911b4e5c782b1ae44818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 10:44:14 +0900 Subject: [PATCH 19/24] test --- .../pick2024/infrastructure/feign/client/XquareFeignClient.kt | 1 + .../feign/client/{ => dto/response}/XquareResponse.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto/response}/XquareResponse.kt (83%) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt index c92dfd52..3f8dbd38 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt @@ -1,5 +1,6 @@ package dsm.pick2024.infrastructure.feign.client +import dsm.pick2024.infrastructure.feign.client.dto.response.XquareResponse import dsm.pick2024.infrastructure.feign.client.dto.response.XquareUserAllResponse import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.GetMapping diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt similarity index 83% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt index a487786a..3ca3c3db 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client +package dsm.pick2024.infrastructure.feign.client.dto.response import java.time.LocalDate import java.util.* From 21e76bd0fbe7614bbf85b2e39984f8bcb1a4b6f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 10:44:34 +0900 Subject: [PATCH 20/24] test --- .../pick2024/infrastructure/feign/client/XquareFeignClient.kt | 1 - .../feign/client/{dto/response => }/XquareResponse.kt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{dto/response => }/XquareResponse.kt (83%) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt index 3f8dbd38..c92dfd52 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt @@ -1,6 +1,5 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.infrastructure.feign.client.dto.response.XquareResponse import dsm.pick2024.infrastructure.feign.client.dto.response.XquareUserAllResponse import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.GetMapping diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt similarity index 83% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt index 3ca3c3db..a487786a 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.dto.response +package dsm.pick2024.infrastructure.feign.client import java.time.LocalDate import java.util.* From fc9a21af6cd9ab1e47672d19e68ad24dd58d842b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 10:45:08 +0900 Subject: [PATCH 21/24] modify :: file --- .../pick2024/infrastructure/feign/client/XquareFeignClient.kt | 1 + .../feign/client/{ => dto/response}/XquareResponse.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto/response}/XquareResponse.kt (83%) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt index c92dfd52..3f8dbd38 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt @@ -1,5 +1,6 @@ package dsm.pick2024.infrastructure.feign.client +import dsm.pick2024.infrastructure.feign.client.dto.response.XquareResponse import dsm.pick2024.infrastructure.feign.client.dto.response.XquareUserAllResponse import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.GetMapping diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt similarity index 83% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt index a487786a..3ca3c3db 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client +package dsm.pick2024.infrastructure.feign.client.dto.response import java.time.LocalDate import java.util.* From 8069c0325176770e5398607309a6f92ae27a28ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 10:45:40 +0900 Subject: [PATCH 22/24] response --- .../infrastructure/feign/NeisMealFeignClientService.kt | 2 +- .../infrastructure/feign/NeisScheduleFeignClientService.kt | 2 +- .../infrastructure/feign/NeisTimetableFeignClientService.kt | 2 +- .../pick2024/infrastructure/feign/client/XquareFeignClient.kt | 4 ++-- .../response/NeisFeignClientMealServiceDietInfoResponse.kt | 2 +- .../{ => dto}/response/NeisFeignClientScheduleResponse.kt | 2 +- .../{ => dto}/response/NeisFeignClientTimetableResponse.kt | 2 +- .../feign/client/{ => dto}/response/XquareResponse.kt | 2 +- .../feign/client/{ => dto}/response/XquareUserAllResponse.kt | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/NeisFeignClientMealServiceDietInfoResponse.kt (86%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/NeisFeignClientScheduleResponse.kt (78%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/NeisFeignClientTimetableResponse.kt (86%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/XquareResponse.kt (85%) rename src/main/kotlin/dsm/pick2024/infrastructure/feign/client/{ => dto}/response/XquareUserAllResponse.kt (74%) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt index 8d3a786e..f1abc990 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisMealFeignClientService.kt @@ -4,7 +4,7 @@ import com.google.gson.Gson import dsm.pick2024.domain.meal.entity.MealJpaEntity import dsm.pick2024.infrastructure.feign.client.NeisFeignClient import dsm.pick2024.infrastructure.feign.client.property.NeisFeignClientRequestProperty -import dsm.pick2024.infrastructure.feign.client.response.NeisFeignClientMealServiceDietInfoResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.NeisFeignClientMealServiceDietInfoResponse import org.springframework.beans.factory.annotation.Value import org.springframework.stereotype.Component import java.time.LocalDate diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt index 53fafa88..a1c4889e 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisScheduleFeignClientService.kt @@ -4,7 +4,7 @@ import com.google.gson.Gson import dsm.pick2024.domain.schedule.entity.ScheduleJpaEntity import dsm.pick2024.infrastructure.feign.client.NeisFeignClient import dsm.pick2024.infrastructure.feign.client.property.NeisFeignClientRequestProperty -import dsm.pick2024.infrastructure.feign.client.response.NeisFeignClientScheduleResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.NeisFeignClientScheduleResponse import java.time.LocalDate import java.time.format.DateTimeFormatter import org.springframework.beans.factory.annotation.Value diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt index 2d44cdf4..91f28279 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/NeisTimetableFeignClientService.kt @@ -4,7 +4,7 @@ import com.google.gson.Gson import dsm.pick2024.domain.timetable.entity.TimetableJpaEntity import dsm.pick2024.infrastructure.feign.client.NeisFeignClient import dsm.pick2024.infrastructure.feign.client.property.NeisFeignClientRequestProperty -import dsm.pick2024.infrastructure.feign.client.response.NeisFeignClientTimetableResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.NeisFeignClientTimetableResponse import java.time.LocalDate import java.time.format.DateTimeFormatter import org.springframework.beans.factory.annotation.Value diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt index f822246b..3f8dbd38 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/XquareFeignClient.kt @@ -1,7 +1,7 @@ package dsm.pick2024.infrastructure.feign.client -import dsm.pick2024.infrastructure.feign.client.response.XquareResponse -import dsm.pick2024.infrastructure.feign.client.response.XquareUserAllResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.XquareResponse +import dsm.pick2024.infrastructure.feign.client.dto.response.XquareUserAllResponse import org.springframework.cloud.openfeign.FeignClient import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RequestParam diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientMealServiceDietInfoResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientMealServiceDietInfoResponse.kt similarity index 86% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientMealServiceDietInfoResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientMealServiceDietInfoResponse.kt index 8ddad955..97a65e67 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientMealServiceDietInfoResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientMealServiceDietInfoResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response data class NeisFeignClientMealServiceDietInfoResponse( val mealServiceDietInfo: List diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientScheduleResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientScheduleResponse.kt similarity index 78% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientScheduleResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientScheduleResponse.kt index 927a2c26..a9ccf341 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientScheduleResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientScheduleResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response data class NeisFeignClientScheduleResponse( val SchoolSchedule: List diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientTimetableResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientTimetableResponse.kt similarity index 86% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientTimetableResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientTimetableResponse.kt index 66afb9ac..6a6375f9 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/NeisFeignClientTimetableResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/NeisFeignClientTimetableResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response data class NeisFeignClientTimetableResponse( val hisTimetable: List diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt similarity index 85% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt index f39415e4..5d0353ef 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response import dsm.pick2024.domain.user.entity.enums.Role import java.time.LocalDate diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareUserAllResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareUserAllResponse.kt similarity index 74% rename from src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareUserAllResponse.kt rename to src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareUserAllResponse.kt index cafe6f1a..60f4ac3f 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/response/XquareUserAllResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareUserAllResponse.kt @@ -1,4 +1,4 @@ -package dsm.pick2024.infrastructure.feign.client.response +package dsm.pick2024.infrastructure.feign.client.dto.response import java.util.UUID From 1655451dcc78e1b1f2dfb415e58b27e065fc185b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 11:01:51 +0900 Subject: [PATCH 23/24] add :: action --- .github/workflows/git-action-prod.yml | 4 ++++ .github/workflows/git-action-stag.yml | 4 ++++ Dockerfile | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/.github/workflows/git-action-prod.yml b/.github/workflows/git-action-prod.yml index 3bf4c790..45f84dc9 100644 --- a/.github/workflows/git-action-prod.yml +++ b/.github/workflows/git-action-prod.yml @@ -57,6 +57,10 @@ jobs: NEIS_KEY=${{ secrets.NEIS_KEY }} WEBHOOK_PROD=${{ secrets.WEBHOOK_PROD }} WEBHOOK_MESSAGE=${{ secrets.WEBHOOK_MESSAGE }} + AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }} + AWS_BUCKET=${{ secrets.AWS_BUCKET }} + AWS_STATIC=${{ secrets.AWS_STATIC }} - name: Discord Alert Success uses: sarisia/actions-status-discord@v1 diff --git a/.github/workflows/git-action-stag.yml b/.github/workflows/git-action-stag.yml index fc0bf2e6..727ecb2b 100644 --- a/.github/workflows/git-action-stag.yml +++ b/.github/workflows/git-action-stag.yml @@ -57,6 +57,10 @@ jobs: NEIS_KEY=${{ secrets.NEIS_KEY }} WEBHOOK_STAG=${{ secrets.WEBHOOK_STAG }} WEBHOOK_MESSAGE=${{ secrets.WEBHOOK_MESSAGE }} + AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }} + AWS_BUCKET=${{ secrets.AWS_BUCKET }} + AWS_STATIC=${{ secrets.AWS_STATIC }} - name: Discord Alert Success uses: sarisia/actions-status-discord@v1 diff --git a/Dockerfile b/Dockerfile index ee32e010..6aec2951 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,6 +54,18 @@ ENV WEBHOOK_STAG ${WEBHOOK_STAG} ARG WEBHOOK_MESSAGE ENV WEBHOOK_MESSAGE ${WEBHOOK_MESSAGE} +ARG AWS_ACCESS_KEY +ENV AWS_ACCESS_KEY ${AWS_ACCESS_KEY} + +ARG AWS_SECRET_KEY +ENV AWS_SECRET_KEY ${AWS_SECRET_KEY} + +ARG AWS_BUCKET +ENV AWS_BUCKET ${AWS_BUCKET} + +ARG AWS_STATIC +ENV AWS_STATIC ${AWS_STATIC} + ARG JAR_FILE=./build/libs/*.jar COPY ${JAR_FILE} application.jar From a6c19bd852db7c94199376a93b8f7bef82f4578f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=8F=84=EA=B2=BD?= Date: Thu, 25 Apr 2024 15:32:13 +0900 Subject: [PATCH 24/24] Merge pull request #142 from DSM-PICK/add-bug-alarm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 버그제보 API 구현 --- .../infrastructure/feign/client/dto/response/XquareResponse.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt index c86976e6..5d0353ef 100644 --- a/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt +++ b/src/main/kotlin/dsm/pick2024/infrastructure/feign/client/dto/response/XquareResponse.kt @@ -1,5 +1,6 @@ package dsm.pick2024.infrastructure.feign.client.dto.response +import dsm.pick2024.domain.user.entity.enums.Role import java.time.LocalDate import java.util.*