Add amenity category and icon fields
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:
@@ -60,7 +60,10 @@ class RoomAmenities(
|
||||
}
|
||||
val amenity = RoomAmenity(
|
||||
property = property,
|
||||
name = request.name
|
||||
name = request.name,
|
||||
category = request.category,
|
||||
iconKey = request.iconKey,
|
||||
description = request.description
|
||||
)
|
||||
return roomAmenityRepo.save(amenity).toResponse()
|
||||
}
|
||||
@@ -84,6 +87,9 @@ class RoomAmenities(
|
||||
}
|
||||
|
||||
amenity.name = request.name
|
||||
amenity.category = request.category ?: amenity.category
|
||||
amenity.iconKey = request.iconKey ?: amenity.iconKey
|
||||
amenity.description = request.description ?: amenity.description
|
||||
return roomAmenityRepo.save(amenity).toResponse()
|
||||
}
|
||||
|
||||
@@ -117,6 +123,9 @@ private fun RoomAmenity.toResponse(): AmenityResponse {
|
||||
return AmenityResponse(
|
||||
id = id,
|
||||
propertyId = propertyId,
|
||||
name = name
|
||||
name = name,
|
||||
category = category,
|
||||
iconKey = iconKey,
|
||||
description = description
|
||||
)
|
||||
}
|
||||
|
||||
@@ -173,6 +173,9 @@ private fun RoomAmenity.toResponse(): com.android.trisolarisserver.controller.dt
|
||||
return com.android.trisolarisserver.controller.dto.AmenityResponse(
|
||||
id = id,
|
||||
propertyId = propertyId,
|
||||
name = name
|
||||
name = name,
|
||||
category = category,
|
||||
iconKey = iconKey,
|
||||
description = description
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,11 +27,17 @@ data class RoomTypeResponse(
|
||||
)
|
||||
|
||||
data class AmenityUpsertRequest(
|
||||
val name: String
|
||||
val name: String,
|
||||
val category: String? = null,
|
||||
val iconKey: String? = null,
|
||||
val description: String? = null
|
||||
)
|
||||
|
||||
data class AmenityResponse(
|
||||
val id: UUID,
|
||||
val propertyId: UUID,
|
||||
val name: String
|
||||
val name: String,
|
||||
val category: String?,
|
||||
val iconKey: String?,
|
||||
val description: String?
|
||||
)
|
||||
|
||||
@@ -31,6 +31,15 @@ class RoomAmenity(
|
||||
@Column(nullable = false)
|
||||
var name: String,
|
||||
|
||||
@Column
|
||||
var category: String? = null,
|
||||
|
||||
@Column(name = "icon_key")
|
||||
var iconKey: String? = null,
|
||||
|
||||
@Column
|
||||
var description: String? = null,
|
||||
|
||||
@Column(name = "created_at", nullable = false, columnDefinition = "timestamptz")
|
||||
val createdAt: OffsetDateTime = OffsetDateTime.now()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user