Replies: 3 comments
-
Hi there, I am in the same boat. What was your solution in the end ? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I guess a custom ts-morph script might be the best approach here |
Beta Was this translation helpful? Give feedback.
0 replies
-
@jakobsuckow do you mind sharing what your solution with ts-morph looks like? Running into exactly the same issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys
I'm interested in how you manage DTO and DAO layers with
kysely-codegen
?Since
codegen
returns interfaces, not classes, you can't just take and use them in the same@nestjs/swagger
because it takes in a class to type methods.Now I have this structure:
— Controller(args:
RequestDto
):ResponseDto
— Service(args:
RequestDto
):ResponseDto
— Dao(args:
PartOfDatabaseInterface
):ResponseInterface
And this is the most interesting part:
— Dao(args:
PartOfDatabaseInterface
):ResponseInterface
Since
codegen
generates interfaces, not classes, I need to rewrite everything that is inResponseInterface
, which automatically generateskysely-codegen
— into exactly the same data, but wrapped inclass
It looks like a hack, but I have not yet found another use to comply with the following practices:
— Have clearly delimited
Request DTO
that serialize and validate incoming data— Have strict
Response DTO
, which always reflects with 100% accuracy what the backend returns— Avoid duplicates of interfaces and classes for the cleanest code
@RobinBlomberg — I sincerely apologize for mentioning you, but just so I can increase my chances that this post will not disappear, because it is the only one in discussions
Beta Was this translation helpful? Give feedback.
All reactions