This project allows the management of a library via its users, bookings, and books. It is built using the FastAPI web framework and SQLAlchemy for database management.
Clone the repository:
git clone https://github.com/trahvex/MediaproBackendTest
Navigate to the project directory:
cd MediaproBackendTest
Install the required packages:
pip install -r requirements.txt
Start the library app using the following command:
uvicorn app:app --reload
Open your browser and go to http://localhost:8000/docs to access the Swagger UI for the API.
Use the API endpoints to manage users, bookings, and books in the library.
The following API endpoints are available:
- GET /users: Get all users
- GET /users/{user_id}: Get user by ID
- POST /users: Create a new user
- PUT /users/{user_id}: Update user by ID
- DELETE /users/{user_id}: Delete user by ID
- GET /books: Get all books or search by name or author by adding the parameter search to the url. Results are paginated and can be sort by title or author.
- GET /books/{book_id}: Get book by ID
- POST /books: Create a new book
- PUT /books/{book_id}: Update book by ID
- DELETE /books/{book_id}: Delete book by ID
- GET /bookings: Get all bookings
- GET /bookings/{booking_id}: Get booking by ID
- POST /bookings: Create a new booking
- PUT /bookings/{booking_id}: Update booking by ID
- DELETE /bookings/{booking_id}: Delete booking by ID