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
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.
0 commit comments