wfth / wo

0 stars 0 forks source link

Allow visitor to add a sermon to a cart #33

Closed aiwilliams closed 7 years ago

aiwilliams commented 7 years ago
isaacjwilliams commented 7 years ago
┌───────────────────────────────┐   ┌───────────────────────────────┐
│ ┌─────────┐                   │   │ ┌─────────────┐               │
│ │ Visitor │                   │   │ │    Cart     │               │
│┌┴─────────┴──────────────────┐│   │┌┴─────────────┴──────────────┐│
││has_many purchases◀───────┐  ││ ┌─┼▶has_many cart_items          ││
││                          │  ││ │ ││                             ││
││first_name                └──┼┼─┼─┼┤visitor_id                   ││
││last_name                    ││ │ ││tax                          ││
││email                        ││ │ ││total                        ││
│└─────────────────────────────┘│ │ ││purchased_at                 ││
└───────────────────────────────┘ │ ││stripe_charge_id             ││
                                  │ ││shipping information         ││
                                  │ │└─────────────────────────────┘│
┌───────────────────────────────┐ │ └───────────────────────────────┘
│ ┌───────────────┐             │ │
│ │   Cart Item   │             │ │
│┌┴───────────────┴────────────┐│ │
││cart_id ─────────────────────┼┼─┘
││resource_type                ││   ┌───────────────────────────────┐
││resource_id ─────────────────┼┼──▶│    Sermon / Sermon Series     │
││quantity                     ││   └───────────────────────────────┘
││price                        ││
│└─────────────────────────────┘│
└───────────────────────────────┘
isaacjwilliams commented 7 years ago

The context for Visitors is a bit tricky. Should they live in the Carts context, or the Accounts context? The more we add to them, such as Donation history, the more we'll feel like they should be in the Accounts context. But with our current model, they're tied to the Carts context.

isaacjwilliams commented 7 years ago

We have decided to put Visitors in Accounts and cross contexts to reference them in Carts.