update: change the danak services fetch to another route and accept category id "

query for that
This commit is contained in:
mahyargdz
2025-03-02 15:19:55 +03:30
parent af9f365bc7
commit 4d0344c376
9 changed files with 99 additions and 25 deletions
@@ -1,4 +1,4 @@
import { Body, Controller, Get, HttpCode, HttpStatus, Param, Post, Query } from "@nestjs/common";
import { Body, Controller, Get, HttpCode, HttpStatus, Param, Patch, Post, Query } from "@nestjs/common";
import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { AddReviewDto } from "./DTO/add-review.dto";
@@ -6,7 +6,8 @@ import { CategoryListSearchQueryDto, CategorySearchQueryDto } from "./DTO/catego
import { CreateCategoryDto } from "./DTO/create-category.dto";
import { CreateServiceDto } from "./DTO/create-service.dto";
import { DanakServiceReviewQueryDto } from "./DTO/danak-service-review-query.dto";
import { DanakServicesSearchQueryDto } from "./DTO/danak-services-search-query.dto";
import { DanakServicesQueryDto, DanakServicesSearchQueryDto } from "./DTO/danak-services-search-query.dto";
import { UpdateReviewStatusDto } from "./DTO/update-review-status.dto";
import { DanakServicesService } from "./providers/danak-services.service";
import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
import { Pagination } from "../../common/decorators/pagination.decorator";
@@ -53,12 +54,12 @@ export class DanakServicesController {
return this.danakServicesService.getCategoriesUserSide();
}
@AuthGuards()
@ApiOperation({ summary: "get category services with category id" })
@Get("categories/:id/services")
getCategoryServices(@Param() paramDto: ParamDto) {
return this.danakServicesService.getCategoryServices(paramDto.id);
}
// @AuthGuards()
// @ApiOperation({ summary: "get category services with category id" })
// @Get("categories/:id/services")
// getCategoryServices(@Param() paramDto: ParamDto) {
// return this.danakServicesService.getCategoryServices(paramDto.id);
// }
@AuthGuards()
@PermissionsDec(PermissionEnum.SERVICES)
@@ -85,6 +86,13 @@ export class DanakServicesController {
return this.danakServicesService.getServicesList(queryDto);
}
@ApiOperation({ summary: "get all danak services for user side" })
@AuthGuards()
@Get("public")
getServicesForUser(@Query() queryDto: DanakServicesQueryDto) {
return this.danakServicesService.getServicesListForUser(queryDto);
}
@AuthGuards()
@PermissionsDec(PermissionEnum.SERVICES)
@ApiOperation({ summary: "toggle status of danak service => admin route" })
@@ -124,6 +132,14 @@ export class DanakServicesController {
return this.danakServicesService.getDanakServiceReviews(queryDto);
}
@ApiOperation({ summary: "update danak service review status ==> admin route" })
@AuthGuards()
@PermissionsDec(PermissionEnum.SERVICES)
@Patch("reviews/:id/:status")
updateDanakServiceReviewStatus(@Param() updateParamDto: UpdateReviewStatusDto) {
return this.danakServicesService.updateDanakServiceReviewStatus(updateParamDto);
}
// @AuthGuards()
//
// @ApiOperation({ summary: "get all user purchased danak services" })