feat: registration jounrey for parents

This commit is contained in:
Abdalhamid Alhamad
2024-12-05 11:14:18 +03:00
parent e4b69a406f
commit 2577f2dcac
97 changed files with 2269 additions and 17 deletions

View File

@ -0,0 +1,26 @@
import { BadRequestException, Injectable } from '@nestjs/common';
import { UserService } from '~/auth/services/user.service';
import { UpdateCustomerRequestDto, UpdateNotificationsSettingsRequestDto } from '../dtos/request';
import { Customer } from '../entities';
import { CustomerRepository } from '../repositories/customer.repository';
@Injectable()
export class CustomerService {
constructor(private readonly userService: UserService, private readonly customerRepository: CustomerRepository) {}
updateNotificationSettings(userId: string, data: UpdateNotificationsSettingsRequestDto) {
return this.userService.updateNotificationSettings(userId, data);
}
async updateCustomer(userId: string, data: UpdateCustomerRequestDto): Promise<Customer> {
await this.customerRepository.updateCustomer(userId, data);
return this.findCustomerById(userId);
}
async findCustomerById(id: string) {
const customer = await this.customerRepository.findOne({ id });
if (!customer) {
throw new BadRequestException('CUSTOMER.NOT_FOUND');
}
return customer;
}
}