mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-11-26 16:44:54 +00:00
refactor: enhance customer creation code
This commit is contained in:
@ -2,7 +2,6 @@ import { BadRequestException, Injectable, Logger } from '@nestjs/common';
|
||||
import { Transactional } from 'typeorm-transactional';
|
||||
import { Roles } from '~/auth/enums';
|
||||
import { PageOptionsRequestDto } from '~/core/dtos';
|
||||
import { CustomerNotificationSettings } from '~/customer/entities/customer-notification-settings.entity';
|
||||
import { CustomerService } from '~/customer/services';
|
||||
import { DocumentService, OciService } from '~/document/services';
|
||||
import { UserService } from '~/user/services';
|
||||
@ -42,22 +41,7 @@ export class JuniorService {
|
||||
roles: [Roles.JUNIOR],
|
||||
});
|
||||
|
||||
await this.customerService.createCustomer(
|
||||
{
|
||||
firstName: body.firstName,
|
||||
lastName: body.lastName,
|
||||
dateOfBirth: body.dateOfBirth,
|
||||
junior: Junior.create({
|
||||
id: user.id,
|
||||
guardianId,
|
||||
relationship: body.relationship,
|
||||
civilIdFrontId: body.civilIdFrontId,
|
||||
civilIdBackId: body.civilIdBackId,
|
||||
}),
|
||||
notificationSettings: new CustomerNotificationSettings(),
|
||||
},
|
||||
user,
|
||||
);
|
||||
await this.customerService.createJuniorCustomer(guardianId, user.id, body);
|
||||
|
||||
this.logger.log(`Junior ${user.id} created successfully`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user