102 lines
3.6 KiB
TypeScript
102 lines
3.6 KiB
TypeScript
import { Body, Controller, Get, Param, Patch, Post, Put, Query, UseGuards } from '@nestjs/common';
|
|
import { ManageClientsService } from './manage-clients.service';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
|
|
import {
|
|
ClientContactControlsDTO,
|
|
CreateClientContactsDTO, CreateClientDataDTO,
|
|
CreateClientLocationsDTO,
|
|
GetClientContactByLacationIdDTO,
|
|
GetClientDTO,
|
|
GetPreparersParamDTO, GetPreparersQueryDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
|
|
} 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('Manage Clients - Oracle')
|
|
@UseGuards(JwtAuthGuard, RolesGuard)
|
|
@Roles('sa')
|
|
@Controller('oracle')
|
|
export class ManageClientsController {
|
|
constructor(private readonly manageClientsService: ManageClientsService) { }
|
|
|
|
|
|
@Post('CreateNewClients')
|
|
async CreateClientData(@Body() body: CreateClientDataDTO) {
|
|
return this.manageClientsService.CreateClientData(body);
|
|
}
|
|
|
|
@Put('UpdateClient')
|
|
async UpdateClient(@Body() body: UpdateClientDTO) {
|
|
return this.manageClientsService.UpdateClient(body);
|
|
}
|
|
|
|
@Put('UpdateClientContacts')
|
|
@Roles('ca','sa')
|
|
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
|
|
return this.manageClientsService.UpdateClientContacts(body);
|
|
}
|
|
|
|
@Put('UpdateClientLocations')
|
|
@Roles('ca','sa')
|
|
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
|
|
return this.manageClientsService.UpdateClientLocations(body);
|
|
}
|
|
|
|
@Post('CreateClientContacts')
|
|
@Roles('ca','sa')
|
|
CreateClientContact(@Body() body: CreateClientContactsDTO) {
|
|
return this.manageClientsService.CreateClientContact(body);
|
|
}
|
|
|
|
@Patch('SetDefaultClientContacts/:P_SPID/:P_CLIENTCONTACTID/:P_USERID')
|
|
SetDefaultClientContacts(@Param() param: ClientContactControlsDTO) {
|
|
return this.manageClientsService.SetDefaultClientContacts(param);
|
|
}
|
|
|
|
@Patch('InactivateClientContacts/:P_SPID/:P_CLIENTCONTACTID/:P_USERID')
|
|
InactivateClientContacts(@Param() param: ClientContactControlsDTO) {
|
|
return this.manageClientsService.InactivateClientContacts(param);
|
|
}
|
|
|
|
@Patch('ReactivateClientContacts/:P_SPID/:P_CLIENTCONTACTID/:P_USERID')
|
|
ReactivateClientContacts(@Param() param: ClientContactControlsDTO) {
|
|
return this.manageClientsService.ReactivateClientContacts(param);
|
|
}
|
|
|
|
@Post('CreateClientLocations')
|
|
@Roles('ca','sa')
|
|
CreateClientLocation(@Body() body: CreateClientLocationsDTO) {
|
|
return this.manageClientsService.CreateClientLocation(body);
|
|
}
|
|
|
|
@Get('GetPreparers/:P_SPID/:P_STATUS')
|
|
async GetPreparers(@Param() param: GetPreparersParamDTO, @Query() query: GetPreparersQueryDTO) {
|
|
return await this.manageClientsService.GetPreparers({ ...param, ...query });
|
|
}
|
|
|
|
@Get('GetPreparerByClientid/:P_SPID/:P_CLIENTID')
|
|
GetPreparerByClientid(@Param() body: GetClientDTO) {
|
|
return this.manageClientsService.GetPreparerByClientid(body);
|
|
}
|
|
|
|
@Get('GetPreparerContactsByClientid/:P_SPID/:P_CLIENTID')
|
|
@Roles('ca','sa')
|
|
GetPreparerContactsByClientid(@Param() body: GetClientDTO) {
|
|
return this.manageClientsService.GetPreparerContactsByClientid(body);
|
|
}
|
|
|
|
@Get('GetPreparerContactsbyClientLocationID/:P_SPID/:P_LOCATIONID')
|
|
@Roles('ca','sa')
|
|
GetPreparerContactsbyClientLocationID(@Param() body: GetClientContactByLacationIdDTO) {
|
|
return this.manageClientsService.GetPreparerContactsbyClientLocationID(body);
|
|
}
|
|
|
|
@Get('GetPreparerLocByClientid/:P_SPID/:P_CLIENTID')
|
|
@Roles('ca','sa')
|
|
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
|
|
return this.manageClientsService.GetPreparerLocByClientid(body);
|
|
}
|
|
}
|