Skip to content

Nonkululeko-Ma/Smart-Library

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart-Library-01

Smart Library System

Description

The Smart Library System aims to modernize library operations by providing a comprehensive platform for managing physical and digital resources, facilitating member interactions, and offering enhanced services.

This system will enable:

  • Efficient management of books, journals, and digital media.
  • Streamlined member registration and borrowing processes.
  • Online access to digital content and library resources.
  • Automated notifications and reminders.

Links

Assignment 5:

Assignment 6:

Kanban Board Customization Choices

The Kanban board for this project was customized to align with the specific workflow and quality assurance requirements of the Smart Library System. The following columns were added to the base template:

  • To Do: This column represents the initial stage of tasks that are ready for development but have not yet been started.

  • In Progress: This column tracks tasks that are currently being worked on by the development team.

  • Testing: This column was added to explicitly track tasks that are undergoing quality assurance. This allows the development team to visualize which tasks have been completed from a development standpoint but still require validation before deployment.

  • Blocked: This column is used to highlight tasks that are currently impeded or cannot progress due to external dependencies or unresolved issues. This provides visibility into any bottlenecks or delays in the workflow, enabling the team to address them promptly.

  • Done: This column represents the final stage of tasks that have been completed, tested, and are ready for deployment.

These customizations enhance the board's utility by providing a more detailed view of the task lifecycle and supporting a more robust Agile development process.

Screenshot (3)

Screenshot (4)

Assignment 7:

Assignment 8:

Assignment 9:

Assignment 10:

Assignment 11:

Justification: Repository Layer Design

The repository layer is implemented using a generic Repository interface (repositories/repository.py). This approach leverages Python's typing system (specifically, TypeVar and Generic) to avoid code duplication across entity-specific repositories. For example, instead of writing separate CRUD implementations for Book, LibraryMember, etc., we define the common operations once in the Repository interface and then create entity-specific interfaces (e.g., BookRepository) that inherit from it. This promotes code reuse and maintainability. Each entity-specific repository interface can also define methods unique to that entity (e.g., BookRepository's find_by_title).

Future-Proofing: Adding New Storage Backends

DatabaseBookRepository (SQLite)

The system is designed to easily add new storage backends in the future. As an example, we have created a stub implementation for a DatabaseBookRepository that will save book data to an SQLite database.

You can find the stub implementation here:

SQLite Database File

For SQLite storage, we have also provided a basic database.db file that can be used for storing the data. You can refer to it in the project’s database integration section:

Assignment 12:

πŸ“„ API Documentation

The Smart Library API is documented using FastAPI's Swagger UI, providing interactive and auto-generated docs at runtime.

πŸ”— Access the Swagger UI

Start your FastAPI server and open:

πŸ‘‰ http://127.0.0.1:8000/docs


πŸ“š Endpoints Overview

πŸ”Έ Books

Method Endpoint Description
GET /api/books/ List all books
POST /api/books/ Add a new book
GET /api/books/{id} Get a book by ID
DELETE /api/books/{id} Delete a book by ID

πŸ”Έ Members

Method Endpoint Description
GET /api/members/ List all members
POST /api/members/ Register a new member
GET /api/members/{id} Get a member by ID
DELETE /api/members/{id} Delete a member by ID

πŸ”Έ Reservations

Method Endpoint Description
GET /api/reservations/ List all reservations
POST /api/reservations/ Make a new reservation

πŸ“˜ Smart Library API Documentation

πŸ“Œ Overview

This FastAPI-based Smart Library System offers RESTful endpoints to manage books, library members, and reservations.


πŸ”— Base URL

http://localhost:8000

πŸ“š Endpoints

πŸ“˜ Books

βž• Create Book

  • POST /api/books/
  • Request Body: BookRequest
  • Response: BookResponse
  • Error: 422 (Validation Error)

πŸ“„ List All Books

  • GET /api/books/
  • Response: List[BookResponse]

πŸ” Get Book by ID

  • GET /api/books/{book_id}
  • Response: BookResponse
  • Error: 404 (Book not found)

