modified api again
This commit is contained in:
parent
b263dc2d09
commit
3e0b4e5b97
@ -1,6 +1,6 @@
|
|||||||
import { Injectable } from "@nestjs/common";
|
import { Injectable } from "@nestjs/common";
|
||||||
import { OracleDBService } from "src/db/db.service";
|
import { OracleDBService } from "src/db/db.service";
|
||||||
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO } from "./oracle.dto";
|
import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommBodyDTO, UpdateFeeCommDTO } from "./oracle.dto";
|
||||||
import * as oracledb from 'oracledb';
|
import * as oracledb from 'oracledb';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -842,7 +842,7 @@ export class ManageFeeService {
|
|||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
}
|
}
|
||||||
async UPDATEFEECOMM(body: UpdateFeeCommDTO) {
|
async UPDATEFEECOMM(body: UpdateFeeCommBodyDTO) {
|
||||||
|
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
@ -863,19 +863,19 @@ export class ManageFeeService {
|
|||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
P_FEECOMMID: {
|
P_FEECOMMID: {
|
||||||
val: body.P_FEECOMMID,
|
val:body.p_fees_comm.P_FEECOMMID,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
P_RATE: {
|
P_RATE: {
|
||||||
val: body.P_RATE,
|
val:Number(body.p_fees_comm.P_RATE)|0,
|
||||||
type: oracledb.DB_TYPE_NUMBER
|
type: oracledb.DB_TYPE_NUMBER
|
||||||
},
|
},
|
||||||
P_EFFDATE: {
|
P_EFFDATE: {
|
||||||
val: body.P_EFFDATE,
|
val:body.p_fees_comm.P_EFFDATE,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR
|
||||||
},
|
},
|
||||||
P_USERID: {
|
P_USERID: {
|
||||||
val: body.P_USERID,
|
val:body.p_fees_comm.P_USERID,
|
||||||
type: oracledb.DB_TYPE_NVARCHAR
|
type: oracledb.DB_TYPE_NVARCHAR
|
||||||
},
|
},
|
||||||
P_CURSOR: {
|
P_CURSOR: {
|
||||||
@ -888,16 +888,22 @@ export class ManageFeeService {
|
|||||||
);
|
);
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
let fres = await result.outBinds.p_cursor.getRows();
|
if (result.outBinds && result.outBinds.P_CURSOR) {
|
||||||
|
let fres = await result.outBinds.P_CURSOR.getRows();
|
||||||
|
|
||||||
|
console.log("pcursor: ",fres);
|
||||||
|
|
||||||
return fres
|
return fres
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
console.log("No cursor returned....");
|
||||||
|
return {error:"No cursor found"}
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching users: ', err);
|
console.error('Error fetching users: ', err);
|
||||||
throw new Error('Error fetching users');
|
return{error:err.message}
|
||||||
|
// throw new Error('Error fetching users');
|
||||||
} finally { }
|
} finally { }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get
|
// get
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
|
import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common';
|
||||||
import { OracleService } from './oracle.service';
|
import { OracleService } from './oracle.service';
|
||||||
import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto';
|
import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommBodyDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto';
|
||||||
import { ParamTableService } from './paramTable.service';
|
import { ParamTableService } from './paramTable.service';
|
||||||
import { ManageFeeService } from './manageFee.service';
|
import { ManageFeeService } from './manageFee.service';
|
||||||
import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger';
|
import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
@ -323,7 +323,7 @@ export class OracleController {
|
|||||||
|
|
||||||
@ApiTags('Manage Fee - Oracle')
|
@ApiTags('Manage Fee - Oracle')
|
||||||
@Patch('/UpdateFeeComm')
|
@Patch('/UpdateFeeComm')
|
||||||
UpdateFeeComm(@Body() body: UpdateFeeCommDTO) {
|
UpdateFeeComm(@Body() body: UpdateFeeCommBodyDTO) {
|
||||||
return this.manageFeeService.UPDATEFEECOMM(body)
|
return this.manageFeeService.UPDATEFEECOMM(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { IsEmail, IsNumber, IsOptional, IsString } from 'class-validator';
|
import { IsEmail, IsNumber, IsObject, IsOptional, IsString } from 'class-validator';
|
||||||
|
|
||||||
export class InsertRegionsDto {
|
export class InsertRegionsDto {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@ -682,7 +682,9 @@ export class UpdateEfFeeDTO {
|
|||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Existing UpdateFeeCommDTO
|
||||||
export class UpdateFeeCommDTO {
|
export class UpdateFeeCommDTO {
|
||||||
|
|
||||||
@ApiProperty({ required: true })
|
@ApiProperty({ required: true })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
P_FEECOMMID: number;
|
P_FEECOMMID: number;
|
||||||
@ -700,6 +702,12 @@ export class UpdateFeeCommDTO {
|
|||||||
P_USERID: string;
|
P_USERID: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New UpdateFeeCommBodyDTO
|
||||||
|
export class UpdateFeeCommBodyDTO {
|
||||||
|
@ApiProperty({ type: UpdateFeeCommDTO, required: true }) // Correctly reference UpdateFeeCommDTO
|
||||||
|
p_fees_comm: UpdateFeeCommDTO; // No need for @IsObject()
|
||||||
|
}
|
||||||
|
|
||||||
export class ActivateOrInactivateParamRecordDTO{
|
export class ActivateOrInactivateParamRecordDTO{
|
||||||
|
|
||||||
@ApiProperty({required:true})
|
@ApiProperty({required:true})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user