feat(listings): add ROOM_RENTAL, CONDOTEL, SERVICED_APARTMENT property types (GOO-20)

- Add ROOM_RENTAL, CONDOTEL, SERVICED_APARTMENT to PropertyType enum in schema.prisma
- Create migration 20260422010000_add_room_rental_property_types with ALTER TYPE ADD VALUE
- Add DEFAULT_RANGES in PrismaPriceValidator: ROOM_RENTAL 1M-10M VND/month, CONDOTEL 20M-300M, SERVICED_APARTMENT 20M-250M VND/m²
- Add i18n translations: vi "Phòng trọ / Condotel / Căn hộ dịch vụ", en "Room Rental / Condotel / Serviced Apartment"
- Typesense indexes propertyType as a generic string facet — no schema change needed

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-22 23:26:01 +07:00
parent ee6d6d4c17
commit c478abae38
8 changed files with 151 additions and 6 deletions

View File

@@ -65,6 +65,17 @@ describe('PropertySearchServer', () => {
});
describe('search_properties', () => {
it('always filters by uppercase ACTIVE status matching Prisma enum', async () => {
client._search.mockResolvedValue(makeHits([]));
const handler = getToolHandler(server, 'search_properties');
await handler({ query: '*', page: 1, perPage: 20 });
const filterBy = client._search.mock.calls[0][0].filter_by as string;
expect(filterBy).toContain('status:=ACTIVE');
expect(filterBy).not.toContain('status:=active');
});
it('searches with basic query', async () => {
const handler = getToolHandler(server, 'search_properties');
const result = await handler({ query: 'căn hộ Quận 7', page: 1, perPage: 20 });
@@ -101,7 +112,7 @@ describe('PropertySearchServer', () => {
});
const filterBy = client._search.mock.calls[0][0].filter_by as string;
expect(filterBy).toContain('status:=active');
expect(filterBy).toContain('status:=ACTIVE');
expect(filterBy).toContain('propertyType:=apartment');
expect(filterBy).toContain('transactionType:=sale');
expect(filterBy).toContain('priceVND:>=1000000000');

View File

@@ -45,7 +45,7 @@ export function createPropertySearchServer(deps: PropertySearchDeps): McpServer
'Search property listings using natural language queries with filters.',
SearchPropertiesSchema,
async (params: z.infer<z.ZodObject<typeof SearchPropertiesSchema>>) => {
const filters: string[] = ['status:=active'];
const filters: string[] = ['status:=ACTIVE'];
if (params.propertyType) filters.push(`propertyType:=${params.propertyType}`);
if (params.transactionType) filters.push(`transactionType:=${params.transactionType}`);