Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define "ENUM" type and put values in a loopback model itself?

Tags:

loopbackjs

How to define "ENUM" type and put values in a model itself? If thats not possible, then in the documentation, its mentioned to use enum like this https://loopback.io/doc/en/lb3/MySQL-connector.html#enum But where should I put this code as per best practice ?


1 Answers

You could add custom validation to your model, so it would check if the value you're passing is correct. You can find a more elaborated answer here:

Can I define a custom validation with options for Loopback?

like image 79
akkonrad Avatar answered Oct 29 '25 18:10

akkonrad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!