Attach room type code and tags to room images
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:
@@ -59,7 +59,8 @@ class RoomImages(
|
|||||||
@AuthenticationPrincipal principal: MyPrincipal?,
|
@AuthenticationPrincipal principal: MyPrincipal?,
|
||||||
@RequestParam("file") file: MultipartFile,
|
@RequestParam("file") file: MultipartFile,
|
||||||
@RequestParam(required = false) sortOrder: Int?,
|
@RequestParam(required = false) sortOrder: Int?,
|
||||||
@RequestParam(required = false) category: String?
|
@RequestParam(required = false) category: String?,
|
||||||
|
@RequestParam(required = false) tags: List<String>?
|
||||||
): RoomImageResponse {
|
): RoomImageResponse {
|
||||||
requirePrincipal(principal)
|
requirePrincipal(principal)
|
||||||
propertyAccess.requireMember(propertyId, principal!!.userId)
|
propertyAccess.requireMember(propertyId, principal!!.userId)
|
||||||
@@ -82,6 +83,8 @@ class RoomImages(
|
|||||||
thumbnailPath = stored.thumbnailPath,
|
thumbnailPath = stored.thumbnailPath,
|
||||||
contentType = stored.contentType,
|
contentType = stored.contentType,
|
||||||
sizeBytes = stored.sizeBytes,
|
sizeBytes = stored.sizeBytes,
|
||||||
|
roomTypeCode = room.roomType.code,
|
||||||
|
tags = tags?.toMutableSet() ?: mutableSetOf(),
|
||||||
sortOrder = sortOrder,
|
sortOrder = sortOrder,
|
||||||
category = category
|
category = category
|
||||||
)
|
)
|
||||||
@@ -134,10 +137,12 @@ private fun RoomImage.toResponse(baseUrl: String): RoomImageResponse {
|
|||||||
id = id,
|
id = id,
|
||||||
propertyId = property.id!!,
|
propertyId = property.id!!,
|
||||||
roomId = room.id!!,
|
roomId = room.id!!,
|
||||||
|
roomTypeCode = roomTypeCode,
|
||||||
url = "$baseUrl/properties/${property.id}/rooms/${room.id}/images/$id/file",
|
url = "$baseUrl/properties/${property.id}/rooms/${room.id}/images/$id/file",
|
||||||
thumbnailUrl = "$baseUrl/properties/${property.id}/rooms/${room.id}/images/$id/file?size=thumb",
|
thumbnailUrl = "$baseUrl/properties/${property.id}/rooms/${room.id}/images/$id/file?size=thumb",
|
||||||
contentType = contentType,
|
contentType = contentType,
|
||||||
sizeBytes = sizeBytes,
|
sizeBytes = sizeBytes,
|
||||||
|
tags = tags.toSet(),
|
||||||
sortOrder = sortOrder,
|
sortOrder = sortOrder,
|
||||||
category = category,
|
category = category,
|
||||||
createdAt = createdAt.toString()
|
createdAt = createdAt.toString()
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ data class RoomImageResponse(
|
|||||||
val id: UUID,
|
val id: UUID,
|
||||||
val propertyId: UUID,
|
val propertyId: UUID,
|
||||||
val roomId: UUID,
|
val roomId: UUID,
|
||||||
|
val roomTypeCode: String?,
|
||||||
val url: String,
|
val url: String,
|
||||||
val thumbnailUrl: String,
|
val thumbnailUrl: String,
|
||||||
val contentType: String,
|
val contentType: String,
|
||||||
val sizeBytes: Long,
|
val sizeBytes: Long,
|
||||||
|
val tags: Set<String>,
|
||||||
val sortOrder: Int?,
|
val sortOrder: Int?,
|
||||||
val category: String?,
|
val category: String?,
|
||||||
val createdAt: String
|
val createdAt: String
|
||||||
|
|||||||
@@ -33,6 +33,17 @@ class RoomImage(
|
|||||||
@Column(name = "size_bytes", nullable = false)
|
@Column(name = "size_bytes", nullable = false)
|
||||||
var sizeBytes: Long,
|
var sizeBytes: Long,
|
||||||
|
|
||||||
|
@Column(name = "room_type_code")
|
||||||
|
var roomTypeCode: String? = null,
|
||||||
|
|
||||||
|
@ElementCollection(fetch = FetchType.EAGER)
|
||||||
|
@CollectionTable(
|
||||||
|
name = "room_image_tag",
|
||||||
|
joinColumns = [JoinColumn(name = "room_image_id")]
|
||||||
|
)
|
||||||
|
@Column(name = "tag", nullable = false)
|
||||||
|
var tags: MutableSet<String> = mutableSetOf(),
|
||||||
|
|
||||||
@Column(name = "sort_order")
|
@Column(name = "sort_order")
|
||||||
var sortOrder: Int? = null,
|
var sortOrder: Int? = null,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user