The Academy Backend project provides a robust backend system for managing students, classes, and progression in a martial arts academy. This system includes features for managing students' personal information, tracking their progress, and handling completed lessons. The backend is integrated with the frontend system, and both repositories should be running simultaneously to ensure synchronization with the database and API endpoints.
- Student Management: Allows for creating and updating student profiles.
- Progress Tracking: Enables tracking students' progress in their martial arts journey.
- Lesson Completion: Manages completed lessons, ensuring students' records are updated.
- Graduation System: Calculates the number of lessons required to promote students to the next belt level.
- Django: A high-level Python web framework used for creating and managing the backend system.
- Ninja: A fast web framework for building APIs with Pydantic and async support.
- SQLite: A lightweight, serverless database used for storing students' data and completed lessons.
To run this project locally, follow the steps below:
-
Clone the repository:
git clone https://github.com/yourusername/academy-backend.git cd academy-backend
-
Create a virtual environment and activate it:
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install the required dependencies:
pip install django pip install pillow pip install django-ninja
-
Run the development server:
python manage.py runserver
-
The API will be available at
http://127.0.0.1:8000
.
The backend exposes several endpoints for managing students and tracking progress.
POST /api/
Create a new student profile by providing their name, email, belt, and birth date.
Request Body Example:
{
"name": "John Doe",
"email": "john.doe@example.com",
"belt": "Blue",
"birth_date": "2000-01-01"
}
GET /api/students/
Retrieve a list of all students.
PUT /api/students/{student_id}
Update an existing student's profile by ID.
Request Body Example:
{
"name": "John Doe Updated",
"belt": "Purple",
"birth_date": "2000-01-01"
}
GET /api/student_progress/
Get a student's progress by providing their email.
Request Parameters:
student_email
: The email address of the student.
POST /api/completed_lesson/
Mark a lesson as completed for a student.
Request Body Example:
{
"qtd": 3,
"email_student": "john.doe@example.com"
}
DELETE /api/students/{student_id}
Delete a student profile by ID.
The backend calculates the number of lessons required to promote a student to the next belt based on the student's current belt and the number of lessons they have completed.
- Current Belts: White (0), Blue (1), Purple (2), Brown (3), Black (4)
- Lesson Calculation: Each belt level has a corresponding lesson requirement, and the system tracks how many lessons remain to achieve the next belt.
The frontend is already available for integration, and both the frontend and backend repositories must be running simultaneously for proper functionality. This ensures synchronization with the database and API endpoints, allowing users to interact with the system through a user-friendly interface.
Frontend repository is HERE.
- IDE used: Visual Studio Code.
- Database viewer used: SQLite Viwer for VS Code.