Hi,
I have another question about User schemas. Say, I have an eBay or marketplace type app, and a user who initially registers as a buyer on the site. In the code, there is a User
schema with typical fields: :name, :string
and :username, :string
and a schema for BuyerProfile
with the usual fields: delivery_address_1
, delivery_address_2
, delivery_zip_code
, etc., and User
has_one
BuyerProfile
profile relationship. I also create a BuyerProfile
‘belongs_to’ User
relationship.
Later, the same user becomes a Seller as well, and then should have a has_one
relationship with SellerProfile
(SellerProfile
schema could include fields like :tax_code, :string
, etc.)… Is it preferable (scalable?) to maintain a user schema for some users, who could either have a buyer profile, or seller profile or both, as I can see that parts of the code will always have to do checks such as “if user has a buyer profile, then do this or show this…”? Or is it better to define a Role
schema of Buyer
, Seller
and BuyerAndSeller
and make a user belong_to
a Role?
Thanks!