Commit 42ca243
committed
refactor(business): Overhaul promo serializers and validation logic
This commit refactors the promotion-related serializers to improve structure, validation, and maintainability, following DRF best practices.
Key changes:
- Removed the separate `PromoValidator` class and integrated its validation logic directly into the serializers. This co-locates validation with the data representation, making the code easier to follow.
- Introduced `BasePromoSerializer` to consolidate common fields and methods, reducing code duplication across create, detail, and read-only serializers.
- Implemented custom `CountryField` and `MultiCountryField` to provide robust, reusable validation for ISO 3166-1 alpha-2 country codes.
- Simplified `PromoListQuerySerializer` by leveraging the new `MultiCountryField` and inheriting from the base pagination serializer, removing manual parameter validation.1 parent e2ad2aa commit 42ca243
2 files changed
+224
-346
lines changed
0 commit comments