Remove org model; make AppUser global with super admin
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 27s
This commit is contained in:
@@ -51,8 +51,8 @@ class GuestRatings(
|
||||
val guest = guestRepo.findById(guestId).orElseThrow {
|
||||
ResponseStatusException(HttpStatus.NOT_FOUND, "Guest not found")
|
||||
}
|
||||
if (guest.org.id != property.org.id) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Guest not in property org")
|
||||
if (guest.property.id != property.id) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Guest not in property")
|
||||
}
|
||||
|
||||
val booking = bookingRepo.findById(request.bookingId).orElseThrow {
|
||||
@@ -70,7 +70,6 @@ class GuestRatings(
|
||||
|
||||
val score = parseScore(request.score)
|
||||
val rating = GuestRating(
|
||||
org = property.org,
|
||||
property = property,
|
||||
guest = guest,
|
||||
booking = booking,
|
||||
@@ -97,8 +96,8 @@ class GuestRatings(
|
||||
val guest = guestRepo.findById(guestId).orElseThrow {
|
||||
ResponseStatusException(HttpStatus.NOT_FOUND, "Guest not found")
|
||||
}
|
||||
if (guest.org.id != property.org.id) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Guest not in property org")
|
||||
if (guest.property.id != property.id) {
|
||||
throw ResponseStatusException(HttpStatus.BAD_REQUEST, "Guest not in property")
|
||||
}
|
||||
|
||||
return guestRatingRepo.findByGuestIdOrderByCreatedAtDesc(guestId).map { it.toResponse() }
|
||||
@@ -117,7 +116,6 @@ class GuestRatings(
|
||||
private fun GuestRating.toResponse(): GuestRatingResponse {
|
||||
return GuestRatingResponse(
|
||||
id = id!!,
|
||||
orgId = org.id!!,
|
||||
propertyId = property.id!!,
|
||||
guestId = guest.id!!,
|
||||
bookingId = booking.id!!,
|
||||
|
||||
Reference in New Issue
Block a user