Skip to content

Commit

Permalink
fix: fix_with_front1 변경 사항에 맞게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
skfotakf committed Sep 1, 2023
1 parent fa44f43 commit 6340295
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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.*
Expand Down Expand Up @@ -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<MultipartFile>?): ResearchDto {
Expand Down Expand Up @@ -121,6 +123,7 @@ class ResearchServiceImpl(
}

if(attachments != null) {
research.attachments.clear()
attachmentService.uploadAllAttachments(research, attachments)
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}"
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ interface MainImageService {
contentEntityType: MainImageContentEntityType,
requestImage: MultipartFile,
): MainImageDto

fun createImageURL(image: MainImageEntity?): String?
}

Expand Down

0 comments on commit 6340295

Please sign in to comment.