ajaynegi45 / LibraryMan-API

Revolutionize book management with LibraryMan! Easily track stock, borrowers, and due dates, streamlining operations for schools, companies, and libraries worldwide, ensuring efficient and organized book lending.
MIT License
44 stars 49 forks source link

[FEATURE] Enhance Reporting and Analytics Capabilities #102

Closed sanchitc05 closed 2 weeks ago

sanchitc05 commented 3 weeks ago

Fixes #95

๐Ÿ“Š Add Analytics Endpoints with Role-Based Access Control

Overview

This PR introduces new analytics endpoints to LibraryMan-API, providing valuable insights into library operations. The feature is specifically designed for administrators and librarians to track and analyze library usage patterns.

๐Ÿš€ New Features

๐Ÿ”’ Security Updates

.requestMatchers("/api/analytics/**").hasAnyRole("ADMIN", "LIBRARIAN")

๐ŸŽฏ Why This Matters

๐Ÿงช Testing Checklist Please verify the following scenarios:

๐Ÿ“ Example Usage

# Access analytics endpoint (requires ADMIN or LIBRARIAN token)
GET /api/analytics/books
Authorization: Bearer <your-jwt-token>

๐Ÿ” Review Focus Areas

  1. Security configuration in WebConfiguration.java
  2. Role-based access implementation
  3. Integration with existing JWT authentication
  4. Error handling for unauthorized access

๐Ÿ“š Documentation Updates

๐Ÿค Testing Instructions

  1. Clone the branch
  2. Run the application
  3. Test with different user roles:
# Login as ADMIN
POST /api/login
{
  "username": "admin",
  "password": "admin_password"
}

# Try accessing analytics
GET /api/analytics/books

๐Ÿ”„ Dependencies

โš ๏ธ Important Notes

๐ŸŒŸ Future Enhancements

๐Ÿ› Known Issues

๐Ÿ“‹ Checklist

๐Ÿ’ก Questions or suggestions? Feel free to comment below!

๐Ÿ™ Thank you for reviewing this PR. Your feedback is valuable and appreciated!

Guhapriya01 commented 3 weeks ago

error image

It looks like the findByMember_memberId method was removed from the Borrowing Repository. Could you please re-add it?

sanchitc05 commented 3 weeks ago

Oh yeah sure @Guhapriya01

sanchitc05 commented 3 weeks ago

@Guhapriya01 please review the changes and feel free to merge pr if everything looks good.

sanchitc05 commented 2 weeks ago

@Guhapriya01 I have added Page<Borrowings> findByMember_memberId(int memberId, Pageable pageable); please feel free to merge it with required labels.