Index
From GeeksHub we were asked to create the backend of my final project. From the creation of the business logic to take it to production. I have chosen a theme related to music, a functional web so that both user and music (besides the admin) can manage it. As a user you will be able to save in your favorites concerts that have caught your attention and book your ticket, plus if you have a group could register it on my website. As a musician you will have the benefit of being able to promote your concerts through my website, controlling your personal data, band data, your concerts and publish your concerts. As an admin you will have access to all the management in order to have the best control of the functionality internally.
Technologies that has been used:
Steps to make it work on your local computer:
-
Clone the project on your computer with git bash:
$git clone 'url-repository'
-
Install all dependencies with the following command:
$ compose install
-
Create a .env file following the template .env.example provided and type all credentials. If you cannot get them, change the parameters for your own local database set up running in docker.
-
Start the server with:
$ php artisan serve
-
Connect the repository with the database with the following commands:
$ php artisan migrate
$ php artisan db:seed
-
Import this file in postman to get the endpoints we have created:
In order to start the project you had to establish the logic it needs. First I made a sketch of the database tables, to better understand what kind of relationship I will need for each table, where to create the intermediate tables and foreign keys. First I made the web flow, after that I started to create and test (visually) the database tables:
This has allowed me to see what exactly my database needs, what fields and relationships, and to have a good template to start creating it.
The project is structured using the Model-View-Controller (MVC) pattern and basic CRUD (Create, Read, Update and Delete) functionality has been implemented. The structure of the project is described below:
- Migrations. Migrations are used to define the structure of the tables in the database, including all their columns and types.
- Models. Models represent the relationships between the tables in the database and the type of relationship that exists between them.
- Controllers. Two middlewares have been implemented in this web application: one for the administrator role and one for the group role.
- Middlewares. This web needed two middlewares: admin and of the group.
- Seeders. Seeders have been created, which are example data used to populate the database once the application is running.
- api. In the api.php file, all the routes and their relationship to the corresponding controllers and endpoints have been defined.
- .env In the .env file all the environment variables that the application needs to run correctly have been defined.
This project has 32 endpoints. Here are some examples:
User:
User
-
Login user:
-
Manage login in the API. The information is passed via body in Postman containing the email and password:
POST: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/login
body:
{ "email": "[email protected]", "password": "password", }
-
-
Register User:
-
Manage of the register in our API:
POST: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/register
body:
{ "firstName": "Name", "lastName": "Surname", "email": "[email protected]", "password": "password", "address": "Address", "document": "11111111M", "dateOfBirth": "00/00/0000", "phoneNumber": "111111111", }
-
- Logout
- Register Group(if user have a group)
- View of Profile
- Get My Tickets
- Delete profile
- Book ticket
- Put in favorites
- Get my favorites
General
Without login you can: - View of all groups - View of all concerts - Search concerts by title or group name - View of Conctacts page - View of About Us page
Musician
- Create concert:
-
Musician can public his concert in the web.
POST: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/createConcert
body:
{ "image": "URL", "title": "Title", "date": "0000/00/00 00:00", "groupName": "Name", "description": "Description", "programm": "Programm", }
-
Also can:
- Get my concerts
- Get my group
- Update my group
Admin
-
Get all users:
GET: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/users -
Get user by name or surname:
-
Obtains information faster.
GET: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/user?lastName=&firstName=
-
-
Update group:
-
Update only some information.
PUT: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/user?lastName=&firstName=/api/groups/admin/8
body: ``` bash { "description": "Description" }
```
-
-
Delete Concert:
-
Deletes concert by it´s id.
DELETE: https://ak-fsd-backend-concert-to-you-njjo.vercel.app/api/api/concert/delete/16
-
Also admin can:
- Restore & Delete user
- Restore & Delete concert
- Restore & Delete Group
As future features I would like to develop the user interface in more depth, having more options for managing personal data, in addition to the collaborations and to be able to introduce real sale of tickets, are some examples of the general idea.
This project is belonging to license Creative Commons Legal Code.
To achieve the goal we have collected information from:
I thank my teachers for their time dedicated to this project: