adamdoty / homebaker

A baked-goods, birthday-treat, tracking app I made for my wife.
3 stars 0 forks source link

Treat Request by Recipient #41

Closed adamdoty closed 2 years ago

adamdoty commented 2 years ago

@bbelderbos Coupon recipients can request a treat outside of the treat catalogue. For a treat that has been requested by a recipient:

  1. can we use the existing treat model with modifications?
  2. or does this warrant its own treat-request model to keep things simple?
  3. or is there an option to override the treat model and make the necessary modifications?
bbelderbos commented 2 years ago

@adamdoty great question, so thinking about this: treat and user is a many-to-many relationship:

So shall we make a TreatRequest model where both come together (User and Treat foreign key columns), and maybe store the coupon used as a foreign key on that new model / table as well (another foreign key)?

adamdoty commented 2 years ago

A TreatRequest model with a Treat foreign key doesn't make sense to me.

Conceptually what I am going for is a way for users to request a treat that isn't in the catalogue -> that request goes to the baker for approval -> then if it is approved it goes into the catalogue. So in this way its more like an incomplete treat.

I think this might work the easiest as adding a new is_recipient_request Boolean field on the Treat model, but I wasn't sure that this is best practice. SOLID's Single responsibility principle - not sure if having including this field would overcomplicate the model.

bbelderbos commented 2 years ago

Sorry I misunderstood then, this comment clarifies a lot. I will go through the rest now and we can discuss on Slack later as well ...

adamdoty commented 2 years ago

Maybe it would be helpful to create a flow chart?

bbelderbos commented 2 years ago

Yes that would be helpful, thanks