@@ -50,87 +50,5 @@ export class EquipmentController implements Routes {
5050 return ctx . json ( { success : true , data : response } )
5151 }
5252 )
53- // this.controller.openapi(
54- // createRoute({
55- // method: 'get',
56- // path: '/equipments/{equipmentName}/exercises',
57- // tags: ['Equipments'],
58- // summary: 'Retrive exercises by equipments',
59- // description: 'Retrive list of all equipments.',
60- // operationId: 'getExercisesByEquipment',
61- // request: {
62- // params: z.object({
63- // equipmentName: z.string().openapi({
64- // description: 'equipments name',
65- // type: 'string',
66- // example: 'body weight',
67- // default: 'body weight'
68- // })
69- // }),
70- // query: z.object({
71- // offset: z.coerce.number().nonnegative().optional().openapi({
72- // title: 'Offset',
73- // description:
74- // 'The number of exercises to skip from the start of the list. Useful for pagination to fetch subsequent pages of results.',
75- // type: 'number',
76- // example: 10,
77- // default: 0
78- // }),
79- // limit: z.coerce.number().positive().max(100).optional().openapi({
80- // title: 'Limit',
81- // description:
82- // 'The maximum number of exercises to return in the response. Limits the number of results for pagination purposes.',
83- // maximum: 100,
84- // minimum: 1,
85- // type: 'number',
86- // example: 10,
87- // default: 10
88- // })
89- // })
90- // },
91- // responses: {
92- // 200: {
93- // description: 'Successful response with list of all exercises.',
94- // content: {
95- // 'application/json': {
96- // schema: z.object({
97- // success: z.boolean().openapi({
98- // description: 'Indicates whether the request was successful',
99- // type: 'boolean',
100- // example: true
101- // }),
102- // data: z.array(ExerciseModel).openapi({
103- // description: 'Array of Exercises.'
104- // })
105- // })
106- // }
107- // }
108- // },
109- // 500: {
110- // description: 'Internal server error'
111- // }
112- // }
113- // }),
114- // async (ctx) => {
115- // const { offset, limit = 10 } = ctx.req.valid('query')
116- // const search = ctx.req.param('equipmentName')
117- // const { origin, pathname } = new URL(ctx.req.url)
118- // const response = await this.equipmentService.getExercisesByEquipment({ offset, limit, search })
119- // return ctx.json({
120- // success: true,
121- // data: {
122- // previousPage:
123- // response.currentPage > 1
124- // ? `${origin}${pathname}?offset=${(response.currentPage - 1) * limit}&limit=${limit}`
125- // : null,
126- // nextPage:
127- // response.currentPage < response.totalPages
128- // ? `${origin}${pathname}?offset=${response.currentPage * limit}&limit=${limit}`
129- // : null,
130- // ...response
131- // }
132- // })
133- // }
134- // )
13553 }
13654}
0 commit comments