Add expected guest count on booking
Some checks failed
build-and-deploy / build-deploy (push) Failing after 27s

This commit is contained in:
androidlover5842
2026-01-29 09:34:32 +05:30
parent 5214584b3c
commit f342b229f4
4 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package com.android.trisolarisserver.config
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.stereotype.Component
@Component
class BookingSchemaFix(
private val jdbcTemplate: JdbcTemplate
) : PostgresSchemaFix(jdbcTemplate) {
override fun runPostgres(jdbcTemplate: JdbcTemplate) {
val hasExpectedGuestCount = jdbcTemplate.queryForObject(
"""
select count(*)
from information_schema.columns
where table_name = 'booking'
and column_name = 'expected_guest_count'
""".trimIndent(),
Int::class.java
) ?: 0
if (hasExpectedGuestCount == 0) {
logger.info("Adding booking.expected_guest_count column")
jdbcTemplate.execute("alter table booking add column expected_guest_count integer")
}
}
}

View File

@@ -110,6 +110,7 @@ class BookingFlow(
maleCount = request.maleCount,
femaleCount = request.femaleCount,
totalGuestCount = totalGuestCount,
expectedGuestCount = request.expectedGuestCount,
notes = request.notes,
createdBy = actor,
updatedAt = now

View File

@@ -22,6 +22,7 @@ data class BookingCreateRequest(
val childCount: Int? = null,
val maleCount: Int? = null,
val femaleCount: Int? = null,
val expectedGuestCount: Int? = null,
val notes: String? = null
)

View File

@@ -71,6 +71,9 @@ class Booking(
@Column(name = "total_guest_count")
var totalGuestCount: Int? = null,
@Column(name = "expected_guest_count")
var expectedGuestCount: Int? = null,
var notes: String? = null,
@ManyToOne(fetch = FetchType.LAZY)