BE/src/oracle/manage-clients/manage-clients.controller.ts

95 lines
3.5 KiB
TypeScript
Raw Normal View History

2025-06-18 17:15:21 +05:30
import { Body, Controller, Get, Param, Patch, Post, Put, Query, UseGuards } from '@nestjs/common';
2025-02-24 10:32:41 +05:30
import { ManageClientsService } from './manage-clients.service';
import { ApiTags } from '@nestjs/swagger';
import {
2025-06-09 16:46:22 +05:30
ClientContactControlsDTO,
2025-02-24 10:32:41 +05:30
CreateClientContactsDTO, CreateClientDataDTO,
CreateClientLocationsDTO,
GetClientContactByLacationIdDTO,
GetClientDTO,
GetPreparersParamDTO, GetPreparersQueryDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
2025-02-24 10:32:41 +05:30
} from 'src/dto/property.dto';
2025-06-17 17:14:27 +05:30
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
2025-06-17 17:14:27 +05:30
@ApiTags('Manage Clients - Oracle')
2025-06-18 17:15:21 +05:30
@UseGuards(JwtAuthGuard, RolesGuard)
2025-06-17 17:14:27 +05:30
@Roles('sa')
2025-02-24 10:32:41 +05:30
@Controller('oracle')
export class ManageClientsController {
constructor(private readonly manageClientsService: ManageClientsService) { }
2025-06-17 17:14:27 +05:30
2025-02-24 10:32:41 +05:30
@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')
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
return this.manageClientsService.UpdateClientContacts(body);
}
@Put('UpdateClientLocations')
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
return this.manageClientsService.UpdateClientLocations(body);
}
@Post('CreateClientContacts')
CreateClientContact(@Body() body: CreateClientContactsDTO) {
return this.manageClientsService.CreateClientContact(body);
}
2025-06-13 12:54:08 +05:30
@Patch('SetDefaultClientContacts/:P_SPID/:P_CLIENTCONTACTID/:P_USERID')
2025-06-09 16:46:22 +05:30
SetDefaultClientContacts(@Param() param: ClientContactControlsDTO) {
return this.manageClientsService.SetDefaultClientContacts(param);
}
2025-06-13 12:54:08 +05:30
@Patch('InactivateClientContacts/:P_SPID/:P_CLIENTCONTACTID/:P_USERID')
2025-06-09 16:46:22 +05:30
InactivateClientContacts(@Param() param: ClientContactControlsDTO) {
return this.manageClientsService.InactivateClientContacts(param);
}
2025-06-13 12:54:08 +05:30
@Patch('ReactivateClientContacts/:P_SPID/:P_CLIENTCONTACTID/:P_USERID')
2025-06-09 16:46:22 +05:30
ReactivateClientContacts(@Param() param: ClientContactControlsDTO) {
return this.manageClientsService.ReactivateClientContacts(param);
}
2025-02-24 10:32:41 +05:30
@Post('CreateClientLocations')
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 });
2025-02-24 10:32:41 +05:30
}
@Get('GetPreparerByClientid/:P_SPID/:P_CLIENTID')
GetPreparerByClientid(@Param() body: GetClientDTO) {
2025-02-24 10:32:41 +05:30
return this.manageClientsService.GetPreparerByClientid(body);
}
@Get('GetPreparerContactsByClientid/:P_SPID/:P_CLIENTID')
GetPreparerContactsByClientid(@Param() body: GetClientDTO) {
2025-02-24 10:32:41 +05:30
return this.manageClientsService.GetPreparerContactsByClientid(body);
}
@Get('GetPreparerContactsbyClientLocationID/:P_SPID/:P_LOCATIONID')
GetPreparerContactsbyClientLocationID(@Param() body: GetClientContactByLacationIdDTO) {
return this.manageClientsService.GetPreparerContactsbyClientLocationID(body);
}
@Get('GetPreparerLocByClientid/:P_SPID/:P_CLIENTID')
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
2025-02-24 10:32:41 +05:30
return this.manageClientsService.GetPreparerLocByClientid(body);
}
}