finished scene icons

This commit is contained in:
faris Aljohari
2024-10-22 02:13:53 -05:00
parent 2f23812200
commit c2958498e5
12 changed files with 324 additions and 32 deletions
+34 -4
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';
@@ -39,9 +45,14 @@ export class SceneController {
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('tap-to-run/:unitUuid')
async getTapToRunSceneByUnit(@Param('unitUuid') unitUuid: string) {
const tapToRunScenes =
await this.sceneService.getTapToRunSceneByUnit(unitUuid);
async getTapToRunSceneByUnit(
@Param('unitUuid') unitUuid: string,
@Query() inHomePage: GetSceneDto,
) {
const tapToRunScenes = await this.sceneService.getTapToRunSceneByUnit(
unitUuid,
inHomePage,
);
return tapToRunScenes;
}
@ApiBearerAuth()
@@ -95,4 +106,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;
}
}