Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge: (#204) 지점 + 개인 일정 보기 변경사항 #206

Merged
merged 3 commits into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package team.comit.simtong.domain.schedule.dto

import team.comit.simtong.domain.schedule.model.Scope
import java.time.LocalDate
import java.util.UUID

Expand Down Expand Up @@ -30,5 +31,7 @@ data class ScheduleResponse(

val endAt: LocalDate,

val title: String
val title: String,

val scope: Scope
)
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ class QueryIndividualSpotScheduleUseCase(
)

val ownSpotSchedules = querySchedulePort.querySchedulesByMonthAndSpotIdAndScope(
date, user.spotId, Scope.INDIVIDUAL
date, user.spotId, Scope.ENTIRE
)

val schedules = ownSpotSchedules.union(individualSchedules) // 개인 일정과 소속 지점 일정 합치면서 중복 제거
val schedules = (ownSpotSchedules + individualSchedules) // 개인 일정과 소속 지점 일정 합치기
khcho0125 marked this conversation as resolved.
Show resolved Hide resolved
.sortedBy { it.startAt } // 시작일 기준 오름차순으로 정렬

val response = schedules.map {
ScheduleResponse(
id = it.id,
startAt = it.startAt,
endAt = it.endAt,
title = it.title
title = it.title,
scope = it.scope
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import team.comit.simtong.domain.user.model.Authority
import team.comit.simtong.domain.user.model.User
import team.comit.simtong.global.annotation.SimtongTest
import java.time.LocalDate
import java.util.*
import java.util.UUID

@SimtongTest
class QueryIndividualSpotScheduleUseCaseTests {
Expand All @@ -36,6 +36,10 @@ class QueryIndividualSpotScheduleUseCaseTests {

private val date: LocalDate = LocalDate.now()

private val minDate: LocalDate = LocalDate.MIN

private val maxDate: LocalDate = LocalDate.MAX

private val userId: UUID = UUID.randomUUID()

private val spotId: UUID = UUID.randomUUID()
Expand All @@ -57,15 +61,28 @@ class QueryIndividualSpotScheduleUseCaseTests {
)
}

private val scheduleStub: Schedule by lazy {
private val individualScheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
startAt = date,
endAt = date,
startAt = minDate,
endAt = minDate,
alarmTime = Schedule.DEFAULT_ALARM_TIME
)
}

private val entireScheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
spotId = spotId,
title = "test title",
scope = Scope.ENTIRE,
startAt = maxDate,
endAt = maxDate,
alarmTime = Schedule.DEFAULT_ALARM_TIME
)
}
Expand All @@ -75,9 +92,17 @@ class QueryIndividualSpotScheduleUseCaseTests {
listOf(
ScheduleResponse(
id = scheduleId,
startAt = date,
endAt = date,
title = "test title"
startAt = minDate,
endAt = minDate,
title = "test title",
scope = Scope.INDIVIDUAL
),
ScheduleResponse(
id = scheduleId,
startAt = maxDate,
endAt = maxDate,
title = "test title",
Scope.ENTIRE
)
)
)
Expand All @@ -101,12 +126,12 @@ class QueryIndividualSpotScheduleUseCaseTests {

given(querySchedulePort.querySchedulesByMonthAndUserIdAndScope(date, userStub.id, Scope.INDIVIDUAL))
.willReturn(
listOf(scheduleStub)
listOf(individualScheduleStub)
)

given(querySchedulePort.querySchedulesByMonthAndSpotIdAndScope(date, userStub.spotId, Scope.INDIVIDUAL))
given(querySchedulePort.querySchedulesByMonthAndSpotIdAndScope(date, userStub.spotId, Scope.ENTIRE))
.willReturn(
listOf(scheduleStub)
listOf(entireScheduleStub)
)

// when
Expand Down