Skip to content

Commit

Permalink
refactor: (#301) Request 개선 적용 - request
Browse files Browse the repository at this point in the history
  • Loading branch information
khcho0125 committed Jan 23, 2023
1 parent e0ae7c9 commit 3042bbd
Show file tree
Hide file tree
Showing 23 changed files with 175 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package team.comit.simtong.domain.common.dto

import team.comit.simtong.domain.user.dto.request.ChangePasswordData
import team.comit.simtong.domain.user.model.Password
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern

/**
Expand All @@ -13,15 +14,18 @@ import javax.validation.constraints.Pattern
* @version 1.2.5
**/
data class ChangePasswordRequest(

@field:NotNull
@field:Pattern(regexp = Password.PATTERN)
val password: String,
val password: String?,

@field:NotNull
@field:Pattern(regexp = Password.PATTERN)
val newPassword: String
val newPassword: String?
) {

fun toData() = ChangePasswordData(
password = password,
newPassword = newPassword
password = password!!,
newPassword = newPassword!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import team.comit.simtong.domain.user.dto.request.FindEmployeeNumberData
import java.util.UUID
import javax.validation.constraints.Email
import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotEmpty
import javax.validation.constraints.NotNull

/**
Expand All @@ -15,20 +16,21 @@ import javax.validation.constraints.NotNull
* @version 1.2.5
**/
data class FindEmployeeNumberRequest(

@field:NotBlank
val name: String,
val name: String?,

@field:NotNull
val spotId: UUID,
val spotId: UUID?,

@field:NotBlank
@field:NotEmpty
@field:Email
val email: String
val email: String?
) {

fun toData() = FindEmployeeNumberData(
name = name,
spotId = spotId,
email = email
name = name!!,
spotId = spotId!!,
email = email!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import team.comit.simtong.domain.user.dto.request.ResetPasswordData
import team.comit.simtong.domain.user.model.EmployeeNumber
import team.comit.simtong.domain.user.model.Password
import javax.validation.constraints.Email
import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotEmpty
import javax.validation.constraints.NotNull
import javax.validation.constraints.Pattern

/**
Expand All @@ -17,20 +18,23 @@ import javax.validation.constraints.Pattern
* @version 1.2.5
**/
data class ResetPasswordRequest(
@field:NotBlank

@field:NotEmpty
@field:Email
val email: String,
val email: String?,

@field:NotNull
@field:Range(min = EmployeeNumber.MIN_VALUE, max = EmployeeNumber.MAX_VALUE)
val employeeNumber: Int,
val employeeNumber: Int?,

@field:NotNull
@field:Pattern(regexp = Password.PATTERN)
val newPassword: String
val newPassword: String?
) {

fun toData() = ResetPasswordData(
email = email,
employeeNumber = employeeNumber,
newPassword = newPassword
email = email!!,
employeeNumber = employeeNumber!!,
newPassword = newPassword!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package team.comit.simtong.domain.email.dto
import org.hibernate.validator.constraints.Length
import team.comit.simtong.domain.auth.dto.request.CheckAuthCodeData
import javax.validation.constraints.Email
import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotEmpty
import javax.validation.constraints.NotNull

/**
*
Expand All @@ -14,17 +15,18 @@ import javax.validation.constraints.NotBlank
* @version 1.2.5
**/
data class CheckAuthCodeRequest(
@field:NotBlank

@field:NotEmpty
@field:Email
val email: String,
val email: String?,

@field:NotBlank
@field:NotNull
@field:Length(min = 6, max = 6)
val code: String
val code: String?
) {

fun toData() = CheckAuthCodeData(
email = email,
code = code
email = email!!,
code = code!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package team.comit.simtong.domain.email.dto
import team.comit.simtong.domain.auth.dto.request.SendAuthCodeData
import javax.validation.constraints.Email
import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotEmpty

/**
*
Expand All @@ -13,12 +14,13 @@ import javax.validation.constraints.NotBlank
* @version 1.2.5
**/
data class SendAuthCodeRequest(
@field:NotBlank

@field:NotEmpty
@field:Email
val email: String
val email: String?
) {

fun toData() = SendAuthCodeData(
email = email
email = email!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package team.comit.simtong.domain.holiday.dto

import team.comit.simtong.domain.holiday.dto.request.AppointAnnualData
import java.time.LocalDate
import javax.validation.constraints.NotNull

/**
*
Expand All @@ -12,10 +13,12 @@ import java.time.LocalDate
* @version 1.2.5
**/
data class AppointAnnualRequest(
val date: LocalDate

@field:NotNull
val date: LocalDate?
) {

fun toData() = AppointAnnualData(
date = date
date = date!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@ import javax.validation.constraints.NotNull
* @version 1.2.5
**/
data class AppointHolidayPeriodRequest(

@field:NotNull
val year: Int,
val year: Int?,

@field:NotNull
@field:Range(
min = 1,
max = 12
)
val month: Int,
val month: Int?,

val startAt: LocalDate,
@field:NotNull
val startAt: LocalDate?,

val endAt: LocalDate
@field:NotNull
val endAt: LocalDate?
) {

fun toData() = AppointHolidayPeriodData(
year = year,
month = month,
startAt = startAt,
endAt = endAt
year = year!!,
month = month!!,
startAt = startAt!!,
endAt = endAt!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package team.comit.simtong.domain.holiday.dto

import team.comit.simtong.domain.holiday.dto.request.AppointHolidayData
import java.time.LocalDate
import javax.validation.constraints.NotNull

/**
*
Expand All @@ -12,10 +13,12 @@ import java.time.LocalDate
* @version 1.2.5
**/
data class AppointHolidayRequest(
val date: LocalDate

@field:NotNull
val date: LocalDate?
) {

fun toData() = AppointHolidayData(
date = date
date = date!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package team.comit.simtong.domain.holiday.dto

import team.comit.simtong.domain.holiday.dto.request.CancelHolidayData
import java.time.LocalDate
import javax.validation.constraints.NotNull

/**
*
Expand All @@ -13,10 +14,12 @@ import java.time.LocalDate
* @version 1.2.5
**/
data class CancelHolidayRequest(
val date: LocalDate

@field:NotNull
val date: LocalDate?
) {

fun toData() = CancelHolidayData(
date = date
date = date!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package team.comit.simtong.domain.holiday.dto
import team.comit.simtong.domain.holiday.dto.request.ChangeEmployeeHolidayData
import java.time.LocalDate
import java.util.UUID
import javax.validation.constraints.NotNull

/**
*
Expand All @@ -14,16 +15,20 @@ import java.util.UUID
* @version 1.2.5
**/
data class ChangeEmployeeHolidayRequest(
val beforeDate: LocalDate,

val userId: UUID,
@field:NotNull
val beforeDate: LocalDate?,

val afterDate: LocalDate
@field:NotNull
val userId: UUID?,

@field:NotNull
val afterDate: LocalDate?
) {

fun toData() = ChangeEmployeeHolidayData(
beforeDate = beforeDate,
userId = userId,
afterDate = afterDate
beforeDate = beforeDate!!,
userId = userId!!,
afterDate = afterDate!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import javax.validation.constraints.NotNull
data class ShareHolidayRequest(

@field:NotNull
val year: Int,
val year: Int?,

@field:NotNull
val month: Int
val month: Int?
) {

fun toData() = ShareHolidayData(
year = year,
month = month
year = year!!,
month = month!!
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ import javax.validation.constraints.NotNull
* @version 1.2.5
**/
data class SaveMenuRequest(
val file: MultipartFile,

@field:NotNull
val year: Int,
val file: MultipartFile?,

@field:NotNull
val month: Int
val year: Int?,

@field:NotNull
val month: Int?
) {

fun toData() = SaveMenuData(
file = file.let(ExcelFileConverter::transferTo),
year = year,
month = month
file = file!!.let(ExcelFileConverter::transferTo),
year = year!!,
month = month!!
)
}
Loading

0 comments on commit 3042bbd

Please sign in to comment.