Follow these steps to get the project up and running on your local development environment.
First, clone the project repository to your local machine:
git clone https://github.com/iagonvs/real-estate-api.git
cd real-estate-api
Copy the .env.example
file to create a .env
file with your environment variables:
cp .env.example .env
Use Docker Compose to build and start the project containers:
docker-compose up -d --build
Install the project's PHP dependencies with Composer:
docker-compose exec app composer install
After the containers are up, run the database migrations and seeders to set up the database schema and populate it with initial data:
docker-compose exec app php artisan migrate --seed
docker-compose exec app php artisan test
Inside project there is a Insomnia file with all endpoints. You can import in your local workspace.
Insomnia_2024-03-23.json
In the project there is a Laravel Scramble package to show all routes and with all details, like payload examples etc.
To access doc just put follow route:
http://127.0.0.1:8000/docs/api
There are two seeders to create content to Buildings and Statuses table. (Is in STEP 5);
The routes to create and get a task, and create a comment needs to have a bearer token.
To generate just need use the registration route (api/register) and to make a login route(api/login)
POST:
Registration payload:
{
"name": "real estate api",
"email": "[email protected]",
"password": "realestateapi",
}
POST:
Login payload:
{
"email": "[email protected]",
"password": "realestateapi",
}
To create a Task you can use this route: api/tasks
POST:
{
"title": "string",
"address": "string",
"description": "string",
"status_id": "1" // 1 (OPEN), 2 (IN_PROGRESS), 3 (COMPLETED), 4 (REFUSED),
"user_id": 0,
"building_id": 0
}
To get a task with filters. All attributes are optionals: api /tasks
GET:
{
"date_from": "string",
"date_to": "string",
"status_id": "1" // 1 (OPEN), 2 (IN_PROGRESS), 3 (COMPLETED), 4 (REFUSED),
"building_id": 0
}
OR to get all
GET:
{
}
To make a comment to specific task: api/comments/{task}
POST:
{
"content": "string"
}
You should now have the project running on your local development environment. For more detailed instructions or troubleshooting, refer to the project's documentation or contact with me.