Merge branch 'dev' of https://github.com/SyncrowIOT/backend into feature/space-management

This commit is contained in:
hannathkadher
2024-10-30 23:08:51 +04:00
35 changed files with 611 additions and 42 deletions
+31 -2
View File
@@ -8,10 +8,16 @@ import {
Param,
Post,
Put,
Query,
UseGuards,
} from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { AddSceneTapToRunDto, UpdateSceneTapToRunDto } from '../dtos/scene.dto';
import {
AddSceneIconDto,
AddSceneTapToRunDto,
GetSceneDto,
UpdateSceneTapToRunDto,
} from '../dtos/scene.dto';
import { JwtAuthGuard } from '@app/common/guards/jwt.auth.guard';
import { EnableDisableStatusEnum } from '@app/common/constants/days.enum';
import { DeleteSceneParamDto, SceneParamDto, SpaceParamDto } from '../dtos';
@@ -41,9 +47,13 @@ export class SceneController {
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('tap-to-run/:spaceUuid')
async getTapToRunSceneByUnit(@Param() param: SpaceParamDto) {
async getTapToRunSceneByUnit(
@Param() param: SpaceParamDto,
@Query() inHomePage: GetSceneDto,
) {
const tapToRunScenes = await this.sceneService.getTapToRunSceneByUnit(
param.spaceUuid,
inHomePage,
);
return tapToRunScenes;
}
@@ -98,4 +108,23 @@ export class SceneController {
data: tapToRunScene,
};
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Post('icon')
async addSceneIcon(@Body() addSceneIconDto: AddSceneIconDto) {
const tapToRunScene = await this.sceneService.addSceneIcon(addSceneIconDto);
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'Icon added successfully',
data: tapToRunScene,
};
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('icon')
async getAllIcons() {
const icons = await this.sceneService.getAllIcons();
return icons;
}
}