Move API concerns out of `pretix/__init__.py` and cleanup the file
@claude work on this ticket
Claude finished @marcoacierno's task —— View job • claude/issue-3976-20251118-0032 • Create PR ➔
Task Completed ✅
I've successfully moved the API concerns out of pretix/__init__.py and cleaned up the file.
What Was Done
Moved Strawberry GraphQL types from backend/pretix/__init__.py to backend/api/pretix/types.py:
InvoiceInformationErrorsCreateOrderTicketErrorsCreateOrderErrorsCreateOrderTicketAnswerCreateOrderTicketInvoiceInformationCreateOrderInputOrder
Updated imports in:
backend/api/orders/mutations.py- Now imports fromapi.pretix.typesbackend/pretix/tests/test_create_order.py- Now imports fromapi.pretix.typesbackend/pretix/__init__.py- Now imports and re-exports types for backward compatibility
Results:
- ✅ Reduced
pretix/__init__.pyfrom 686 lines to 497 lines (189 lines removed) - ✅ Improved code organization by separating GraphQL API types from HTTP client logic
- ✅ Maintained backward compatibility using
__all__exports - ✅ All imports updated correctly
File Organization
The refactoring creates a clear separation of concerns:
backend/pretix/__init__.py (497 lines)
- Core Pretix HTTP client functions
- API request helpers
- Business logic for orders, vouchers, tickets, etc.
backend/api/pretix/types.py (703 lines)
- All Strawberry GraphQL types and inputs
- API validation logic
- GraphQL-specific data transformations
This follows the project's existing pattern where API concerns live in the api/ directory and domain logic lives in domain-specific packages.
|