So in my python django application the architecture is structured such that it is separated into different apps. One app for users
, one for finance
, etc.
Each app has the following base structure:
app_name
models
services
tests
I am developing a new feature to support promo codes. Promo codes will allow the user to receive a discount for their upcoming bill(s). So I created a PromoCodeModel
and a PromoCodeService
. Inside the service I need to check if a user is eligible to redeem this code. It seems like this logic could get fairly complicated and I was hoping to encapsulate the eligibility checks into its own class -- something like PromoCodeEligibility(user, promo_code)
.
I was wondering -- where would this belong? Should I create a new PromoCodeEligibilityService
? Or should I create a new folder called domain
and make this a domain object? I could also move this logic into the model
itself but having really fat models seems like more of an anti-pattern to me. Thoughts?