This is a scheduling system API built with FastAPI and MongoDB. The system allows users to manage bookings, courses, roles, tutor availabilities, and users.
-
Clone the repository:
git clone <repository-url> cd scheduling-system
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate -
Install the dependencies:
pip install -r requirements.txt
-
Create a .env file in the root directory and add your MongoDB URI:
MONGO_URI=<your-mongodb-uri>
-
Start the FastAPI server:
uvicorn app.main:app --reload
-
Open your browser and navigate to
http://127.0.0.1:8000to see the welcome message. -
Access the API documentation at
http://127.0.0.1:8000/docs.
-
Database: Contains the database connection setup.
-
Models: Contains the data models for the application.
- booking.py: Booking model.
- course.py: Course model.
- role.py: Role model.
- tutor_availability.py: Tutor availability model.
- user.py: User model.
-
Routes: Contains the API routes.
- routes.py: Defines the API endpoints for bookings, courses, roles, tutor availabilities, and users.
-
Schemas: Contains the Pydantic models for request and response validation.
- models.py: Pydantic models for bookings, courses, roles, tutor availabilities, and users.
-
Main: The entry point of the application.
- main.py: Initializes the FastAPI application and includes the router.
-
Bookings
POST /api/bookings: Create a new booking.GET /api/bookings: Get all bookings.GET /api/bookings/{booking_id}: Get a booking by ID.DELETE /api/bookings/{booking_id}: Delete a booking by ID.
-
Courses
POST /api/courses: Create a new course.GET /api/courses: Get all courses.GET /api/courses/{course_id}: Get a course by ID.DELETE /api/courses/{course_id}: Delete a course by ID.
-
Roles
POST /api/roles: Create a new role.GET /api/roles: Get all roles.GET /api/roles/{role_name}: Get a role by name.DELETE /api/roles/{role_name}: Delete a role by name.
-
Tutor Availabilities
POST /api/tutor_availabilities: Create a new tutor availability.GET /api/tutor_availabilities: Get all tutor availabilities.GET /api/tutor_availabilities/{user_id}: Get a tutor availability by user ID.DELETE /api/tutor_availabilities/{user_id}: Delete a tutor availability by user ID.
-
Users
POST /api/users: Create a new user.GET /api/users: Get all users.GET /api/users/{user_id}: Get a user by ID.DELETE /api/users/{user_id}: Delete a user by ID.