Skip to content

Commit

Permalink
refactor: (#286) 직원 명시
Browse files Browse the repository at this point in the history
  • Loading branch information
softpeanut committed Jan 10, 2023
1 parent ffddcb0 commit 729ecb0
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class AppointAnnualUseCaseTests {
date = date,
spotId = id,
type = HolidayType.ANNUAL,
userId = id,
employeeId = id,
status = HolidayStatus.COMPLETED
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CancelHolidayUseCaseTests {
// given
val holidayStub = Holiday(
date = date,
userId = id,
employeeId = id,
type = HolidayType.HOLIDAY,
spotId = id,
status = HolidayStatus.WRITTEN
Expand All @@ -72,7 +72,7 @@ class CancelHolidayUseCaseTests {
// given
val holidayStub = Holiday(
date = date,
userId = id,
employeeId = id,
type = HolidayType.HOLIDAY,
spotId = id,
status = HolidayStatus.COMPLETED
Expand All @@ -95,7 +95,7 @@ class CancelHolidayUseCaseTests {
// given
val holidayStub = Holiday(
date = LocalDate.MAX,
userId = id,
employeeId = id,
type = HolidayType.ANNUAL,
spotId = id,
status = HolidayStatus.COMPLETED
Expand All @@ -118,7 +118,7 @@ class CancelHolidayUseCaseTests {
// given
val holidayStub = Holiday(
date = LocalDate.MIN,
userId = id,
employeeId = id,
type = HolidayType.ANNUAL,
spotId = id,
status = HolidayStatus.COMPLETED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ChangeEmployeeHolidayUseCaseTests {
private val holidayStub: Holiday by lazy {
Holiday(
date = beforeDate,
userId = userId,
employeeId = userId,
type = HolidayType.HOLIDAY,
spotId = spotId,
status = HolidayStatus.COMPLETED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class QueryIndividualHolidayUseCaseTests {
listOf(
Holiday(
date = LocalDate.now(),
userId = userId,
employeeId = userId,
type = HolidayType.HOLIDAY,
spotId = UUID.randomUUID(),
status = HolidayStatus.COMPLETED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ShareHolidayUseCaseTests {
listOf(
Holiday(
date = LocalDate.of(2022, 12, 1),
userId = userId,
employeeId = userId,
type = HolidayType.HOLIDAY,
spotId = spotId,
status = HolidayStatus.COMPLETED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ChangeIndividualScheduleUseCaseTest {
private val scheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ChangeSpotScheduleUseCaseTests {
private val scheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.ENTIRE,
Expand Down Expand Up @@ -125,7 +125,7 @@ class ChangeSpotScheduleUseCaseTests {

val individualScheduleStub = Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class QueryIndividualSpotScheduleUseCaseTests {
private val individualScheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
Expand All @@ -77,7 +77,7 @@ class QueryIndividualSpotScheduleUseCaseTests {
private val entireScheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.ENTIRE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RemoveIndividualScheduleUseCaseTests {
private val scheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
Expand Down Expand Up @@ -150,7 +150,7 @@ class RemoveIndividualScheduleUseCaseTests {
// given
val scheduleStub = Schedule(
id = scheduleId,
userId = UUID.randomUUID(),
employeeId = UUID.randomUUID(),
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
Expand Down Expand Up @@ -179,7 +179,7 @@ class RemoveIndividualScheduleUseCaseTests {
// given
val scheduleStub = Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.ENTIRE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class RemoveSpotScheduleUseCaseTests {
private val scheduleStub: Schedule by lazy {
Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.ENTIRE,
Expand Down Expand Up @@ -177,7 +177,7 @@ class RemoveSpotScheduleUseCaseTests {

val scheduleStub = Schedule(
id = scheduleId,
userId = userId,
employeeId = userId,
spotId = spotId,
title = "test title",
scope = Scope.INDIVIDUAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.UUID
data class Holiday(
val date: LocalDate,

val userId: UUID,
val employeeId: UUID,

val type: HolidayType,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import java.util.UUID
data class Schedule(
val id: UUID,

val userId: UUID,
val employeeId: UUID,

val spotId: UUID,

Expand Down Expand Up @@ -50,7 +50,7 @@ data class Schedule(
alarmTime: LocalTime = DEFAULT_ALARM_TIME
) = Schedule(
id = id,
userId = userId,
employeeId = userId,
spotId = spotId,
title = title,
scope = scope,
Expand Down Expand Up @@ -95,7 +95,7 @@ data class Schedule(
}

fun checkOwner(userId: UUID) {
if (this.userId != userId) {
if (this.employeeId != userId) {
throw ScheduleExceptions.NotScheduleOwner()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class HolidayMapper(
) : GenericMapper<HolidayJpaEntity, Holiday> {

override fun toEntity(model: Holiday): HolidayJpaEntity {
val user = userJpaRepository.findByIdOrNull(model.userId)!!
val user = userJpaRepository.findByIdOrNull(model.employeeId)!!
val spot = spotJpaRepository.findByIdOrNull(model.spotId)!!

return HolidayJpaEntity(
id = HolidayJpaEntity.Id(
userId = model.userId,
userId = model.employeeId,
date = model.date
),
type = model.type,
Expand All @@ -44,7 +44,7 @@ class HolidayMapper(
val id = it.id
Holiday(
date = id.date,
userId = id.userId,
employeeId = id.userId,
type = it.type,
spotId = it.spot.id!!,
status = it.status
Expand All @@ -56,7 +56,7 @@ class HolidayMapper(
val id = entity.id
return Holiday(
date = id.date,
userId = id.userId,
employeeId = id.userId,
type = entity.type,
spotId = entity.spot.id!!,
status = entity.status
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ScheduleMapper(
) : GenericMapper<ScheduleJpaEntity, Schedule> {

override fun toEntity(model: Schedule): ScheduleJpaEntity {
val user = userJpaRepository.findByIdOrNull(model.userId)!!
val user = userJpaRepository.findByIdOrNull(model.employeeId)!!
val spot = spotJpaRepository.findByIdOrNull(model.spotId)!!

return ScheduleJpaEntity(
Expand All @@ -43,7 +43,7 @@ class ScheduleMapper(
return entity?.let {
Schedule(
id = it.id!!,
userId = it.user.id!!,
employeeId = it.user.id!!,
spotId = it.spot.id!!,
title = it.title,
scope = it.scope,
Expand All @@ -57,7 +57,7 @@ class ScheduleMapper(
override fun toDomainNotNull(entity: ScheduleJpaEntity): Schedule {
return Schedule(
id = entity.id!!,
userId = entity.user.id!!,
employeeId = entity.user.id!!,
spotId = entity.spot.id!!,
title = entity.title,
scope = entity.scope,
Expand Down

0 comments on commit 729ecb0

Please sign in to comment.