From 4ef0840df6581eb9c24b7a3c78f83a876ded542b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Tue, 23 Jul 2024 20:55:01 -0600 Subject: [PATCH] corrigiendo el parametro de lang en las peticiones --- backend/src/category/category.controller.ts | 9 ++------- backend/src/user/user.controller.ts | 8 ++++---- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/backend/src/category/category.controller.ts b/backend/src/category/category.controller.ts index c5395cfc..6c31c945 100644 --- a/backend/src/category/category.controller.ts +++ b/backend/src/category/category.controller.ts @@ -1,4 +1,4 @@ -import { Controller, Get, Post, Body, Param, Delete, UseGuards } from '@nestjs/common'; +import { Controller, Get, Post, Body, Param, Delete, UseGuards, Query } from '@nestjs/common'; import { CategoryService } from './category.service'; import { AuthAdminGuard } from 'src/auth/admin/authAdmin.guard'; import { Roles } from 'src/auth/role.decorator'; @@ -23,15 +23,10 @@ export class CategoryController { } @Get(':lang') - findAll(@Param('lang') lang: LANGUAGES) { + findAll(@Query('lang') lang: LANGUAGES) { return this.categoryService.findAll(lang); } - // @Patch(':id') - // update(@Param('id') id: string, @Body() updateCategoryDto: UpdateCategoryDto) { - // return this.categoryService.update(+id, updateCategoryDto); - // } - @UseGuards(AuthAdminGuard) @Roles(SUPERADMIN_ROLES) @ApiBearerAuth('jwt') diff --git a/backend/src/user/user.controller.ts b/backend/src/user/user.controller.ts index 34e7c6d0..dc2bf5fb 100644 --- a/backend/src/user/user.controller.ts +++ b/backend/src/user/user.controller.ts @@ -1,8 +1,8 @@ -import { Body, Controller, Get, Param, Patch, Req, UseGuards } from '@nestjs/common'; +import { Body, Controller, Get, Patch, Query, Req, UseGuards } from '@nestjs/common'; import { UserService } from './user.service'; import { UpdatePreferedCategoriesDto } from './dto/update-preferedCategories.dto'; import { CustomUserRequest } from 'src/auth/user/interface/customUserReq'; -import { ApiBearerAuth, ApiBody, ApiParam, ApiTags } from '@nestjs/swagger'; +import { ApiBearerAuth, ApiBody, ApiQuery, ApiTags } from '@nestjs/swagger'; import { AuthUserGuard } from 'src/auth/user/authUser.guard'; import { LANGUAGES } from 'src/shared/enum/languages.enum'; @@ -30,9 +30,9 @@ export class UserController { @Get('prefered-categories:lang') @ApiBearerAuth('jwt') - @ApiParam({ name: 'lang', type: String }) + @ApiQuery({ name: 'lang', type: String }) @UseGuards(AuthUserGuard) - async getPreferedCategories(@Req() req: CustomUserRequest, @Param('lang') lang: string) { + async getPreferedCategories(@Req() req: CustomUserRequest, @Query('lang') lang: string) { try { const { email } = req.user; return await this.userService.getPreferedCategories(email, lang as LANGUAGES); -- GitLab