diff --git a/api.http b/api.http index 465edfd..b5e8612 100644 --- a/api.http +++ b/api.http @@ -36,12 +36,7 @@ GET http://localhost:3000/oracle/GetAllServiceproviders //GetSelectedServiceprovider -GET http://localhost:3000/oracle/GetSelectedServiceprovider -Content-Type: application/json - -{ - "p_spid":12 -} +GET http://localhost:3000/oracle/GetSelectedServiceprovider/12 ### @@ -96,17 +91,14 @@ Content-Type: application/json //GetSPcontacts -GET http://localhost:3000/oracle/GetSPcontacts -Content-Type: application/json - -{ - "p_SPid":12 -} +GET http://localhost:3000/oracle/GetSPcontacts/12 ### //GetSPDefaultcontact +GET http://localhost:3000/oracle/GetSPDefaultcontact/12 + ### //InsertSPContacts @@ -149,12 +141,13 @@ Content-Type: application/json //SetSPDefaultcontact +POST http://localhost:3000/oracle/SetSPDefaultcontact/12 ### //InactivateSPContact - +POST http://localhost:3000/oracle/InactivateSPContact/12 ### diff --git a/src/oracle/oracle.controller.ts b/src/oracle/oracle.controller.ts index 8bfa926..9d3a718 100644 --- a/src/oracle/oracle.controller.ts +++ b/src/oracle/oracle.controller.ts @@ -1,4 +1,4 @@ -import { Body, Controller, Get, Patch, Post, Put } from '@nestjs/common'; +import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put } from '@nestjs/common'; import { OracleService } from './oracle.service'; import { GetSelectedServiceProviderDTO, GetSPcontactsDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto'; @@ -26,9 +26,9 @@ export class OracleController { return this.oarcleService.getAllServiceproviders(); } - @Get('/GetSelectedServiceprovider') - getSelectedServiceprovider(@Body() body: GetSelectedServiceProviderDTO) { - return this.oarcleService.getSelectedServiceprovider(body.p_spid); + @Get('/GetSelectedServiceprovider/:id') + getSelectedServiceprovider(@Param('id', ParseIntPipe) id:number) { + return this.oarcleService.getSelectedServiceprovider(id); } @Post('/InsertNewServiceProvider') @@ -72,12 +72,17 @@ export class OracleController { ) } - @Get('/GetSPcontacts') - getSPcontacts(@Body() body: GetSPcontactsDTO) { - return this.oarcleService.getSPcontacts(body.p_SPid); + @Get('/GetSPcontacts/:id') + getSPcontacts(@Param('id', ParseIntPipe) id:number) { + return this.oarcleService.getSPcontacts(id); } - @Post('InsertSPContacts') + @Get('/GetSPDefaultcontact/:id') + getSPDefaultcontact(@Param('id', ParseIntPipe) id:number){ + return this.oarcleService.getSPDefaultcontact(id) + } + + @Post('/InsertSPContacts') insertSPContacts(@Body() body: InsertSPContactsDTO){ return this.oarcleService.insertSPContacts( body.p_spid, @@ -92,7 +97,7 @@ export class OracleController { ) } - @Put('UpdateSPContacts') + @Put('/UpdateSPContacts') updateSPContacts(@Body() body: UpdateSPContactsDTO){ return this.oarcleService.updateSPContacts( body.p_spcontactid, @@ -106,4 +111,16 @@ export class OracleController { body.p_user_id ) } + + @Post('/SetSPDefaultcontact/:id') + setSPDefaultcontact(@Param('id', ParseIntPipe) id:number){ + return this.oarcleService.setSPDefaultcontact(id) + } + + @Post('/InactivateSPContact/:id') + inactivateSPContact(@Param('id', ParseIntPipe) id:number){ + return this.oarcleService.inactivateSPContact(id) + } + + }