Hey all, let's say I have a model like: `UserActiv...
# orm-help
j
Hey all, let's say I have a model like:
UserActivity{
type:String!
target: Int!
unit: String!
}
type has enums like {Drinking Water, Yoga} etc. If type is Drinking Water can I set unit to litres predefined. For yoga it has to be minutes. How can I do this ?
r
If you want it to remain in a single model, then you would need to conditionally add the value based on what you get from the frontend.
💯 1
j
Thanks Ryan. That helps 😁. Is this the best way to do this? I am just curious.
r
Another way could also be creating a separate table to map those values with the enums. This would be better for separation, but you would need to add an extra layer when querying for the item and value 😄
👍 1
j
This sounds bit challenging. Will give it a try. Thank you 😀
🙌 1