Added cards to property filter
This commit is contained in:
parent
67712dec79
commit
5f878f04a9
@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS "realtor" (
|
|||||||
phone_number VARCHAR NOT NULL,
|
phone_number VARCHAR NOT NULL,
|
||||||
email VARCHAR,
|
email VARCHAR,
|
||||||
profile_picture_url VARCHAR NOT NULL,
|
profile_picture_url VARCHAR NOT NULL,
|
||||||
|
banner_picture_url VARCHAR,
|
||||||
show_projects boolean NOT NULL,
|
show_projects boolean NOT NULL,
|
||||||
shortcode VARCHAR NOT NULL,
|
shortcode VARCHAR NOT NULL,
|
||||||
remax_agent_id INT,
|
remax_agent_id INT,
|
||||||
|
@ -33,5 +33,5 @@ AND (p.parking_spots = $11 OR $11 IS null) -- Parking spots amount
|
|||||||
AND (pa.price <= $12 OR $12 IS null) -- Price Less than
|
AND (pa.price <= $12 OR $12 IS null) -- Price Less than
|
||||||
AND (pa.price >= $13 OR $13 IS null) -- Price Greater than
|
AND (pa.price >= $13 OR $13 IS null) -- Price Greater than
|
||||||
-- END OF FILTERS
|
-- END OF FILTERS
|
||||||
ORDER BY p.time_created DESC
|
ORDER BY p.order_index DESC
|
||||||
LIMIT 25 OFFSET $2;
|
LIMIT 25 OFFSET $2;
|
@ -1,5 +1,5 @@
|
|||||||
INSERT INTO realtor (
|
INSERT INTO realtor (
|
||||||
id, name, bio, phone_number, email, profile_picture_url, show_projects, shortcode, remax_agent_id, time_created, last_updated
|
id, name, bio, phone_number, email, profile_picture_url, banner_picture_url, show_projects, shortcode, remax_agent_id, time_created, last_updated
|
||||||
) VALUES (
|
) VALUES (
|
||||||
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $10
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11
|
||||||
) RETURNING *;
|
) RETURNING *;
|
@ -4,8 +4,9 @@ UPDATE realtor SET
|
|||||||
phone_number = $4,
|
phone_number = $4,
|
||||||
email = $5,
|
email = $5,
|
||||||
profile_picture_url = $6,
|
profile_picture_url = $6,
|
||||||
show_projects = $7,
|
banner_picture_url = $7,
|
||||||
remax_agent_id = $8,
|
show_projects = $8,
|
||||||
last_updated = $9
|
remax_agent_id = $9,
|
||||||
|
last_updated = $10
|
||||||
WHERE id = $1
|
WHERE id = $1
|
||||||
RETURNING *;
|
RETURNING *;
|
668
sqlx-data.json
668
sqlx-data.json
@ -116,6 +116,101 @@
|
|||||||
},
|
},
|
||||||
"query": "SELECT \n id,\n title,\n description,\n realtor_id,\n media as \"media: _\",\n project_condition as \"project_condition: _\",\n project_type as \"project_type: _\",\n project_state as \"project_state: _\",\n country,\n city, \n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated\nFROM project WHERE id = $1;\n"
|
"query": "SELECT \n id,\n title,\n description,\n realtor_id,\n media as \"media: _\",\n project_condition as \"project_condition: _\",\n project_type as \"project_type: _\",\n project_state as \"project_state: _\",\n country,\n city, \n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated\nFROM project WHERE id = $1;\n"
|
||||||
},
|
},
|
||||||
|
"1baab5ac461f9543430bd85a600a5af1df45bcd93746eba8219ebcd1efcc56d4": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bio",
|
||||||
|
"ordinal": 2,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phone_number",
|
||||||
|
"ordinal": 3,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "email",
|
||||||
|
"ordinal": 4,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "profile_picture_url",
|
||||||
|
"ordinal": 5,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "banner_picture_url",
|
||||||
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "show_projects",
|
||||||
|
"ordinal": 7,
|
||||||
|
"type_info": "Bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "shortcode",
|
||||||
|
"ordinal": 8,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "remax_agent_id",
|
||||||
|
"ordinal": 9,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "time_created",
|
||||||
|
"ordinal": 10,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "last_updated",
|
||||||
|
"ordinal": 11,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Bool",
|
||||||
|
"Int4",
|
||||||
|
"Timestamptz"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "UPDATE realtor SET\n name = $2,\n bio = $3,\n phone_number = $4,\n email = $5,\n profile_picture_url = $6,\n banner_picture_url = $7,\n show_projects = $8,\n remax_agent_id = $9,\n last_updated = $10\nWHERE id = $1\nRETURNING *;"
|
||||||
|
},
|
||||||
"1de871eb06903280d3be4e4ef8f67cde596807784e726ff62d03c2c9f6d6ba76": {
|
"1de871eb06903280d3be4e4ef8f67cde596807784e726ff62d03c2c9f6d6ba76": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -150,28 +245,33 @@
|
|||||||
"type_info": "Varchar"
|
"type_info": "Varchar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "show_projects",
|
"name": "banner_picture_url",
|
||||||
"ordinal": 6,
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "show_projects",
|
||||||
|
"ordinal": 7,
|
||||||
"type_info": "Bool"
|
"type_info": "Bool"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shortcode",
|
"name": "shortcode",
|
||||||
"ordinal": 7,
|
"ordinal": 8,
|
||||||
"type_info": "Varchar"
|
"type_info": "Varchar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "remax_agent_id",
|
"name": "remax_agent_id",
|
||||||
"ordinal": 8,
|
"ordinal": 9,
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "time_created",
|
"name": "time_created",
|
||||||
"ordinal": 9,
|
"ordinal": 10,
|
||||||
"type_info": "Timestamptz"
|
"type_info": "Timestamptz"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "last_updated",
|
"name": "last_updated",
|
||||||
"ordinal": 10,
|
"ordinal": 11,
|
||||||
"type_info": "Timestamptz"
|
"type_info": "Timestamptz"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -182,6 +282,7 @@
|
|||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
@ -250,95 +351,6 @@
|
|||||||
},
|
},
|
||||||
"query": "UPDATE property_arrangement SET \n price = $2,\n currency = $3,\n arrangement = $4,\n last_updated = $5\nWHERE property_id = $1\nRETURNING \n property_id,\n price,\n currency,\n arrangement as \"arrangement: _\",\n time_created,\n last_updated;"
|
"query": "UPDATE property_arrangement SET \n price = $2,\n currency = $3,\n arrangement = $4,\n last_updated = $5\nWHERE property_id = $1\nRETURNING \n property_id,\n price,\n currency,\n arrangement as \"arrangement: _\",\n time_created,\n last_updated;"
|
||||||
},
|
},
|
||||||
"2482798d8601fd41678197770bf51af67cd962d210ff65b9236f24f0425d7341": {
|
|
||||||
"describe": {
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"ordinal": 0,
|
|
||||||
"type_info": "Uuid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"ordinal": 1,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "bio",
|
|
||||||
"ordinal": 2,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "phone_number",
|
|
||||||
"ordinal": 3,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "email",
|
|
||||||
"ordinal": 4,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "profile_picture_url",
|
|
||||||
"ordinal": 5,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "show_projects",
|
|
||||||
"ordinal": 6,
|
|
||||||
"type_info": "Bool"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "shortcode",
|
|
||||||
"ordinal": 7,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "remax_agent_id",
|
|
||||||
"ordinal": 8,
|
|
||||||
"type_info": "Int4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "time_created",
|
|
||||||
"ordinal": 9,
|
|
||||||
"type_info": "Timestamptz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "last_updated",
|
|
||||||
"ordinal": 10,
|
|
||||||
"type_info": "Timestamptz"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"nullable": [
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"parameters": {
|
|
||||||
"Left": [
|
|
||||||
"Uuid",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Bool",
|
|
||||||
"Varchar",
|
|
||||||
"Int4",
|
|
||||||
"Timestamptz"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"query": "INSERT INTO realtor (\n id, name, bio, phone_number, email, profile_picture_url, show_projects, shortcode, remax_agent_id, time_created, last_updated\n) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $10\n) RETURNING *;"
|
|
||||||
},
|
|
||||||
"3acc0efdfdf6fd4e86b0f197cd27b7378507b82915127b76a6cf76a8f7cb5618": {
|
"3acc0efdfdf6fd4e86b0f197cd27b7378507b82915127b76a6cf76a8f7cb5618": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -526,6 +538,102 @@
|
|||||||
},
|
},
|
||||||
"query": "INSERT INTO project (\n id,\n title,\n description,\n realtor_id,\n media,\n project_condition,\n project_type,\n project_state,\n country,\n city, \n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated\n) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $16\n) RETURNING \n id,\n title,\n description,\n realtor_id,\n media as \"media: _\",\n project_condition as \"project_condition: _\",\n project_type as \"project_type: _\",\n project_state as \"project_state: _\",\n country,\n city, \n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated;"
|
"query": "INSERT INTO project (\n id,\n title,\n description,\n realtor_id,\n media,\n project_condition,\n project_type,\n project_state,\n country,\n city, \n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated\n) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $16\n) RETURNING \n id,\n title,\n description,\n realtor_id,\n media as \"media: _\",\n project_condition as \"project_condition: _\",\n project_type as \"project_type: _\",\n project_state as \"project_state: _\",\n country,\n city, \n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated;"
|
||||||
},
|
},
|
||||||
|
"50f49e1256fe439b399167515eeb39423ab0618637d12c2b471e9aec9374286e": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bio",
|
||||||
|
"ordinal": 2,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "phone_number",
|
||||||
|
"ordinal": 3,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "email",
|
||||||
|
"ordinal": 4,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "profile_picture_url",
|
||||||
|
"ordinal": 5,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "banner_picture_url",
|
||||||
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "show_projects",
|
||||||
|
"ordinal": 7,
|
||||||
|
"type_info": "Bool"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "shortcode",
|
||||||
|
"ordinal": 8,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "remax_agent_id",
|
||||||
|
"ordinal": 9,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "time_created",
|
||||||
|
"ordinal": 10,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "last_updated",
|
||||||
|
"ordinal": 11,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Varchar",
|
||||||
|
"Bool",
|
||||||
|
"Varchar",
|
||||||
|
"Int4",
|
||||||
|
"Timestamptz"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "INSERT INTO realtor (\n id, name, bio, phone_number, email, profile_picture_url, banner_picture_url, show_projects, shortcode, remax_agent_id, time_created, last_updated\n) VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $11\n) RETURNING *;"
|
||||||
|
},
|
||||||
"5356455cba4a2740f833ca895e41fa120164a7e1fad9edb367aa680a2353ee02": {
|
"5356455cba4a2740f833ca895e41fa120164a7e1fad9edb367aa680a2353ee02": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -1009,6 +1117,140 @@
|
|||||||
},
|
},
|
||||||
"query": "SELECT \n id,\n title,\n description,\n realtor_id,\n media as \"media: _\",\n project_condition as \"project_condition: _\",\n project_type as \"project_type: _\",\n project_state as \"project_state: _\",\n country,\n city,\n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated\nFROM project WHERE realtor_id = $1;"
|
"query": "SELECT \n id,\n title,\n description,\n realtor_id,\n media as \"media: _\",\n project_condition as \"project_condition: _\",\n project_type as \"project_type: _\",\n project_state as \"project_state: _\",\n country,\n city,\n district,\n admin_tag,\n floors,\n finish_date,\n order_index,\n time_created,\n last_updated\nFROM project WHERE realtor_id = $1;"
|
||||||
},
|
},
|
||||||
|
"92abeebdeb9a2de864c868eccba9669958a01ce3a485355f22bf20357f001d61": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"ordinal": 0,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "project_id",
|
||||||
|
"ordinal": 1,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "realtor_id",
|
||||||
|
"ordinal": 2,
|
||||||
|
"type_info": "Uuid"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "media: _",
|
||||||
|
"ordinal": 3,
|
||||||
|
"type_info": "Text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "property_type: _",
|
||||||
|
"ordinal": 4,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "property_sale_type: _",
|
||||||
|
"ordinal": 5,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "country",
|
||||||
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "city",
|
||||||
|
"ordinal": 7,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "district",
|
||||||
|
"ordinal": 8,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "order_index",
|
||||||
|
"ordinal": 9,
|
||||||
|
"type_info": "Int4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "thumbnail_format: _",
|
||||||
|
"ordinal": 10,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rooms",
|
||||||
|
"ordinal": 11,
|
||||||
|
"type_info": "Int2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bathrooms",
|
||||||
|
"ordinal": 12,
|
||||||
|
"type_info": "Float4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "area",
|
||||||
|
"ordinal": 13,
|
||||||
|
"type_info": "Float4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "parking_spots",
|
||||||
|
"ordinal": 14,
|
||||||
|
"type_info": "Int2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin_tag",
|
||||||
|
"ordinal": 15,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "time_created",
|
||||||
|
"ordinal": 16,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "last_updated",
|
||||||
|
"ordinal": 17,
|
||||||
|
"type_info": "Timestamptz"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nullable": [
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Uuid",
|
||||||
|
"Int8",
|
||||||
|
"Text",
|
||||||
|
"Text",
|
||||||
|
"Text",
|
||||||
|
"Text",
|
||||||
|
"Text",
|
||||||
|
"Int2",
|
||||||
|
"Float4",
|
||||||
|
"Float4",
|
||||||
|
"Int2",
|
||||||
|
"Float8",
|
||||||
|
"Float8"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "SELECT \n p.id,\n p.project_id,\n p.realtor_id,\n p.media as \"media: _\",\n p.property_type as \"property_type: _\",\n p.property_sale_type as \"property_sale_type: _\",\n p.country,\n p.city,\n p.district,\n p.order_index,\n p.thumbnail_format as \"thumbnail_format: _\",\n p.rooms,\n p.bathrooms,\n p.area,\n p.parking_spots,\n p.admin_tag,\n p.time_created,\n p.last_updated\nFROM property p, property_arrangement pa\nWHERE p.realtor_id = $1\nAND pa.property_id = p.id\n-- FILTERS\nAND (pa.arrangement = $3 OR $3 IS null) -- Arrangement\nAND (p.property_type = $4 OR $4 IS null) -- Property Type\nAND (p.country = $5 OR $5 IS null) -- Country\nAND (p.city = $6 OR $6 IS null) -- City\nAND (p.district = $7 OR $7 IS null) -- District\nAND (p.rooms = $8 OR $8 IS null) -- Room amount\nAND (p.bathrooms = $9 OR $9 IS null) -- Bathroom amount\nAND (p.area >= $10 OR $10 IS null) -- Area greater than\nAND (p.parking_spots = $11 OR $11 IS null) -- Parking spots amount\nAND (pa.price <= $12 OR $12 IS null) -- Price Less than\nAND (pa.price >= $13 OR $13 IS null) -- Price Greater than\n-- END OF FILTERS\nORDER BY p.order_index DESC\nLIMIT 25 OFFSET $2;"
|
||||||
|
},
|
||||||
"a335033d78f1a2211afed07daff01d72152d05ad78fe068d62a42d3f08c83207": {
|
"a335033d78f1a2211afed07daff01d72152d05ad78fe068d62a42d3f08c83207": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -1435,228 +1677,6 @@
|
|||||||
},
|
},
|
||||||
"query": "UPDATE property SET\n project_id = $2,\n realtor_id = $3,\n media = $4,\n property_type = $5,\n property_sale_type = $6,\n country = $7,\n city = $8,\n district = $9,\n order_index = $10,\n thumbnail_format = $11,\n rooms = $12,\n bathrooms = $13,\n area = $14,\n parking_spots = $15,\n admin_tag = $16,\n last_updated = $17\nWHERE id = $1\nRETURNING \n id,\n project_id,\n realtor_id,\n media as \"media: _\",\n property_type as \"property_type: _\",\n property_sale_type as \"property_sale_type: _\",\n country,\n city,\n district,\n order_index,\n thumbnail_format as \"thumbnail_format: _\",\n rooms,\n bathrooms,\n area,\n parking_spots,\n admin_tag,\n time_created,\n last_updated;"
|
"query": "UPDATE property SET\n project_id = $2,\n realtor_id = $3,\n media = $4,\n property_type = $5,\n property_sale_type = $6,\n country = $7,\n city = $8,\n district = $9,\n order_index = $10,\n thumbnail_format = $11,\n rooms = $12,\n bathrooms = $13,\n area = $14,\n parking_spots = $15,\n admin_tag = $16,\n last_updated = $17\nWHERE id = $1\nRETURNING \n id,\n project_id,\n realtor_id,\n media as \"media: _\",\n property_type as \"property_type: _\",\n property_sale_type as \"property_sale_type: _\",\n country,\n city,\n district,\n order_index,\n thumbnail_format as \"thumbnail_format: _\",\n rooms,\n bathrooms,\n area,\n parking_spots,\n admin_tag,\n time_created,\n last_updated;"
|
||||||
},
|
},
|
||||||
"c571a9279bdcec6420fd1f80d8777832d13e135353a3d40aaf9549c5e80eccab": {
|
|
||||||
"describe": {
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"ordinal": 0,
|
|
||||||
"type_info": "Uuid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "name",
|
|
||||||
"ordinal": 1,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "bio",
|
|
||||||
"ordinal": 2,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "phone_number",
|
|
||||||
"ordinal": 3,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "email",
|
|
||||||
"ordinal": 4,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "profile_picture_url",
|
|
||||||
"ordinal": 5,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "show_projects",
|
|
||||||
"ordinal": 6,
|
|
||||||
"type_info": "Bool"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "shortcode",
|
|
||||||
"ordinal": 7,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "remax_agent_id",
|
|
||||||
"ordinal": 8,
|
|
||||||
"type_info": "Int4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "time_created",
|
|
||||||
"ordinal": 9,
|
|
||||||
"type_info": "Timestamptz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "last_updated",
|
|
||||||
"ordinal": 10,
|
|
||||||
"type_info": "Timestamptz"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"nullable": [
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"parameters": {
|
|
||||||
"Left": [
|
|
||||||
"Uuid",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Varchar",
|
|
||||||
"Bool",
|
|
||||||
"Int4",
|
|
||||||
"Timestamptz"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"query": "UPDATE realtor SET\n name = $2,\n bio = $3,\n phone_number = $4,\n email = $5,\n profile_picture_url = $6,\n show_projects = $7,\n remax_agent_id = $8,\n last_updated = $9\nWHERE id = $1\nRETURNING *;"
|
|
||||||
},
|
|
||||||
"ca31c99797615d66e383432403a6c8baab4907ebad96944d38075a8917e1c4e9": {
|
|
||||||
"describe": {
|
|
||||||
"columns": [
|
|
||||||
{
|
|
||||||
"name": "id",
|
|
||||||
"ordinal": 0,
|
|
||||||
"type_info": "Uuid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "project_id",
|
|
||||||
"ordinal": 1,
|
|
||||||
"type_info": "Uuid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "realtor_id",
|
|
||||||
"ordinal": 2,
|
|
||||||
"type_info": "Uuid"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "media: _",
|
|
||||||
"ordinal": 3,
|
|
||||||
"type_info": "Text"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "property_type: _",
|
|
||||||
"ordinal": 4,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "property_sale_type: _",
|
|
||||||
"ordinal": 5,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "country",
|
|
||||||
"ordinal": 6,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "city",
|
|
||||||
"ordinal": 7,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "district",
|
|
||||||
"ordinal": 8,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "order_index",
|
|
||||||
"ordinal": 9,
|
|
||||||
"type_info": "Int4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "thumbnail_format: _",
|
|
||||||
"ordinal": 10,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "rooms",
|
|
||||||
"ordinal": 11,
|
|
||||||
"type_info": "Int2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "bathrooms",
|
|
||||||
"ordinal": 12,
|
|
||||||
"type_info": "Float4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "area",
|
|
||||||
"ordinal": 13,
|
|
||||||
"type_info": "Float4"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "parking_spots",
|
|
||||||
"ordinal": 14,
|
|
||||||
"type_info": "Int2"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "admin_tag",
|
|
||||||
"ordinal": 15,
|
|
||||||
"type_info": "Varchar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "time_created",
|
|
||||||
"ordinal": 16,
|
|
||||||
"type_info": "Timestamptz"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "last_updated",
|
|
||||||
"ordinal": 17,
|
|
||||||
"type_info": "Timestamptz"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"nullable": [
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
],
|
|
||||||
"parameters": {
|
|
||||||
"Left": [
|
|
||||||
"Uuid",
|
|
||||||
"Int8",
|
|
||||||
"Text",
|
|
||||||
"Text",
|
|
||||||
"Text",
|
|
||||||
"Text",
|
|
||||||
"Text",
|
|
||||||
"Int2",
|
|
||||||
"Float4",
|
|
||||||
"Float4",
|
|
||||||
"Int2",
|
|
||||||
"Float8",
|
|
||||||
"Float8"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"query": "SELECT \n p.id,\n p.project_id,\n p.realtor_id,\n p.media as \"media: _\",\n p.property_type as \"property_type: _\",\n p.property_sale_type as \"property_sale_type: _\",\n p.country,\n p.city,\n p.district,\n p.order_index,\n p.thumbnail_format as \"thumbnail_format: _\",\n p.rooms,\n p.bathrooms,\n p.area,\n p.parking_spots,\n p.admin_tag,\n p.time_created,\n p.last_updated\nFROM property p, property_arrangement pa\nWHERE p.realtor_id = $1\nAND pa.property_id = p.id\n-- FILTERS\nAND (pa.arrangement = $3 OR $3 IS null) -- Arrangement\nAND (p.property_type = $4 OR $4 IS null) -- Property Type\nAND (p.country = $5 OR $5 IS null) -- Country\nAND (p.city = $6 OR $6 IS null) -- City\nAND (p.district = $7 OR $7 IS null) -- District\nAND (p.rooms = $8 OR $8 IS null) -- Room amount\nAND (p.bathrooms = $9 OR $9 IS null) -- Bathroom amount\nAND (p.area >= $10 OR $10 IS null) -- Area greater than\nAND (p.parking_spots = $11 OR $11 IS null) -- Parking spots amount\nAND (pa.price <= $12 OR $12 IS null) -- Price Less than\nAND (pa.price >= $13 OR $13 IS null) -- Price Greater than\n-- END OF FILTERS\nORDER BY p.time_created DESC\nLIMIT 25 OFFSET $2;"
|
|
||||||
},
|
|
||||||
"e9fb0b1fe0e33d2a8aa4bc20be141a9f4bcd68d1c69af1dce93c43c8ba96ebc1": {
|
"e9fb0b1fe0e33d2a8aa4bc20be141a9f4bcd68d1c69af1dce93c43c8ba96ebc1": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
@ -1795,28 +1815,33 @@
|
|||||||
"type_info": "Varchar"
|
"type_info": "Varchar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "show_projects",
|
"name": "banner_picture_url",
|
||||||
"ordinal": 6,
|
"ordinal": 6,
|
||||||
|
"type_info": "Varchar"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "show_projects",
|
||||||
|
"ordinal": 7,
|
||||||
"type_info": "Bool"
|
"type_info": "Bool"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shortcode",
|
"name": "shortcode",
|
||||||
"ordinal": 7,
|
"ordinal": 8,
|
||||||
"type_info": "Varchar"
|
"type_info": "Varchar"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "remax_agent_id",
|
"name": "remax_agent_id",
|
||||||
"ordinal": 8,
|
"ordinal": 9,
|
||||||
"type_info": "Int4"
|
"type_info": "Int4"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "time_created",
|
"name": "time_created",
|
||||||
"ordinal": 9,
|
"ordinal": 10,
|
||||||
"type_info": "Timestamptz"
|
"type_info": "Timestamptz"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "last_updated",
|
"name": "last_updated",
|
||||||
"ordinal": 10,
|
"ordinal": 11,
|
||||||
"type_info": "Timestamptz"
|
"type_info": "Timestamptz"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -1827,6 +1852,7 @@
|
|||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
|
@ -12,6 +12,7 @@ pub async fn insert_realtor(conn: &PgPool, realtor: Realtor) -> Result<Realtor,
|
|||||||
realtor.phone_number,
|
realtor.phone_number,
|
||||||
realtor.email,
|
realtor.email,
|
||||||
realtor.profile_picture_url,
|
realtor.profile_picture_url,
|
||||||
|
realtor.banner_picture_url,
|
||||||
realtor.show_projects,
|
realtor.show_projects,
|
||||||
realtor.shortcode,
|
realtor.shortcode,
|
||||||
realtor.remax_agent_id,
|
realtor.remax_agent_id,
|
||||||
@ -53,6 +54,7 @@ pub async fn update_realtor(conn: &PgPool, realtor: Realtor) -> Result<Realtor,
|
|||||||
realtor.phone_number,
|
realtor.phone_number,
|
||||||
realtor.email,
|
realtor.email,
|
||||||
realtor.profile_picture_url,
|
realtor.profile_picture_url,
|
||||||
|
realtor.banner_picture_url,
|
||||||
realtor.show_projects,
|
realtor.show_projects,
|
||||||
realtor.remax_agent_id,
|
realtor.remax_agent_id,
|
||||||
realtor.last_updated
|
realtor.last_updated
|
||||||
|
@ -8,7 +8,7 @@ use actix_web_utils::extensions::typed_response::TypedHttpResponse;
|
|||||||
use err::MessageResource;
|
use err::MessageResource;
|
||||||
use realtor_lp_types::{
|
use realtor_lp_types::{
|
||||||
domain::property::Property,
|
domain::property::Property,
|
||||||
dto::{filter::Filter, payloads::property::PropertyForCreationPayload},
|
dto::{filter::Filter, payloads::property::PropertyForCreationPayload, property_card::PropertyCard},
|
||||||
};
|
};
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
@ -41,7 +41,7 @@ pub async fn fetch_realtor_properties_paged(
|
|||||||
conn: Data<Arc<PgPool>>,
|
conn: Data<Arc<PgPool>>,
|
||||||
path_vars: Path<(Uuid, i64)>,
|
path_vars: Path<(Uuid, i64)>,
|
||||||
query_params: web::Query<HashMap<String, String>>,
|
query_params: web::Query<HashMap<String, String>>,
|
||||||
) -> TypedHttpResponse<Vec<Property>> {
|
) -> TypedHttpResponse<Vec<PropertyCard>> {
|
||||||
let filters = parse_params_into_filters(query_params.0);
|
let filters = parse_params_into_filters(query_params.0);
|
||||||
services::property::fetch_realtor_properties_paged(&conn, path_vars.0, path_vars.1, filters)
|
services::property::fetch_realtor_properties_paged(&conn, path_vars.0, path_vars.1, filters)
|
||||||
.await
|
.await
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
use std::sync::Arc;
|
use std::{sync::Arc, collections::HashMap};
|
||||||
|
|
||||||
use actix_web_utils::extensions::typed_response::TypedHttpResponse;
|
use actix_web_utils::extensions::typed_response::TypedHttpResponse;
|
||||||
use err::MessageResource;
|
use err::MessageResource;
|
||||||
use realtor_lp_types::{
|
use realtor_lp_types::{
|
||||||
domain::property::Property,
|
domain::{property::Property, price::PropertyPrice},
|
||||||
dto::{filter::Filter, payloads::property::PropertyForCreationPayload},
|
dto::{filter::Filter, payloads::property::PropertyForCreationPayload, property_card::PropertyCard},
|
||||||
};
|
};
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
@ -93,12 +93,35 @@ pub async fn fetch_realtor_properties_paged(
|
|||||||
realtor_id: Uuid,
|
realtor_id: Uuid,
|
||||||
page: i64,
|
page: i64,
|
||||||
filters: Vec<Filter>,
|
filters: Vec<Filter>,
|
||||||
) -> TypedHttpResponse<Vec<Property>> {
|
) -> TypedHttpResponse<Vec<PropertyCard>> {
|
||||||
let mut all_properties_filtered = handle_db_read_op!(
|
let mut all_properties_filtered = handle_db_read_op!(
|
||||||
dao::property::fetch_with_realtor_id_paged(conn, &realtor_id, &filters, &page)
|
dao::property::fetch_with_realtor_id_paged(conn, &realtor_id, &filters, &page)
|
||||||
);
|
);
|
||||||
all_properties_filtered
|
all_properties_filtered
|
||||||
.iter_mut()
|
.iter_mut()
|
||||||
.for_each(|property| property.admin_tag = None); // Remove admin tag for all
|
.for_each(|property| property.admin_tag = None); // Remove admin tag for all
|
||||||
success!(all_properties_filtered)
|
|
||||||
|
let mut property_ids: Vec<Uuid> = all_properties_filtered.iter().map(|property| property.id).collect();
|
||||||
|
let arrangements = handle_db_read_op!(dao::property_arrangement::fetch_arrangements_with_property_ids(conn, &property_ids));
|
||||||
|
let mut property_cards = Vec::new();
|
||||||
|
let mut property_map: HashMap<Uuid, Vec<PropertyPrice>> = HashMap::new();
|
||||||
|
for arrangement in arrangements {
|
||||||
|
if let Some(property_prices) = property_map.get_mut(&arrangement.property_id) {
|
||||||
|
property_prices.push(arrangement);
|
||||||
|
} else {
|
||||||
|
property_map.insert(arrangement.property_id, Vec::from([arrangement]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
property_ids.reverse();
|
||||||
|
for (index, property_id) in property_ids.into_iter().enumerate() {
|
||||||
|
property_cards.push(PropertyCard {
|
||||||
|
property: all_properties_filtered.remove(index),
|
||||||
|
arrangements: match property_map.remove(&property_id) {
|
||||||
|
Some(arrangements) => arrangements,
|
||||||
|
None => Vec::new(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
success!(property_cards)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user