mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-10 07:07:21 +00:00
Compare commits
1 Commits
5cf45c30f4
...
hotfix/pow
Author | SHA1 | Date | |
---|---|---|---|
906ee1f25a |
@ -501,12 +501,15 @@ export class ControllerRoute {
|
||||
};
|
||||
static PowerClamp = class {
|
||||
public static readonly ROUTE = 'power-clamp';
|
||||
|
||||
static ACTIONS = class {
|
||||
public static readonly GET_ENERGY_SUMMARY =
|
||||
'Get power clamp historical data';
|
||||
public static readonly GET_ENERGY_DESCRIPTION =
|
||||
'This endpoint retrieves the historical data of a power clamp device based on the provided parameters.';
|
||||
public static readonly GET_ENERGY_BY_COMMUNITY_OR_SPACE_SUMMARY =
|
||||
'Get power clamp historical data by community or space';
|
||||
public static readonly GET_ENERGY_BY_COMMUNITY_OR_SPACE_DESCRIPTION =
|
||||
'This endpoint retrieves the historical data of power clamp devices based on the provided community or space UUID.';
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1,18 +1,24 @@
|
||||
import { ControllerRoute } from '@app/common/constants/controller-route';
|
||||
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
|
||||
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
|
||||
import { Controller, Get, Param, Query, UseGuards } from '@nestjs/common';
|
||||
import {
|
||||
ApiTags,
|
||||
ApiBearerAuth,
|
||||
ApiOperation,
|
||||
ApiParam,
|
||||
ApiQuery,
|
||||
ApiTags,
|
||||
} 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 {
|
||||
GetPowerClampBySpaceDto,
|
||||
GetPowerClampDto,
|
||||
} from '../dto/get-power-clamp.dto';
|
||||
import {
|
||||
PowerClampParamsDto,
|
||||
ResourceParamsDto,
|
||||
} from '../dto/power-clamp-params.dto';
|
||||
import { PowerClampService } from '../services/power-clamp.service';
|
||||
import { GetPowerClampDto } from '../dto/get-power-clamp.dto';
|
||||
import { BaseResponseDto } from '@app/common/dto/base.response.dto';
|
||||
import { PowerClampParamsDto } from '../dto/power-clamp-params.dto';
|
||||
|
||||
@ApiTags('Power Clamp Module')
|
||||
@Controller({
|
||||
version: EnableDisableStatusEnum.ENABLED,
|
||||
@ -20,7 +26,6 @@ import { PowerClampParamsDto } from '../dto/power-clamp-params.dto';
|
||||
})
|
||||
export class PowerClampController {
|
||||
constructor(private readonly powerClampService: PowerClampService) {}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':powerClampUuid/historical')
|
||||
@ -39,4 +44,34 @@ export class PowerClampController {
|
||||
): Promise<BaseResponseDto> {
|
||||
return await this.powerClampService.getPowerClampData(params, query);
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('historical')
|
||||
@ApiOperation({
|
||||
summary:
|
||||
ControllerRoute.PowerClamp.ACTIONS
|
||||
.GET_ENERGY_BY_COMMUNITY_OR_SPACE_SUMMARY,
|
||||
description:
|
||||
ControllerRoute.PowerClamp.ACTIONS
|
||||
.GET_ENERGY_BY_COMMUNITY_OR_SPACE_DESCRIPTION,
|
||||
})
|
||||
@ApiQuery({
|
||||
name: 'spaceUuid',
|
||||
description: 'UUID of the Space',
|
||||
required: false,
|
||||
})
|
||||
@ApiQuery({
|
||||
name: 'communityUuid',
|
||||
description: 'UUID of the Community',
|
||||
required: false,
|
||||
})
|
||||
async getPowerClampDataBySpaceOrCommunity(
|
||||
@Query() params: ResourceParamsDto,
|
||||
@Query() query: GetPowerClampBySpaceDto,
|
||||
): Promise<BaseResponseDto> {
|
||||
return await this.powerClampService.getPowerClampDataBySpaceOrCommunity(
|
||||
params,
|
||||
query,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user