This project is a RESTful API develop with Ruby on Rails for the Capstone project, the project is about places to buy or rent(like an airbnb).
- The data bases are in PostgreSQL.
- Models are: User, Property, Favorite (relation if an user make favorite some property), and Contact(relation if an user call with a landlor).
-
User:
- id: integer
- name: string
- email: string
- password: string
- phone: string
- role: integer (0 for seeker, 1 for landlord)
-
Property:
- id: integer
- address: string
- price: integer
- maintance: integer
- beds: integer
- baths: integer
- area: float
- pets: boolean
- description: text
- property_type: integer (0 for apartment, 1 for house)
- operation_type: integer (0 for rent, 1 for sale)
- status: integer (0 for active, 1 for closed)
- user_id: bigint (user is landlord)
- photo: url
-
Favorite:
- id: integer
- user_id: bigint
- property_id: bigint
-
Contact:
- id: integer
- user_id: bigint
- property_id: bigint
-
In this the project use Docker Container and Docker Compose to run the project.
-
Clone the repository in your computer.
-
Open the folder Capstone-Api in a code editor.
-
Create an .env file and fill it with your GitHub credentials.
GIT_USER_NAME=Example-mail
GIT_USER_EMAIL=example@mail.com- In the terminal run (you have to located in the Capstone-Api folder):
$ sudo docker-compose up- Open another terminal and run:
$ sudo docker-compose exec client bashwhen you see something like this:
you are in good way.
- Now you hahve to install the gems:
$ bundle installthen
$ bundle update- Now it is time to run the migrations
$ rails db:migrate- Finally, you can run the server:
$ rails s -b 0.0.0.0You can open your localhost in your browser and you can see the project.
- In the terminal use Ctrl + C to stop the server.
- You can use the insomnia to test the API.
- use the insomnia_capstone.json file to test the API.
- Remember to have running the server.
Made by Monito Inc. 🙊
Made by Dulces123
Made by JosHeredia26