❌ Delete Book

  • DELETE /api/books/{book_id}
  • Response: Success message
  • Error: 404 (Book not found)

πŸ‘€ Members

βž• Create Member

  • POST /api/members/
  • Request Body: MemberRequest
  • Response: MemberResponse
  • Error: 422 (Validation Error)

πŸ“„ List All Members

  • GET /api/members/
  • Response: List[MemberResponse]

πŸ” Get Member by ID

  • GET /api/members/{member_id}
  • Response: MemberResponse
  • Error: 404 (Member not found)

❌ Delete Member

  • DELETE /api/members/{member_id}
  • Response: Success message
  • Error: 404 (Member not found)

πŸ“ Reservations

βž• Create Reservation

  • POST /api/reservations/
  • Request Body: ReservationRequest
  • Response: ReservationResponse
  • Error: 422 (Validation Error)

πŸ“„ List All Reservations

  • GET /api/reservations/
  • Response: List[ReservationResponse]

πŸ” Get Reservation by ID

  • GET /api/reservations/{reservation_id}
  • Response: ReservationResponse
  • Error: 404 (Reservation not found)

❌ Delete Reservation

  • DELETE /api/reservations/{reservation_id}
  • Response: Success message
  • Error: 404 (Reservation not found)

🧾 Schema Models

πŸ”Ή BookRequest

{
  "isbn": "978-1234567890",
  "title": "Sample Book",
  "publication_year": 2020,
  "authors": ["Author One", "Author Two"],
  "genre": "Fiction",
  "edition": 1,
  "publisher": "Book Publisher",
  "total_copies": 10,
  "available_copies": 10,
  "description": "Optional book description"
}

πŸ”Ή BookResponse

{
  "book_id": "B001",
  "isbn": "978-1234567890",
  "title": "Sample Book",
  "publication_year": 2020,
  "authors": ["Author One", "Author Two"],
  "genre": "Fiction",
  "edition": 1,
  "publisher": "Book Publisher",
  "total_copies": 10,
  "available_copies": 10,
  "description": "Optional book description"
}

πŸ”Ή MemberRequest

{
  "member_id": "M001",
  "first_name": "John",
  "last_name": "Doe",
  "date_of_birth": "1995-08-15",
  "email": "john@example.com",
  "phone_number": "1234567890",
  "address": "123 Main St",
  "membership_date": "2024-01-01",
  "membership_type": "Regular",
  "status": "Active"
}

πŸ”Ή MemberResponse

{
  "member_id": "M001",
  "first_name": "John",
  "last_name": "Doe",
  "date_of_birth": "1995-08-15",
  "email": "john@example.com",
  "phone_number": "1234567890",
  "address": "123 Main St",
  "membership_date": "2024-01-01",
  "membership_type": "Regular",
  "status": "Active"
}

πŸ”Ή ReservationRequest

{
  "reservation_id": "R001",
  "book_id": "B001",
  "member_id": "M001",
  "reservation_date": "2024-05-05"
}

πŸ”Ή ReservationResponse

{
  "reservation_id": "R001",
  "book_id": "B001",
  "member_id": "M001",
  "reservation_date": "2024-05-05"
}

πŸ”Ή ValidationError Example

{
  "detail": [
    {
      "loc": ["body", "title"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

πŸ“· Swagger UI Screenshot

βœ… Launch the server and visit: http://localhost:8000/docs

πŸ“Έ Take a screenshot and save it under your /docs directory as swagger_ui.png


πŸ“ Optional OpenAPI File

If you're exporting the OpenAPI spec:

  • JSON: http://localhost:8000/openapi.json
  • Save it as: /docs/openapi.json or /docs/openapi.yaml

🧾 Swagger UI Screenshot

swagger-ui-screenshot

πŸ“ Project Structure Quick Links

πŸ”— API Endpoints

πŸ§ͺ API Tests

βš™οΈ Service Layer

πŸ§ͺ Service Layer Tests

Assignment 13:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%