Description:
In our codebase, we have multiple controller functions that are currently typed as Promise<void>. While working on a recent pull request (#65), a suggestion was made to modify these functions to return data with specific types instead of void. This suggestion was made to improve the consistency and type safety of our codebase.
Tasks:
Modify the controller functions to return data with specific types in the form of JSON responses.
Update the function typings to reflect the changes (e.g., specify more specific response types such as Promise<CustomDataType>).
An example of the suggested code change:
// Before
async function someControllerFunction(req: Request, res: Response): Promise<void> {
// ... existing code
res.status(statusCode).json({ /* some data */ });
}
// After
interface ResponseData {
/* Define the specific structure of the response data */
}
async function someControllerFunction(req: Request, res: Response): Promise<ResponseData> {
// ... existing code
const responseData: ResponseData = { /* some data */ };
return res.status(statusCode).json(responseData);
}
Acceptance Criteria:
Ensure that these changes are consistent across all affected controller functions.
Description: In our codebase, we have multiple controller functions that are currently typed as
Promise<void>
. While working on a recent pull request (#65), a suggestion was made to modify these functions to return data with specific types instead ofvoid
. This suggestion was made to improve the consistency and type safety of our codebase.Tasks:
Promise<CustomDataType>
).An example of the suggested code change:
Acceptance Criteria:
Additional Information: None
Related Dependencies or References:
65