You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Role-based Access Control (RBAC)
- Added `require_admin` decorator for admin-only routes
- Updated `login_user` route and DB logic to include a `role` field
- Default role set to `user`; fixtures and sample data updated
- Added tests for all RBAC cases (happy path, invalid JWT, non-admin access, etc.)
### Reservations Endpoint
- Implemented `GET /books/{book_id}/reservations` (JWT-protected, admin-only)
- Added tests for valid/invalid book IDs, missing/no auth headers, and non-admin roles
- Log warning and skip reservations referencing non-existent users
- Refactored response structure (`status → state`, nested `message` field, unified body construction)
### Fixtures & Test Infrastructure
- Consolidated `users_db_setup` → `mongo_setup` to reset all collections
- Added fixtures for seeding users/admins with JWTs, books, and reservations
- Cleaned up/reorganized fixtures; fixed imports and test DB usage
- Expanded coverage to 100% with edge case tests
### Refactors & Fixes
- Fixed token return value, forbidden return handling, and test failures
- Standardized response formatting across endpoints
- Spelling/typo corrections, linter/formatter run
0 commit comments