From 63402955fb41896702ca8e3a2a0cc182e759633a Mon Sep 17 00:00:00 2001 From: "DESKTOP-USQPRVG\\gram" Date: Fri, 1 Sep 2023 23:28:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20fix=5Fwith=5Ffront1=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=20=EC=82=AC=ED=95=AD=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../csereal/core/research/service/ResearchService.kt | 7 +++++-- .../core/resource/attachment/service/AttachmentService.kt | 4 +++- .../core/resource/mainImage/service/MainImageService.kt | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt index 27f31f4c..96c26303 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/research/service/ResearchService.kt @@ -1,6 +1,7 @@ package com.wafflestudio.csereal.core.research.service import com.wafflestudio.csereal.common.CserealException +import com.wafflestudio.csereal.common.properties.EndpointProperties import com.wafflestudio.csereal.core.member.database.ProfessorRepository import com.wafflestudio.csereal.core.research.database.* import com.wafflestudio.csereal.core.research.dto.* @@ -29,6 +30,7 @@ class ResearchServiceImpl( private val professorRepository: ProfessorRepository, private val mainImageService: MainImageService, private val attachmentService: AttachmentService, + private val endpointProperties: EndpointProperties, ) : ResearchService { @Transactional override fun createResearchDetail(request: ResearchDto, mainImage: MultipartFile?, attachments: List?): ResearchDto { @@ -121,6 +123,7 @@ class ResearchServiceImpl( } if(attachments != null) { + research.attachments.clear() attachmentService.uploadAllAttachments(research, attachments) } @@ -155,7 +158,7 @@ class ResearchServiceImpl( var pdfURL = "" if(pdf != null) { val attachmentDto = attachmentService.uploadAttachmentInLabEntity(newLab, pdf) - pdfURL = "http://cse-dev-waffle.bacchus.io/attachment/${attachmentDto.filename}" + pdfURL = "${endpointProperties.backend}/v1/attachment/${attachmentDto.filename}" } labRepository.save(newLab) @@ -189,6 +192,6 @@ class ResearchServiceImpl( } private fun createPdfURL(pdf: AttachmentEntity) : String{ - return "http://cse-dev-waffle.bacchus.io/attachment/${pdf.filename}" + return "${endpointProperties.backend}/v1/attachment/${pdf.filename}" } } \ No newline at end of file diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/resource/attachment/service/AttachmentService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/resource/attachment/service/AttachmentService.kt index 245d015b..dae88dca 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/resource/attachment/service/AttachmentService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/resource/attachment/service/AttachmentService.kt @@ -1,6 +1,7 @@ package com.wafflestudio.csereal.core.resource.attachment.service import com.wafflestudio.csereal.common.controller.AttachmentContentEntityType +import com.wafflestudio.csereal.common.properties.EndpointProperties import com.wafflestudio.csereal.core.about.database.AboutEntity import com.wafflestudio.csereal.core.academics.database.AcademicsEntity import com.wafflestudio.csereal.core.academics.database.CourseEntity @@ -38,6 +39,7 @@ class AttachmentServiceImpl( private val attachmentRepository: AttachmentRepository, @Value("\${csereal_attachment.upload.path}") private val path: String, + private val endpointProperties: EndpointProperties, ) : AttachmentService { override fun uploadAttachmentInLabEntity(labEntity: LabEntity, requestAttachment: MultipartFile): AttachmentDto { Files.createDirectories(Paths.get(path)) @@ -113,7 +115,7 @@ class AttachmentServiceImpl( for (attachment in attachments) { val attachmentDto = AttachmentResponse( name = attachment.filename, - url = "http://cse-dev-waffle.bacchus.io/attachment/${attachment.filename}", + url = "${endpointProperties.backend}/v1/attachment/${attachment.filename}", bytes = attachment.size, ) list.add(attachmentDto) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/resource/mainImage/service/MainImageService.kt b/src/main/kotlin/com/wafflestudio/csereal/core/resource/mainImage/service/MainImageService.kt index 9abd6eb3..4a6e32eb 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/resource/mainImage/service/MainImageService.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/resource/mainImage/service/MainImageService.kt @@ -29,7 +29,6 @@ interface MainImageService { contentEntityType: MainImageContentEntityType, requestImage: MultipartFile, ): MainImageDto - fun createImageURL(image: MainImageEntity?): String? }