This is a Laravel-based API application for tracking users' weight logs, health data, and managing user accounts. It provides endpoints for users to log their weight twice daily (morning and evening), view their historical data, and for admins to manage user data.
- Weight Logging: Users can log their weight for morning and evening each day.
- Health Data Management: Users can store and update their health data.
- User Profiles: Users can manage their profile information.
- Admin Controls: Admins can manage users, view and delete health data, and weight logs.
- Filtering: Weight logs can be filtered by time of day (morning/evening).
- API Documentation: Comprehensive API documentation generated with Scribe.
- Backend Framework: Laravel 11
- API Documentation: Scribe
- Database: MySQL
- Authentication: Sanctum
- Containerization: Docker with Laravel Sail
Ensure you have the following installed on your system:
- Docker
- Laravel Sail
- Composer
- PHP (if running without Docker)
Clone the repository:
git clone https://github.com/your-repository-name.git
cd your-repository-name
Install dependencies:
composer install
Start the application using Laravel Sail:
./vendor/bin/sail up
Run database migrations and seeders:
./vendor/bin/sail artisan migrate --seed
Generate API documentation using Scribe:
./vendor/bin/sail artisan scribe:generate
Access the API documentation
- The generated documentation is available at:
http://localhost/docs
.
Usage
Running Tests Run the test suite to ensure the application is working as expected:
./vendor/bin/sail artisan test
API Endpoints
All endpoints are documented with Scribe. Visit the generated documentation at:
Examples
Creating a Weight Log
POST /api/v1/weight-logs
{
"weight": 75.5,
"time_of_day": "morning",
"logged_at": "2024-12-31T07:30:00"
}
Filtering Weight Logs by Time of Day
GET /api/v1/weight-logs?time_of_day=morning
Updating User Profile
PUT /api/v1/profile
{
"name": "Updated Name",
"email": "[email protected]"
}
If you would like to contribute to this project, feel free to submit a pull request or create an issue.
This project is licensed under the MIT License. See the LICENSE
file for details.
Kennedy Owusu GitHub: kennedyowusu
API Documentation: weightlogapi.kennedyowusu.com