From aea56100e2d7c9ad7901282624a7804cd25b7823 Mon Sep 17 00:00:00 2001 From: Franklin Date: Wed, 5 Apr 2023 15:14:14 -0400 Subject: [PATCH] Added readme explaining project for Moaz joining the team --- Readme.md | 35 ++++++++++++++++++++++++ sql/project/fetch_with_filters_paged.sql | 1 + 2 files changed, 36 insertions(+) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..074b913 --- /dev/null +++ b/Readme.md @@ -0,0 +1,35 @@ +# Jorge Ledezma Backend + +This backend should only expose two main things: + +## Admin routes + +These are located in src/routes/admin.rs + +They are what the realtor (The client) will use to upload projects, update them, or delete them. + +The whole app pretty much rotates around the following structs: + +- Agent (Who is in charge of selling the project) +- Location (Where is the project located) +- Project (What will be listed) +- Unit (Goes inside projects. A project can have many units. It's like saying a country has many cities. The project is the container for all the units.) + +So the client will need to be able to add, update, delete all these structures. + + +## Read routes + +These are located in src/routes/read.rs + +They are what all the customers of the website and of our client will use to see the website, interact with it, etc... + +The main entry point for the whole thing is in one route. `get_projects_paged` since this is the route that returns all of the projects. This is where the customers can filter by what they want in a project, then see which projects they like, then ask for more information (Meaning seeing all the project details and all of the units in the project and the agent who sells the units). + +This client did not ask for any renting. So everything will be sale only, the prices in US dollars. + +## What's next? + +In reality, this specific backend is pretty much done (although there's more to come). The only thing left to do is add authentication to all the admin routes. +For this, there's a couple of choices. +One is connect with user service (Our already created service for authentication). But this does not have email or sms access in case the client forgets his password. So I would instead connect this with a service like google authentication so that the client can connect his account with google. This means the database must have a new table named admins that contains everything regarding authentication. A part of the migration should be adding the client's user, as for now it shall only be him. \ No newline at end of file diff --git a/sql/project/fetch_with_filters_paged.sql b/sql/project/fetch_with_filters_paged.sql index 65b5ea1..c6c963d 100644 --- a/sql/project/fetch_with_filters_paged.sql +++ b/sql/project/fetch_with_filters_paged.sql @@ -4,6 +4,7 @@ SELECT p.project_type as "project_type: _", p.project_condition as "project_condition: _", l.city, + (SELECT (SELECT u.price_usd FROM unit u WHERE u.project_id = p.id ORDER BY u.price_usd DESC LIMIT 1)) as starts_from, l.district, p.finish_date, p.media as "media: _"