From d6cc2658709b8bc54bf67c8463540651e0dceab7 Mon Sep 17 00:00:00 2001 From: 4mjeo <4mj.eo@dsm.hs.kr> Date: Tue, 27 Feb 2024 20:11:18 +0900 Subject: [PATCH] =?UTF-8?q?refactor=20::=20null=20=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/project/service/ProjectServiceImpl.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/example/mergebackend/domain/project/service/ProjectServiceImpl.kt b/src/main/kotlin/com/example/mergebackend/domain/project/service/ProjectServiceImpl.kt index 870fc7e..83456fa 100644 --- a/src/main/kotlin/com/example/mergebackend/domain/project/service/ProjectServiceImpl.kt +++ b/src/main/kotlin/com/example/mergebackend/domain/project/service/ProjectServiceImpl.kt @@ -36,8 +36,12 @@ class ProjectServiceImpl ( val logoUrl = logo.let { fileService.upload(it, req.projectNameEn).url } ?: "" val projectImageUrls = projectImage?.let { - fileService.uploads(it, req.projectNameEn).files.map { fileResponse -> fileResponse.url } - } ?: emptyList() + if (it.isNotEmpty()) { + fileService.uploads(it, req.projectNameEn).files.map { fileResponse -> fileResponse.url } + }else { + null + } + } val project = Project( null, @@ -79,8 +83,12 @@ class ProjectServiceImpl ( val logoUrl = fileService.upload(logo, project.projectNameEn).url val projectImageUrl = projectImage?.let { - fileService.uploads(it, project.projectNameEn).files.map {fileUrlResponse -> fileUrlResponse.url } - } ?: project.projectImage + if (it.isNotEmpty()) { + fileService.uploads(it, project.projectNameEn).files.map {fileUrlResponse -> fileUrlResponse.url } + } else { + project.projectImage + } + } return projectRepository.save(Project( projectId,