feat: enhance PowerClamp service and controller to support filtering by date, month, and year

This commit is contained in:
faris Aljohari
2025-04-24 12:46:24 +03:00
parent 881618a4ee
commit 0ee26698ff
4 changed files with 136 additions and 26 deletions

View File

@ -1,9 +1,11 @@
import { Controller, Get, UseGuards } from '@nestjs/common';
import { Controller, Get, Param, Query, UseGuards } from '@nestjs/common';
import { ApiTags, ApiBearerAuth, ApiOperation } from '@nestjs/swagger';
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
import { ControllerRoute } from '@app/common/constants/controller-route';
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
import { PowerClampService } from '../services/power-clamp.service';
import { GetPowerClampDto } from '../dto/get-power-clamp.dto';
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
@ApiTags('Power Clamp Module')
@Controller({
@ -15,12 +17,18 @@ export class PowerClampController {
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get()
@Get(':powerClampUuid')
@ApiOperation({
summary: ControllerRoute.PowerClamp.ACTIONS.GET_ENERGY_SUMMARY,
description: ControllerRoute.PowerClamp.ACTIONS.GET_ENERGY_DESCRIPTION,
})
async getPowerClampData() {
return await this.powerClampService.getPowerClampData();
async getPowerClampData(
@Param('powerClampUuid') powerClampUuid: string,
@Query() params: GetPowerClampDto,
): Promise<BaseResponseDto> {
return await this.powerClampService.getPowerClampData(
powerClampUuid,
params,
);
}
}