How to register multiple enum types in type-graphql

Viewed 12

According to the type-graph docs https://typegraphql.com/docs/enums.html, each time I have to create an enum type I have to register it using the function registerEnumType.

we need to make TypeGraphQL aware of the enums manually by calling the registerEnumType function and providing the enum name for GraphQL

This function only takes one enum type as parameter. What is the best practice to create multiple enum types and register them in my schema. Do I have to create a file with all enum types and a method registerAllEnum that register all of them by calling registerEnumType on each and then on server launch I call the method registerAllEnum each time I launch the server or is there a better way around this. I am also wondering if it affects performance suppose I have to register dozens of enum types at launch.

0 Answers
Related