Spaces:
Running
Running
Merge pull request #69 from Modarb-Ai-Trainer/update
Browse fileschore: Add SwaggerQuery decorator for exercises list endpoint
src/modules/users/modules/exercises/controllers/exercises.controller.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { SwaggerGet } from "@lib/decorators/swagger-routes.decorator";
|
|
| 14 |
import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
|
| 15 |
import { SwaggerSummary } from "@lib/decorators/swagger-summary.decorator";
|
| 16 |
import { SwaggerDescription } from "@lib/decorators/swagger-description.decorator";
|
|
|
|
| 17 |
|
| 18 |
@Controller("/user/exercises")
|
| 19 |
@ControllerMiddleware(UsersGuardMiddleware())
|
|
@@ -30,6 +31,10 @@ export class UsersExerciseController extends BaseController {
|
|
| 30 |
@SwaggerResponse([ExercisePopulateSerialization])
|
| 31 |
@SwaggerSummary("List exercises")
|
| 32 |
@SwaggerDescription("List all exercises")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
list = async (req: Request, res: Response): Promise<Response> => {
|
| 34 |
const paginationQuery = parsePaginationQuery(req.query);
|
| 35 |
const { docs, paginationData } = await this.exercisesService.list(
|
|
@@ -79,7 +84,7 @@ export class UsersExerciseController extends BaseController {
|
|
| 79 |
);
|
| 80 |
};
|
| 81 |
|
| 82 |
-
@SwaggerGet()
|
| 83 |
@SwaggerResponse([ExercisePopulateSerialization])
|
| 84 |
@SwaggerSummary("Search")
|
| 85 |
@SwaggerDescription("Search for exercises")
|
|
|
|
| 14 |
import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
|
| 15 |
import { SwaggerSummary } from "@lib/decorators/swagger-summary.decorator";
|
| 16 |
import { SwaggerDescription } from "@lib/decorators/swagger-description.decorator";
|
| 17 |
+
import { SwaggerQuery } from "@lib/decorators/swagger-query.decorator";
|
| 18 |
|
| 19 |
@Controller("/user/exercises")
|
| 20 |
@ControllerMiddleware(UsersGuardMiddleware())
|
|
|
|
| 31 |
@SwaggerResponse([ExercisePopulateSerialization])
|
| 32 |
@SwaggerSummary("List exercises")
|
| 33 |
@SwaggerDescription("List all exercises")
|
| 34 |
+
@SwaggerQuery({
|
| 35 |
+
limit: "number",
|
| 36 |
+
|
| 37 |
+
})
|
| 38 |
list = async (req: Request, res: Response): Promise<Response> => {
|
| 39 |
const paginationQuery = parsePaginationQuery(req.query);
|
| 40 |
const { docs, paginationData } = await this.exercisesService.list(
|
|
|
|
| 84 |
);
|
| 85 |
};
|
| 86 |
|
| 87 |
+
@SwaggerGet('/search')
|
| 88 |
@SwaggerResponse([ExercisePopulateSerialization])
|
| 89 |
@SwaggerSummary("Search")
|
| 90 |
@SwaggerDescription("Search for exercises")
|