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,2 @@
export * from './update-customer.request.dto';
export * from './update-notifications-settings.request.dto';

View File

@ -0,0 +1,29 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';
import { i18nValidationMessage as i18n } from 'nestjs-i18n';
import { IsAbove18 } from '~/core/decorators/validations';
export class UpdateCustomerRequestDto {
@ApiProperty({ example: 'John' })
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'customer.firstName' }) })
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'customer.firstName' }) })
@IsOptional()
firstName!: string;
@ApiProperty({ example: 'Doe' })
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'customer.lastName' }) })
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'customer.lastName' }) })
@IsOptional()
lastName!: string;
@ApiProperty({ example: 'JO' })
@IsString({ message: i18n('validation.IsString', { path: 'general', property: 'customer.countryOfResidence' }) })
@IsNotEmpty({ message: i18n('validation.IsNotEmpty', { path: 'general', property: 'customer.countryOfResidence' }) })
@IsOptional()
countryOfResidence!: string;
@ApiProperty({ example: '2021-01-01' })
@IsDateString({}, { message: i18n('validation.IsDateString', { path: 'general', property: 'customer.dateOfBirth' }) })
@IsAbove18({ message: i18n('validation.IsAbove18', { path: 'general', property: 'customer.dateOfBirth' }) })
@IsOptional()
dateOfBirth!: Date;
}

View File

@ -0,0 +1,19 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsBoolean, IsOptional } from 'class-validator';
export class UpdateNotificationsSettingsRequestDto {
@ApiProperty()
@IsBoolean()
@IsOptional()
isEmailEnabled!: boolean;
@ApiProperty()
@IsBoolean()
@IsOptional()
isPushEnabled!: boolean;
@ApiProperty()
@IsBoolean()
@IsOptional()
isSmsEnabled!: boolean;
}

View File

@ -0,0 +1,71 @@
import { ApiProperty } from '@nestjs/swagger';
import { Customer } from '~/customer/entities';
export class CustomerResponseDto {
@ApiProperty()
id!: string;
@ApiProperty()
customerStatus!: string;
@ApiProperty()
rejectionReason!: string;
@ApiProperty()
firstName!: string;
@ApiProperty()
lastName!: string;
@ApiProperty()
dateOfBirth!: Date;
@ApiProperty()
nationalId!: string;
@ApiProperty()
nationaIdExpiry!: Date;
@ApiProperty()
countryOfResidence!: string;
@ApiProperty()
sourceOfIncome!: string;
@ApiProperty()
profession!: string;
@ApiProperty()
professionType!: string;
@ApiProperty()
isPep!: boolean;
@ApiProperty()
gender!: string;
@ApiProperty()
isJunior!: boolean;
@ApiProperty()
isGuardian!: boolean;
constructor(customer: Customer) {
this.id = customer.id;
this.customerStatus = customer.customerStatus;
this.rejectionReason = customer.rejectionReason;
this.firstName = customer.firstName;
this.lastName = customer.lastName;
this.dateOfBirth = customer.dateOfBirth;
this.nationalId = customer.nationalId;
this.nationaIdExpiry = customer.nationaIdExpiry;
this.countryOfResidence = customer.countryOfResidence;
this.sourceOfIncome = customer.sourceOfIncome;
this.profession = customer.profession;
this.professionType = customer.professionType;
this.isPep = customer.isPep;
this.gender = customer.gender;
this.isJunior = customer.isJunior;
this.isGuardian = customer.isGuardian;
}
}

View File

@ -0,0 +1,2 @@
export * from './customer-response.dto';
export * from './notification-settings.response.dto';

View File

@ -0,0 +1,19 @@
import { ApiProperty } from '@nestjs/swagger';
import { UserNotificationSettings } from '~/auth/entities';
export class NotificationSettingsResponseDto {
@ApiProperty()
isEmailEnabled!: boolean;
@ApiProperty()
isPushEnabled!: boolean;
@ApiProperty()
isSmsEnabled!: boolean;
constructor(notificationSettings: UserNotificationSettings) {
this.isEmailEnabled = notificationSettings.isEmailEnabled;
this.isPushEnabled = notificationSettings.isPushEnabled;
this.isSmsEnabled = notificationSettings.isSmsEnabled;
}
}