Store DOB in guest age and return in booking detail
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s

This commit is contained in:
androidlover5842
2026-02-01 01:55:29 +05:30
parent e68e7c685c
commit 93ac0dbc9e
4 changed files with 13 additions and 0 deletions

View File

@@ -550,6 +550,7 @@ class DocumentExtractionService(
) {
val extractedName = cleanedValue(results[DocumentPrompts.NAME.first])
val extractedAddress = cleanedValue(results[DocumentPrompts.ADDRESS.first])
val extractedDob = cleanedValue(results[DocumentPrompts.DOB.first])
val resolvedCountry = if (results["geoResolved"] != null) "India" else null
val guestIdValue = document.guest.id
if (guestIdValue != null && (extractedName != null || extractedAddress != null)) {
@@ -564,6 +565,13 @@ class DocumentExtractionService(
guestEntity.addressText = extractedAddress
updated = true
}
if (guestEntity.age.isNullOrBlank() && extractedDob != null) {
val dob = parseDob(extractedDob)
if (dob != null) {
guestEntity.age = dob.format(DateTimeFormatter.ofPattern("dd/MM/yyyy"))
updated = true
}
}
if (guestEntity.nationality.isNullOrBlank() && resolvedCountry != null) {
guestEntity.nationality = resolvedCountry
updated = true

View File

@@ -59,6 +59,7 @@ class BookingSnapshotBuilder(
guestPhone = guest?.phoneE164,
guestNationality = guest?.nationality,
guestAddressText = guest?.addressText,
guestAge = guest?.age,
guestSignatureUrl = signatureUrl,
vehicleNumbers = vehicleNumbers,
roomNumbers = roomNumbers,

View File

@@ -84,6 +84,7 @@ data class BookingDetailResponse(
val guestPhone: String?,
val guestNationality: String?,
val guestAddressText: String?,
val guestAge: String?,
val guestSignatureUrl: String?,
val vehicleNumbers: List<String>,
val roomNumbers: List<Int>,

View File

@@ -29,6 +29,9 @@ class Guest(
@Column(name = "address_text")
var addressText: String? = null,
@Column(name = "age")
var age: String? = null,
@Column(name = "signature_path")
var signaturePath: String? = null,