This is a Laravel backend test project.
Based on a given ERD, this is a task management system where users can create tasks, assign them to themselves or other users, set due dates, track the status of tasks using the status table, and add comments or remarks to tasks. The system should also allow for the creation and deletion of users, tasks, and statuses, as well as the ability to update and modify existing records. Finally, the system should keep track of timestamps for when records were created, updated, and deleted.
Follow the steps below to set up the project on your local machine.
#Prerequisites - PHP 8.1 or later - Composer - A local development environment such as XAMPP, MAMP, or WAMP - API Platform for software testing such as Postman, or Insomnia
#Installing
- Clone the repository using git clone https://github.com/iamrikie/solutech.git.
- Navigate to the project directory using cd solutech.
- Install the required dependencies using composer install.
- Copy the .env.example file to .env using cp .env.example .env.
- Generate a new application key using php artisan key:generate.
- Configure the database connection in the .env file.
- Migrate the database tables and seeders using php artisan migrate --seed.
- Start the development server using php artisan serve.
#Usage
- Access the application by visiting http://localhost:8000 in your web browser.
- To test the APIs, you can utilize Postman. You may either use the collection I used for testing, which I can provide to you, or create your own. For testing, make use of the URL http://127.0.0.1:8000/api/v1/...
#Steps
-
Create a Collection and give it a name eg. Solutech
-
Create folders under the collection you've created to group endpoints based on the kind of payload each handle. e.g. Task endpoint, Status endpoints, UserTask endpoints, Users endpoint, Auth endpoints.
-
Add requests under each folder you've created. e.g.
With that example, proceed testing the remaining endpoints. Check the api Routes for a better understanding on how to proceed.GET - Retrieve Tasks - http://127.0.0.1:8000/api/v1/tasks
POST - Add Tasks - http://127.0.0.1:8000/api/v1/tasks
GET - Retrieve Tasks By Id - http://127.0.0.1:8000/api/v1/tasks/3
PUT - Update task - http://127.0.0.1:8000/api/v1/tasks/4
DELETE - Delete task - http://127.0.0.1:8000/api/v1/tasks/5
POST - Login - http://127.0.0.1:8000/api/v1/login
- Set Key "Content_Type" and Value "application/json"
- You don't need to provide a token to login or register, but you will need to provide a valid token to log out.
- To generate a valid token, you may use laravel tinker, (run "php artisan tinker" on your terminal to start the tinker cli - Then type the next command "$user = \User::first();" That will return user id: 1 data. Proceed to the next command, "$user->createToken('put-any-name-here');" - That will generate a token. Copy paste it on postman.
- On the "Body" tab select the "raw" option, and enter the login credentials in JSON format.
For example:
{
"email": "[email protected]",
"password": "Password123"
}
Note: Your pass has to be a minimum of 8 characters to be validated as I have defined in the AuthController.
Ps: Code Optimization in Progress...
Laravel [v10]
The results of the API testing below illustrate both the interrelation between users, tasks, and status and the sequence of events in compliance with the provided Entity-Relationship Diagram (ERD).
From this point, I added functionalities for administrators, allowing them to register new users and assign tasks exclusively to regular users(employees), among other capabilities that they could perform from their dashboard. Backend not fully implemented for that but that's the idea