ai creates booking
This commit is contained in:
@@ -239,9 +239,12 @@ data class GuestDocumentResponse(
|
||||
|
||||
private fun GuestDocument.toResponse(objectMapper: ObjectMapper): GuestDocumentResponse {
|
||||
val id = id ?: throw ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, "Document id missing")
|
||||
val extracted = extractedData?.let {
|
||||
val extracted: Map<String, String>? = extractedData?.let {
|
||||
try {
|
||||
objectMapper.readValue(it, Map::class.java).mapValues { entry -> entry.value?.toString() ?: "" }
|
||||
val raw = objectMapper.readValue(it, Map::class.java)
|
||||
raw.entries.associate { entry ->
|
||||
entry.key.toString() to (entry.value?.toString() ?: "")
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ class Properties(
|
||||
name = request.name,
|
||||
timezone = request.timezone ?: "Asia/Kolkata",
|
||||
currency = request.currency ?: "INR",
|
||||
active = request.active ?: true
|
||||
active = request.active ?: true,
|
||||
emailAliases = request.emailAliases?.toMutableSet() ?: mutableSetOf()
|
||||
)
|
||||
val saved = propertyRepo.save(property)
|
||||
return saved.toResponse()
|
||||
@@ -205,6 +206,9 @@ class Properties(
|
||||
property.timezone = request.timezone ?: property.timezone
|
||||
property.currency = request.currency ?: property.currency
|
||||
property.active = request.active ?: property.active
|
||||
if (request.emailAliases != null) {
|
||||
property.emailAliases = request.emailAliases.toMutableSet()
|
||||
}
|
||||
|
||||
return propertyRepo.save(property).toResponse()
|
||||
}
|
||||
@@ -241,7 +245,8 @@ private fun Property.toResponse(): PropertyResponse {
|
||||
name = name,
|
||||
timezone = timezone,
|
||||
currency = currency,
|
||||
active = active
|
||||
active = active,
|
||||
emailAliases = emailAliases.toSet()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ data class PropertyCreateRequest(
|
||||
val name: String,
|
||||
val timezone: String? = null,
|
||||
val currency: String? = null,
|
||||
val active: Boolean? = null
|
||||
val active: Boolean? = null,
|
||||
val emailAliases: Set<String>? = null
|
||||
)
|
||||
|
||||
data class PropertyUpdateRequest(
|
||||
@@ -24,7 +25,8 @@ data class PropertyUpdateRequest(
|
||||
val name: String,
|
||||
val timezone: String? = null,
|
||||
val currency: String? = null,
|
||||
val active: Boolean? = null
|
||||
val active: Boolean? = null,
|
||||
val emailAliases: Set<String>? = null
|
||||
)
|
||||
|
||||
data class PropertyResponse(
|
||||
@@ -34,7 +36,8 @@ data class PropertyResponse(
|
||||
val name: String,
|
||||
val timezone: String,
|
||||
val currency: String,
|
||||
val active: Boolean
|
||||
val active: Boolean,
|
||||
val emailAliases: Set<String>
|
||||
)
|
||||
|
||||
data class UserResponse(
|
||||
|
||||
Reference in New Issue
Block a user