Skip to content

Commit 6e74d63

Browse files
committed
fix(module): convert request parameter ID to string for consistency in get and update handlers
1 parent c1365d3 commit 6e74d63

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/tbk/src/actions/module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ export const handleGet${className}ById = async (
239239
req: Request<MongoIdSchemaType>,
240240
res: ResponseExtended<Get${className}ByIdResponseSchema>,
241241
) => {
242-
const ${moduleName} = await get${className}ById(req.params.id);
242+
const ${moduleName} = await get${className}ById(req.params.id.toString());
243243
return res.ok?.({
244244
success: true,
245245
data: ${moduleName},
@@ -251,7 +251,7 @@ export const handleUpdate${className} = async (
251251
req: Request<MongoIdSchemaType, unknown, Update${className}SchemaType>,
252252
res: ResponseExtended<Update${className}ResponseSchema>,
253253
) => {
254-
const ${moduleName} = await update${className}(req.params.id, req.body);
254+
const ${moduleName} = await update${className}(req.params.id.toString(), req.body);
255255
return res.ok?.({
256256
success: true,
257257
message: "${className} updated successfully",
@@ -412,7 +412,9 @@ export default ${moduleName}Router.getRouter();
412412
console.log(` └── ${moduleName}.router.ts`);
413413
console.log();
414414
console.log(`Next steps:`);
415-
console.log(` 1. Register the router in your main app file (src/routes/routes.ts)`);
415+
console.log(
416+
` 1. Register the router in your main app file (src/routes/routes.ts)`,
417+
);
416418
console.log(` 2. Customize the model fields in ${moduleName}.model.ts`);
417419
console.log(` 3. Update validation schemas in ${moduleName}.schema.ts`);
418420
console.log(` 4. Add business logic to ${moduleName}.services.ts`);

0 commit comments

Comments
 (0)