forked from Yara724/api
Fix SMS, and added pagination+sorting+searching for GETs
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
InternalServerErrorException,
|
||||
Param,
|
||||
Put,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from "@nestjs/common";
|
||||
import { ApiBearerAuth, ApiBody, ApiOperation, ApiParam, ApiTags } from "@nestjs/swagger";
|
||||
@@ -15,6 +16,8 @@ import { Roles } from "src/decorators/roles.decorator";
|
||||
import { CurrentUser } from "src/decorators/user.decorator";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
import { ExpertBlameService } from "./expert-blame.service";
|
||||
import { ListQueryV2Dto } from "src/common/dto/list-query-v2.dto";
|
||||
import { AllRequestDtoRsV2 } from "./dto/all-request.dto";
|
||||
import { SubmitReplyDto } from "./dto/reply.dto";
|
||||
import { ResendRequestDto } from "./dto/resend.dto";
|
||||
|
||||
@@ -27,9 +30,17 @@ export class ExpertBlameV2Controller {
|
||||
constructor(private readonly expertBlameService: ExpertBlameService) { }
|
||||
|
||||
@Get()
|
||||
async findAll(@CurrentUser() actor: any) {
|
||||
@ApiOperation({
|
||||
summary: "List blame cases for field expert (V2)",
|
||||
description:
|
||||
"Optional query: `search`, `sortBy` (publicId | createdAt | requestNo | status), `sortOrder`, `page`, `limit`. Without `page`/`limit`, returns the full filtered list.",
|
||||
})
|
||||
async findAll(
|
||||
@CurrentUser() actor: any,
|
||||
@Query() query: ListQueryV2Dto,
|
||||
): Promise<AllRequestDtoRsV2> {
|
||||
try {
|
||||
return await this.expertBlameService.findAllV2(actor);
|
||||
return await this.expertBlameService.findAllV2(actor, query);
|
||||
} catch (error) {
|
||||
if (error instanceof HttpException) throw error;
|
||||
throw new InternalServerErrorException(
|
||||
|
||||
Reference in New Issue
Block a user