BE/src/pg/param-table/param-table.controller.ts

87 lines
2.7 KiB
TypeScript
Raw Normal View History

2025-09-17 10:18:44 +05:30
import { Body, Controller, Get, Param, Patch, Post, Put, Query, UseGuards } from '@nestjs/common';
import { ApiQuery, ApiTags } from '@nestjs/swagger';
import { ParamTableService } from './param-table.service';
import {
ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO,
getParamValuesDTO, SPID_DTO, UpdateParamRecordDTO
} from 'src/dto/property.dto';
import { Roles } from 'src/decorators/roles.decorator';
import { JwtAuthGuard } from 'src/guards/jwt-auth.guard';
import { RolesGuard } from 'src/guards/roles.guard';
@ApiTags('Param Table - PG')
2025-09-22 17:13:48 +05:30
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles('psa', 'pua')
2025-09-17 10:18:44 +05:30
@Controller('2')
export class ParamTableController {
constructor(private readonly paramTableService: ParamTableService) { }
@Get('/GetParamValues')
2025-09-22 17:13:48 +05:30
@Roles('pca', 'psa', 'pua')
2025-09-17 10:18:44 +05:30
@ApiQuery({
name: 'P_SPID',
required: false,
type: Number,
description: 'The ID of the parameter',
})
@ApiQuery({
name: 'P_PARAMTYPE',
required: false,
type: String,
description: 'The type of the parameter',
})
GETPARAMVALUES(@Query() body: getParamValuesDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.GETPARAMVALUES(body);
}
@Get('/GetAllParamValues')
@ApiQuery({
name: 'P_SPID',
required: false,
type: Number,
description: 'The ID of the parameter',
})
@ApiQuery({
name: 'P_PARAMTYPE',
required: false,
type: String,
description: 'The type of the parameter',
})
GETALLPARAMVALUES(@Query() body: getParamValuesDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.GETALLPARAMVALUES(body);
}
@Get('GetCountriesAndMessages/:P_SPID')
2025-09-22 17:13:48 +05:30
@Roles('pca', 'psa', 'pua')
2025-09-17 10:18:44 +05:30
GET_COUNTRIES_AND_MESSAGES(@Param() body: SPID_DTO) {
return this.paramTableService.GET_COUNTRIES_AND_MESSAGES(body);
}
@Post('/CreateTableRecord')
CREATETABLERECORD(@Body() body: CreateTableRecordDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.CREATETABLERECORD(body);
}
@Post('/CreateParamRecord')
CREATEPARAMRECORD(@Body() body: CreateParamRecordDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.CREATEPARAMRECORD(body);
}
@Patch('/UpdateParamRecord')
UPDATEPARAMRECORD(@Body() body: UpdateParamRecordDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.UPDATEPARAMRECORD(body);
}
@Patch('/InActivateParamRecord')
INACTIVATEPARAMRECORD(@Body() body: ActivateOrInactivateParamRecordDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.INACTIVATEPARAMRECORD(body);
}
@Patch('/ReActivateParamRecord')
REACTIVATEPARAMRECORD(@Body() body: ActivateOrInactivateParamRecordDTO) {
2025-09-17 10:18:44 +05:30
return this.paramTableService.REACTIVATEPARAMRECORD(body);
}
}