Skip to content

Commit

Permalink
refactor: 배치 기록 값 수정 및 추가 (#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 authored Jul 8, 2024
1 parent d109230 commit 768bfff
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class WorkBookSubscriberWriter(
.intoMap(articleIfoT.ARTICLE_MST_ID, articleIfoT.CONTENT)

val memberSuccessRecords = memberIds.associateWith { true }.toMutableMap()
val failRecords = mutableMapOf<String, ArrayList<Long>>()
val failRecords = mutableMapOf<String, ArrayList<Map<Long, String>>>()
// todo check !! target is not null
val emailServiceArgs = items.map {
val toEmail = memberEmailRecords[it.memberId]!!
Expand All @@ -118,7 +118,8 @@ class WorkBookSubscriberWriter(
} catch (e: Exception) {
memberSuccessRecords[it.first] = false
failRecords["EmailSendFail"] = failRecords.getOrDefault("EmailSendFail", arrayListOf()).apply {
add(it.first)
val message = e.message ?: "Unknown Error"
add(mapOf(it.first to message))
}
}
}
Expand Down Expand Up @@ -162,9 +163,9 @@ class WorkBookSubscriberWriter(
.execute()

return if (failRecords.isNotEmpty()) {
mapOf("success" to memberSuccessRecords, "fail" to failRecords)
mapOf("records" to memberSuccessRecords, "fail" to failRecords)
} else {
mapOf("success" to memberSuccessRecords)
mapOf("records" to memberSuccessRecords)
}
}
}

0 comments on commit 768bfff

Please sign in to comment.