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

87 lines
2.5 KiB
TypeScript
Raw Normal View History

2025-06-18 17:15:21 +05:30
import { Body, Controller, Get, Patch, Post, Put, Query, UseGuards } from '@nestjs/common';
2025-02-24 10:32:41 +05:30
import { ApiQuery, ApiTags } from '@nestjs/swagger';
import { ParamTableService } from './param-table.service';
2025-06-17 17:14:27 +05:30
import {
ActivateOrInactivateParamRecordDTO, CreateParamRecordDTO, CreateTableRecordDTO,
getParamValuesDTO, UpdateParamRecordDTO
} from 'src/dto/property.dto';
import { Roles } from 'src/decorators/roles.decorator';
2025-06-18 17:15:21 +05:30
import { JwtAuthGuard } from 'src/guards/jwt-auth.guard';
import { RolesGuard } from 'src/guards/roles.guard';
2025-02-24 10:32:41 +05:30
@ApiTags('Param Table - Oracle')
2025-07-22 20:43:57 +05:30
@UseGuards(JwtAuthGuard, RolesGuard)
2025-06-17 17:14:27 +05:30
@Roles('sa', 'ua')
2025-02-24 10:32:41 +05:30
@Controller('oracle')
export class ParamTableController {
constructor(private readonly paramTableService: ParamTableService) { }
@Get('/GetParamValues')
2025-06-17 17:14:27 +05:30
@Roles('ca', 'sa', 'ua')
2025-02-24 10:32:41 +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) {
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) {
return this.paramTableService.GETALLPARAMVALUES(body);
}
@Get('GetCountriesAndMessages')
2025-07-22 20:43:57 +05:30
@Roles('ca', 'sa', 'ua')
GET_COUNTRIES_AND_MESSAGES() {
2025-07-21 21:09:33 +05:30
return this.paramTableService.GET_COUNTRIES_AND_MESSAGES();
}
2025-02-24 10:32:41 +05:30
@Post('/CreateTableRecord')
createTableRecord(@Body() body: CreateTableRecordDTO) {
return this.paramTableService.CREATETABLERECORD(body);
}
@Post('/CreateParamRecord')
createParamRecord(@Body() body: CreateParamRecordDTO) {
return this.paramTableService.CREATEPARAMRECORD(body);
}
@Patch('/UpdateParamRecord')
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
return this.paramTableService.UPDATEPARAMRECORD(body);
}
@Patch('/InActivateParamRecord')
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
return this.paramTableService.INACTIVATEPARAMRECORD(body);
}
@Patch('/ReActivateParamRecord')
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
return this.paramTableService.REACTIVATEPARAMRECORD(body);
}
}