This repository contains the backend codebase for a REST API that manages holiday plans, users, and related entities. It provides API endpoints for CRUD operations on holiday plans, users, holiday plan logs, participants groups.
- CRUD operations on holiday plans, users, holiday plan logs, and participants groups.
- Generation of PDF for holiday plans.
- Sending emails when a holiday plan is created.
- Authentication using OAuth tokens.
- Error handling and logging.
The main entities in this project are:
- HolidayPlan: Manages the holiday plans.
- HolidayPlanLog: Logs actions related to holiday plans.
- ParticipantsGroup: Manages participants groups for holiday plans.
- User: Stores user information.
This project uses several technologies:
- Laravel: A PHP framework for web application development.
- Postgres: A relational database for storing application data.
- Redis: An in-memory data structure store, used as a database, cache, and message broker. Redis is used for caching and speeding up responses.
- Docker: A platform to develop, ship, and run applications inside containers. Docker ensures that the application runs the same way in every environment.
- Laravel Sail: A light-weight command-line interface for interacting with Laravel's default Docker environment.
You will need Docker installed on your machine. You can see how to install it on your OS here.
Follow these steps to set up the project:
-
Install dependencies using a composer from a Laravel Sail image in Dockerhub:
docker run --rm \ -u "$(id -u):$(id -g)" \ -v "$(pwd):/var/www/html" \ -w /var/www/html \ laravelsail/php83-composer:latest \ composer install --ignore-platform-reqs
-
Create a
.env
:cp .env.example .env
-
Up the Docker environment:
./vendor/bin/sail up
-
Generate a api key:
./vendor/bin/sail artisan key:generate
-
Run tests (optional):
./vendor/bin/sail artisan test
-
Populate the database:
./vendor/bin/sail artisan migrate:fresh --seed
-
(Optional) You can create a connection in a SGBD Manager, like DBeaver or Datagrip:
-
Create the connection with the '.env' db variables:
DB_CONNECTION=pgsql DB_HOST=pgsql DB_PORT=5432 DB_DATABASE=laravel DB_USERNAME=sail DB_PASSWORD=password
The project uses the following database tables:
failed_jobs
: Records failed queue jobs.holiday_plan_logs
: Logs actions related to holiday plans.holiday_plans
: Stores information about holiday plans.migrations
: Tracks database migrations.oauth_*
: Tables for OAuth authentication.participants_groups
: Manages participants groups for holiday plans.password_reset_tokens
: Stores password reset tokens.personal_access_tokens
: Manages personal access tokens for authentication.users
: Stores user information.
- Remember if you run test it will refresh the database.