Importing country codes as an enum

What solutions do you recommend to deal with country field for a user profile? i was thinking about creating an enum file in the utils which i could use to import both on the frontend and the backend (prisma / postgres ) but the docs mention only hardcoding enums in the prisma.schema field (https://www.prisma.io/docs/concepts/components/prisma-schema/data-model#defining-enums) What is the best approach to avoid duplicate code? Any tips would be appreciated! Thanks!
Prisma
Data model (Reference)
Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.
1 Reply
Pod
Pod3y ago
If it were me, I would just make a json file with all possible codes, then store it as plaintext in your db That way it's nice and easy to make dropdowns or whatever you need
Want results from more Discord servers?
Add your server