register mail added from BE

This commit is contained in:
Kallesh B S 2025-07-29 19:44:51 +05:30
parent 608eafd616
commit c5b5a8e541
2 changed files with 18 additions and 6 deletions

View File

@ -1,12 +1,12 @@
import { Module } from '@nestjs/common'; import { forwardRef, Module } from '@nestjs/common';
import { UserMaintenanceController } from './user-maintenance.controller'; import { UserMaintenanceController } from './user-maintenance.controller';
import { UserMaintenanceService } from './user-maintenance.service'; import { UserMaintenanceService } from './user-maintenance.service';
import { AuthModule } from 'src/auth/auth.module'; import { AuthModule } from 'src/auth/auth.module';
@Module({ @Module({
imports: [AuthModule], imports: [forwardRef(() => AuthModule)],
controllers: [UserMaintenanceController], controllers: [UserMaintenanceController],
providers: [UserMaintenanceService], providers: [UserMaintenanceService],
exports: [UserMaintenanceService] exports: [UserMaintenanceService, AuthModule]
}) })
export class UserMaintenanceModule { } export class UserMaintenanceModule { }

View File

@ -1,4 +1,4 @@
import { Injectable, Logger } from '@nestjs/common'; import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
import { OracleDBService } from 'src/db/db.service'; import { OracleDBService } from 'src/db/db.service';
import { InternalServerException } from 'src/exceptions/internalServerError.exception'; import { InternalServerException } from 'src/exceptions/internalServerError.exception';
import * as oracledb from 'oracledb'; import * as oracledb from 'oracledb';
@ -10,6 +10,8 @@ import {
CreateClientLoginsDTO, CreateSPLoginsDTO, CreateUSCIBLoginsDTO, SPID_CLIENTID_DTO, SPID_EMAIL_DTO CreateClientLoginsDTO, CreateSPLoginsDTO, CreateUSCIBLoginsDTO, SPID_CLIENTID_DTO, SPID_EMAIL_DTO
} from 'src/dto/property.dto'; } from 'src/dto/property.dto';
import { BadRequestException } from 'src/exceptions/badRequest.exception'; import { BadRequestException } from 'src/exceptions/badRequest.exception';
import { AuthService } from 'src/auth/auth.service';
import { MailTypeDTO } from 'src/auth/auth.dto';
interface RoleDetail { [key: string]: any; } interface RoleDetail { [key: string]: any; }
@ -29,7 +31,11 @@ export class UserMaintenanceService {
private readonly logger = new Logger(UserMaintenanceService.name); private readonly logger = new Logger(UserMaintenanceService.name);
constructor(private readonly oracleDBService: OracleDBService) { } constructor(
private readonly oracleDBService: OracleDBService,
@Inject(forwardRef(() => AuthService))
private readonly authService: AuthService
) { }
async GetSPUserDetails(body: USERID_DTO): Promise<any> { async GetSPUserDetails(body: USERID_DTO): Promise<any> {
let connection; let connection;
@ -386,7 +392,13 @@ export class UserMaintenanceService {
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return { statusCode: 201, message: "Created successfully", ...fres[0] }; const mailRes = await this.authService.sendMail({ P_TO: body.P_USERID, P_MAIL_TYPE: MailTypeDTO.REGISTER_CLIENT })
if (mailRes.statusCode !== 200) {
return new InternalServerException();
}
return { statusCode: 201, message: "Client registration initiated successfully", ...fres[0] };
} catch (error) { } catch (error) {
handleError(error, UserMaintenanceService.name) handleError(error, UserMaintenanceService.name)