Skip to content

Merge develop to main - Project completion and Docker setup#1

Open
Tomek93x wants to merge 12 commits intomainfrom
develop
Open

Merge develop to main - Project completion and Docker setup#1
Tomek93x wants to merge 12 commits intomainfrom
develop

Conversation

@Tomek93x
Copy link
Owner

@Tomek93x Tomek93x commented Nov 5, 2025

Summary

This PR merges the develop branch into main, completing the Library Service project with full implementation of all required features.

Changes

  • ✅ Implemented Books CRUD (admin permissions)
  • ✅ Implemented Users Service with JWT authentication
  • ✅ Implemented Borrowings Service with filtering and return functionality
  • ✅ Integrated Stripe payment processing
  • ✅ Integrated Telegram notifications
  • ✅ Configured Django-Q for scheduled tasks
  • ✅ Added Docker and docker-compose setup
  • ✅ Updated README with full documentation
  • ✅ Added test coverage (60%+)
  • ✅ Configured Swagger/OpenAPI docs

Testing

  • All tests pass
  • Manual testing completed
  • API endpoints verified via Swagger

Deployment

  • Docker setup tested and working
  • All services (db, redis, web, qcluster) running correctly
  • Environment variables configured via .env

Checklist

  • Code follows PEP8 standards
  • All features implemented according to requirements
  • Tests written and passing
  • Documentation updated
  • Docker setup verified

##Screenshots
Borrow List
Book List
Panel admina Django
Library Service API

- Configure REST Framework with JWT authentication
- Set up custom Authorize header for JWT tokens
- Add Swagger/OpenAPI documentation with drf-spectacular
- Configure Stripe and Telegram API settings
- Set up Django-Q for async task processing
- Add URL routing for all services
- Configure custom User model authentication
- Add custom User model with email as username field
- Implement UserManager for user/superuser creation
- Add user registration endpoint (POST /api/users/register/)
- Add JWT token endpoints (POST /api/users/token/ and /token/refresh/)
- Add user profile management (GET/PATCH /api/users/me/)
- Configure UserSerializer and UserDetailSerializer
- Set up URL routing for users endpoints
- Run initial migrations for User model
- Add Book model with title, author, cover, inventory, daily_fee
- Implement BookSerializer for API representation
- Add BookViewSet with proper permissions (admin-only write, public read)
- Configure admin panel for book management
- Add URL routing for books endpoints (GET/POST/PUT/PATCH/DELETE)
- Add Borrowing model with book, user, dates
- Implement list/detail/create endpoints
- Add filtering by is_active and user_id (admin only)
- Non-admin users see only their own borrowings
- Decrease book inventory on borrowing creation
- Add return endpoint to mark book as returned
- Increase inventory on return
- Prevent returning same book twice
- Add Payment model with status, type, session data
- Create Stripe checkout sessions for borrowings
- Automatically create payment on borrowing creation
- Implement success/cancel payment endpoints
- Add fine payment creation for overdue returns
- Calculate fees based on borrowing days and daily_fee
- Non-admin users see only their own payments
- Display payments in borrowing detail serializer
- Add telegram_helper with notification functions
- Send notification on new borrowing creation
- Send notification on successful payment
- Add scheduled task for daily overdue borrowings check
- Integrate notifications into borrowings and payments services
- Add telegram_helper with notification functions
- Send notification on new borrowing creation
- Send notification on successful payment
- Add scheduled task for daily overdue borrowings check
- Implement management command to set up scheduled tasks
- Integrate notifications into borrowings and payments services
- Add notifications app to INSTALLED_APPS
- Add tests for User registration, JWT authentication, profile management
- Add tests for Book CRUD operations with permission checks
- Add tests for Borrowing creation, filtering, returns, inventory updates
- Add tests for Payment and Stripe integration
- Mock external services (Stripe, Telegram) in tests
- Ensure users see only their own data, admins see all
- Test validation and error cases
- Fix Decimal multiplication in stripe_helper
- Update tests to use Decimal for daily_fee instead of string
- Mock reverse() and Stripe API in payment tests
- All 13 tests passing successfully
- Add Dockerfile and docker-compose.yml with Postgres, Redis, web, and qcluster services
- Update .env.sample for Docker and local development
- Add STATIC_ROOT and PostgreSQL support in settings.py
- Split requirements into requirements.txt (prod) and requirements-dev.txt (dev)
- Remove duplicate and unnecessary dependencies from requirements.txt
- Add psycopg2-binary and redis for Docker/Postgres/Redis support
- Clean up flake8, black, pytest (move to requirements-dev.txt)
- Add .dockerignore

Project can now be started via: docker-compose up --build
- Change PostgreSQL port from 5432 to 5433 to avoid conflicts
- Add setuptools==69.0.0 to requirements.txt for pkg_resources
- Update docker-compose.yml with proper sleep delays for service startup
- Add container_name for easier debugging
- All services (db, redis, web, qcluster) now working correctly
- Docker setup tested and fully functional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant