Skip to content

Commit ec3b803

Browse files
committed
delete: test set
1 parent 89d238d commit ec3b803

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

src/main/kotlin/gogo/gogobetting/domain/batch/root/application/BatchServiceImpl.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ class BatchServiceImpl(
2323
) : BatchService {
2424

2525
override fun batch(matchId: Long, dto: BatchDto) {
26-
// val studentId = userUtil.getCurrentStudent().studentId
27-
//
28-
// val isEmptyBetting = batchValidator.valid(matchId, studentId, dto)
29-
//
30-
// if (isEmptyBetting) {
31-
// batchProcessor.emptyBettingBatch(matchId, dto, studentId, isEmptyBetting)
32-
// return
33-
// }
26+
val studentId = userUtil.getCurrentStudent().studentId
27+
28+
val isEmptyBetting = batchValidator.valid(matchId, studentId, dto)
29+
30+
if (isEmptyBetting) {
31+
batchProcessor.emptyBettingBatch(matchId, dto, studentId, isEmptyBetting)
32+
return
33+
}
3434

3535
val bettingOdds = batchReader.readBettingOdds(matchId, dto.winTeamId)
3636

src/main/kotlin/gogo/gogobetting/global/config/SecurityConfig.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ class SecurityConfig(
5858
httpRequests.requestMatchers(HttpMethod.POST, "/betting/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
5959

6060
// batch
61-
// httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
62-
httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/{match_id}").permitAll()
61+
httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
6362
httpRequests.requestMatchers(HttpMethod.POST, "/betting/batch/cancel/{match_id}").hasAnyRole(Authority.USER.name, Authority.STAFF.name)
6463

6564
// server to server

src/main/kotlin/gogo/gogobetting/infra/batch/service/BettingResultWriter.kt

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package gogo.gogobetting.infra.batch.service
22

33
import gogo.gogobetting.domain.batch.detail.persistence.BatchDetail
44
import gogo.gogobetting.domain.batch.detail.persistence.BatchDetailRepository
5+
import gogo.gogobetting.domain.batch.root.event.MatchBatchEvent
6+
import gogo.gogobetting.domain.batch.root.event.StudentBettingDto
57
import gogo.gogobetting.domain.batch.root.persistence.BatchRepository
68
import gogo.gogobetting.domain.betting.result.persistence.BettingResultTable
79
import gogo.gogobetting.domain.betting.root.persistence.BettingRepository
@@ -21,6 +23,7 @@ import org.springframework.batch.item.ItemWriter
2123
import org.springframework.beans.factory.annotation.Value
2224
import org.springframework.data.repository.findByIdOrNull
2325
import org.springframework.stereotype.Component
26+
import java.util.*
2427
import javax.sql.DataSource
2528
import kotlin.math.ceil
2629

@@ -86,23 +89,23 @@ class BettingResultWriter(
8689
)
8790
)
8891

89-
// val successList = accumulated.filter { it.isPredicted }
90-
// .map {
91-
// val studentId = bettingRepository.findByIdOrNull(it.bettingId)!!.studentId
92-
// StudentBettingDto(studentId, it.earnedPoint)
93-
// }
94-
//
95-
// val event = MatchBatchEvent(
96-
// id = UUID.randomUUID().toString(),
97-
// batchId = batchId,
98-
// matchId = matchId,
99-
// victoryTeamId = winTeamId,
100-
// aTeamScore = aTeamScore,
101-
// bTeamScore = bTeamScore,
102-
// students = successList
103-
// )
104-
//
105-
// log.info("published betting batch application event: {}", event.id)
106-
// batchPublisher.publishBettingBatchEvent(event)
92+
val successList = accumulated.filter { it.isPredicted }
93+
.map {
94+
val studentId = bettingRepository.findByIdOrNull(it.bettingId)!!.studentId
95+
StudentBettingDto(studentId, it.earnedPoint)
96+
}
97+
98+
val event = MatchBatchEvent(
99+
id = UUID.randomUUID().toString(),
100+
batchId = batchId,
101+
matchId = matchId,
102+
victoryTeamId = winTeamId,
103+
aTeamScore = aTeamScore,
104+
bTeamScore = bTeamScore,
105+
students = successList
106+
)
107+
108+
log.info("published betting batch application event: {}", event.id)
109+
batchPublisher.publishBettingBatchEvent(event)
107110
}
108111
}

0 commit comments

Comments
 (0)