19 lines
500 B
TypeScript
19 lines
500 B
TypeScript
import { sequelize, Op, House } from "../db.config";
|
|
|
|
export async function findHouseByTitleAndExactPriceAndRoomsAndBaths(house: any) {
|
|
//const sanitizedTitle = house.title.replace(/'/g, "\\'");
|
|
|
|
return "pollas";
|
|
|
|
const matchingHouses = await House.findAll({
|
|
where: {
|
|
price: house.price,
|
|
rooms: house.rooms,
|
|
baths: house.baths,
|
|
[Op.and]: sequelize.literal(`MATCH(title) AGAINST('${sanitizedTitle}' IN NATURAL LANGUAGE MODE)`)
|
|
}
|
|
});
|
|
|
|
return matchingHouses;
|
|
}
|