ai removed boilerplate
All checks were successful
build-and-deploy / build-deploy (push) Successful in 31s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 31s
This commit is contained in:
@@ -188,8 +188,8 @@ class Rooms(
|
||||
ResponseStatusException(HttpStatus.NOT_FOUND, "Property not found")
|
||||
}
|
||||
|
||||
val fromDate = parseDate(from)
|
||||
val toDate = parseDate(to)
|
||||
val fromDate = parseDate(from, "Invalid date format")
|
||||
val toDate = parseDate(to, "Invalid date format")
|
||||
if (!toDate.isAfter(fromDate)) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid date range")
|
||||
}
|
||||
@@ -226,8 +226,8 @@ class Rooms(
|
||||
ResponseStatusException(HttpStatus.NOT_FOUND, "Property not found")
|
||||
}
|
||||
|
||||
val fromDate = parseDate(from)
|
||||
val toDate = parseDate(to)
|
||||
val fromDate = parseDate(from, "Invalid date format")
|
||||
val toDate = parseDate(to, "Invalid date format")
|
||||
if (!toDate.isAfter(fromDate)) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid date range")
|
||||
}
|
||||
@@ -392,26 +392,12 @@ class Rooms(
|
||||
roomBoardEvents.emit(propertyId)
|
||||
}
|
||||
|
||||
private fun requirePrincipal(principal: MyPrincipal?) {
|
||||
if (principal == null) {
|
||||
throw ResponseStatusException(HttpStatus.UNAUTHORIZED, "Missing principal")
|
||||
}
|
||||
}
|
||||
|
||||
private fun isAgentOnly(roles: Set<Role>): Boolean {
|
||||
if (!roles.contains(Role.AGENT)) return false
|
||||
val privileged = setOf(Role.ADMIN, Role.MANAGER, Role.STAFF, Role.HOUSEKEEPING, Role.FINANCE)
|
||||
return roles.none { it in privileged }
|
||||
}
|
||||
|
||||
private fun parseDate(value: String): LocalDate {
|
||||
return try {
|
||||
LocalDate.parse(value.trim())
|
||||
} catch (_: Exception) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Invalid date format")
|
||||
}
|
||||
}
|
||||
|
||||
private fun selectRatePlan(plans: List<RatePlan>?, ratePlanCode: String?): RatePlan? {
|
||||
if (plans.isNullOrEmpty()) return null
|
||||
if (!ratePlanCode.isNullOrBlank()) {
|
||||
|
||||
Reference in New Issue
Block a user