-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Addd a better api-front contract declaration
- Loading branch information
Maxime Naulleau
committed
Dec 17, 2024
1 parent
ec83a46
commit 7198f0c
Showing
8 changed files
with
262 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
apps/api/src/shared-kernel/adapters/primary/nestjs/controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { RestContract } from 'shared-models/models/endpoints/common'; | ||
|
||
export type IController<C extends RestContract> = { | ||
[K in keyof C['endpoints']]: ( | ||
params: C['endpoints'][K]['params'], | ||
body: C['endpoints'][K]['body'] extends FormData | ||
? Express.Multer.File | ||
: C['endpoints'][K]['body'], | ||
) => Promise<C['endpoints'][K]['response']>; | ||
}; | ||
|
||
export type IControllerPaths<C extends RestContract> = { | ||
[K in keyof C['endpoints']]: C['endpoints'][K]['path']; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.