How do you use an Enum in your model? #87
-
Hello, I was wondering how to incorporate an Enum into a model? Would it be best to be explicit using the type of data contained in the Enum (i.e. String)?
Or is there a way to make it work using the t.field function?
Thanks for the awesome library! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Figured it out... First, create an enumType as part of your model
Second, can use t.field like so...
|
Beta Was this translation helpful? Give feedback.
Figured it out...
First, create an enumType as part of your model
export const ChatStatusEnumType = enumType(ChatStatus);
Second, can use t.field like so...
t.field(Saver.chatStatus.name, { type: ChatStatus.name });