updated api's
This commit is contained in:
parent
3eb319f91f
commit
0987fe67ba
40
api.http
40
api.http
@ -1,7 +1,11 @@
|
||||
// GetRegions
|
||||
|
||||
GET http://localhost:3000/oracle/GetRegions
|
||||
|
||||
###
|
||||
|
||||
// InsertRegions
|
||||
|
||||
POST http://localhost:3000/oracle/InsertRegions
|
||||
Content-Type: application/json
|
||||
|
||||
@ -12,6 +16,8 @@ Content-Type: application/json
|
||||
|
||||
###
|
||||
|
||||
//UpdateRegion
|
||||
|
||||
PATCH http://localhost:3000/oracle/UpdateRegion
|
||||
Content-Type: application/json
|
||||
|
||||
@ -20,4 +26,38 @@ Content-Type: application/json
|
||||
"p_name":"p_name"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
// GetAllServiceproviders
|
||||
|
||||
GET http://localhost:3000/oracle/GetAllServiceproviders
|
||||
|
||||
###
|
||||
|
||||
//InsertNewServiceProider
|
||||
|
||||
POST http://localhost:3000/oracle/InsertNewServiceProider
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"p_name": "Service Provider Name",
|
||||
"p_lookupcode": "SP001",
|
||||
"p_address1": "123 Main St",
|
||||
"p_address2": "Suite 100",
|
||||
"p_city": "Anytown",
|
||||
"p_state": "CA",
|
||||
"p_zip": "90210",
|
||||
"p_country": "USA",
|
||||
"p_issuingregion": "Region A",
|
||||
"p_replacementregion": "Region B",
|
||||
"p_bondsurety": "Surety Co.",
|
||||
"p_cargopolicyno": "CP123456",
|
||||
"p_cargosurety": "Cargo Surety Co.",
|
||||
"p_user_id": "user123"
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { Body, Controller, Get, Patch, Post } from '@nestjs/common';
|
||||
import { OracleService } from './oracle.service';
|
||||
import { InsertRegionsDto, UpdateRegionDto } from './oracle.dto';
|
||||
import { InsertNewServiceProviderDTO, InsertRegionsDto, UpdateRegionDto } from './oracle.dto';
|
||||
|
||||
@Controller('oracle')
|
||||
export class OracleController {
|
||||
@ -20,4 +20,29 @@ export class OracleController {
|
||||
updateRegions(@Body() body: UpdateRegionDto) {
|
||||
return this.oarcleService.updateRegions(body.p_regionID, body.p_name);
|
||||
}
|
||||
|
||||
@Get('GetAllServiceproviders')
|
||||
getAllServiceproviders() {
|
||||
return this.oarcleService.getAllServiceproviders();
|
||||
}
|
||||
|
||||
@Post('/InsertNewServiceProvider')
|
||||
insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) {
|
||||
return this.oarcleService.insertNewServiceProider(
|
||||
body.p_name,
|
||||
body.p_lookupcode,
|
||||
body.p_address1,
|
||||
body.p_address2,
|
||||
body.p_city,
|
||||
body.p_state,
|
||||
body.p_zip,
|
||||
body.p_country,
|
||||
body.p_issuingregion,
|
||||
body.p_replacementregion,
|
||||
body.p_bondsurety,
|
||||
body.p_cargopolicyno,
|
||||
body.p_cargosurety,
|
||||
body.p_user_id
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { IsNumber, IsString } from 'class-validator';
|
||||
import { IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class InsertRegionsDto {
|
||||
@IsString()
|
||||
@ -16,3 +16,47 @@ export class UpdateRegionDto {
|
||||
p_name: string;
|
||||
}
|
||||
|
||||
export class InsertNewServiceProviderDTO {
|
||||
@IsString()
|
||||
p_name: string;
|
||||
|
||||
@IsString()
|
||||
p_lookupcode: string;
|
||||
|
||||
@IsString()
|
||||
p_address1: string;
|
||||
|
||||
@IsString()
|
||||
p_address2: string;
|
||||
|
||||
@IsString()
|
||||
p_city: string;
|
||||
|
||||
@IsString()
|
||||
p_state: string;
|
||||
|
||||
@IsString()
|
||||
p_zip: string;
|
||||
|
||||
@IsString()
|
||||
p_country: string;
|
||||
|
||||
@IsString()
|
||||
p_issuingregion: string;
|
||||
|
||||
@IsString()
|
||||
p_replacementregion: string;
|
||||
|
||||
@IsString()
|
||||
p_bondsurety: string;
|
||||
|
||||
@IsString()
|
||||
p_cargopolicyno: string;
|
||||
|
||||
@IsString()
|
||||
p_cargosurety: string;
|
||||
|
||||
@IsString()
|
||||
p_user_id: string;
|
||||
}
|
||||
|
||||
|
||||
@ -424,10 +424,10 @@ export class OracleService {
|
||||
rows = rows.concat(rowsBatch); // Append fetched rows to the main array
|
||||
} while (rowsBatch.length > 0);
|
||||
|
||||
console.log('Rows fetched:', rows);
|
||||
|
||||
// Close the cursor after you're done
|
||||
await cursor.close();
|
||||
|
||||
return rows;
|
||||
} else {
|
||||
throw new Error('No cursor returned from the stored procedure');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user