Skip to content

Commit

Permalink
feat: simple response에 diseaseId추가
Browse files Browse the repository at this point in the history
  • Loading branch information
HyungJu committed May 15, 2024
1 parent 5a455b7 commit b862637
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.vacgom.backend.inoculation.application

import com.vacgom.backend.disease.application.DiseaseService
import com.vacgom.backend.global.exception.error.BusinessException
import com.vacgom.backend.global.exception.error.GlobalError
import com.vacgom.backend.inoculation.application.dto.request.DiseaseNameRequest
Expand Down Expand Up @@ -33,6 +34,7 @@ class InoculationService(
private val notificationService: NotificationService,
private val log: Logger,
@Value("\${image-gen.url}") private val imageGenUrl: String,
private val diseaseService: DiseaseService,
) {
fun getInoculationSimpleResponse(
memberId: UUID,
Expand Down Expand Up @@ -61,12 +63,17 @@ class InoculationService(
hashMap[vaccineName]!!.add(inoculationOrder)
}

val diseases = diseaseService.findAll()

return vaccinations.map { vaccination ->
val vaccineOrders = hashMap[vaccination.vaccineName]?.toHashSet()?.toList() ?: listOf()
val isCompleted = vaccineOrders.any { order -> order == vaccination.maxOrder }

val disease = diseases.find { vaccination.diseaseName.contains(it.name) }

InoculationSimpleResponse(
vaccination.id.toString(),
disease?.id,
vaccination.diseaseName,
vaccination.vaccineName,
vaccination.minOrder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.vacgom.backend.inoculation.application.dto.response

data class InoculationSimpleResponse(
val vaccineId: String,
val diseaseId: Long?,
val diseaseName: String,
val vaccineName: String,
val minOrder: Long,
Expand Down

0 comments on commit b862637

Please sign in to comment.