From 97c87a3f0b079b5959b03cb874912da969883c69 Mon Sep 17 00:00:00 2001 From: Alessandro Vitali Date: Thu, 23 Jul 2026 15:33:19 +0200 Subject: [PATCH 1/2] fix: use 2 decimal numeric precision to fix slightly off values --- database/schema.sql | 2 +- database/seed.sql | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/database/schema.sql b/database/schema.sql index 439d23253..b909d17cc 100644 --- a/database/schema.sql +++ b/database/schema.sql @@ -25,7 +25,7 @@ CREATE TABLE reservations ( tenant_id TEXT REFERENCES tenants(id), check_in_date TIMESTAMP WITH TIME ZONE NOT NULL, check_out_date TIMESTAMP WITH TIME ZONE NOT NULL, - total_amount NUMERIC(10, 3) NOT NULL, -- storing as numeric with 3 decimals to allow sub-cent precision tracking + total_amount NUMERIC(10, 2) NOT NULL, -- storing as numeric with 2 decimals to allow sub-cent precision tracking currency TEXT DEFAULT 'USD', created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), FOREIGN KEY (property_id, tenant_id) REFERENCES properties(id, tenant_id) diff --git a/database/seed.sql b/database/seed.sql index 45d974e4f..d778bdc12 100644 --- a/database/seed.sql +++ b/database/seed.sql @@ -16,14 +16,14 @@ INSERT INTO properties (id, tenant_id, name, timezone) VALUES -- Sample reservation data (tenant-a). INSERT INTO reservations (id, property_id, tenant_id, check_in_date, check_out_date, total_amount) VALUES - ('res-tz-1', 'prop-001', 'tenant-a', '2024-02-29 23:30:00+00', '2024-03-05 10:00:00+00', 1250.000); + ('res-tz-1', 'prop-001', 'tenant-a', '2024-02-29 23:30:00+00', '2024-03-05 10:00:00+00', 1250.00); -- Additional sample reservation data. INSERT INTO reservations (id, property_id, tenant_id, check_in_date, check_out_date, total_amount) VALUES -- prop-001: Beach House Alpha (tenant-a) - ('res-dec-1', 'prop-001', 'tenant-a', '2024-03-15 10:00:00+00', '2024-03-18 10:00:00+00', 333.333), - ('res-dec-2', 'prop-001', 'tenant-a', '2024-03-16 10:00:00+00', '2024-03-19 10:00:00+00', 333.333), - ('res-dec-3', 'prop-001', 'tenant-a', '2024-03-17 10:00:00+00', '2024-03-20 10:00:00+00', 333.334), + ('res-dec-1', 'prop-001', 'tenant-a', '2024-03-15 10:00:00+00', '2024-03-18 10:00:00+00', 333.33), + ('res-dec-2', 'prop-001', 'tenant-a', '2024-03-16 10:00:00+00', '2024-03-19 10:00:00+00', 333.33), + ('res-dec-3', 'prop-001', 'tenant-a', '2024-03-17 10:00:00+00', '2024-03-20 10:00:00+00', 333.33), -- prop-002: City Apartment Downtown (tenant-a) - High-value urban property ('res-004', 'prop-002', 'tenant-a', '2024-03-05 14:00:00+00', '2024-03-08 11:00:00+00', 1250.00), From ea8e655c099de298a7525f20dff02271302176a4 Mon Sep 17 00:00:00 2001 From: Alessandro Vitali Date: Thu, 23 Jul 2026 15:48:24 +0200 Subject: [PATCH 2/2] fix: add missing tenant_id in the Redis cache --- backend/app/services/cache.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/app/services/cache.py b/backend/app/services/cache.py index b81474957..672e3f9d6 100644 --- a/backend/app/services/cache.py +++ b/backend/app/services/cache.py @@ -10,7 +10,7 @@ async def get_revenue_summary(property_id: str, tenant_id: str) -> Dict[str, Any """ Fetches revenue summary, utilizing caching to improve performance. """ - cache_key = f"revenue:{property_id}" + cache_key = f"revenue:{tenant_id}:{property_id}" # Try to get from cache cached = await redis_client.get(cache_key)