mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-08-25 21:59:40 +00:00
feat: registration jounrey for parents
This commit is contained in:
2
src/customer/dtos/request/index.ts
Normal file
2
src/customer/dtos/request/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './update-customer.request.dto';
|
||||
export * from './update-notifications-settings.request.dto';
|
29
src/customer/dtos/request/update-customer.request.dto.ts
Normal file
29
src/customer/dtos/request/update-customer.request.dto.ts
Normal 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;
|
||||
}
|
@ -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;
|
||||
}
|
71
src/customer/dtos/response/customer-response.dto.ts
Normal file
71
src/customer/dtos/response/customer-response.dto.ts
Normal 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;
|
||||
}
|
||||
}
|
2
src/customer/dtos/response/index.ts
Normal file
2
src/customer/dtos/response/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from './customer-response.dto';
|
||||
export * from './notification-settings.response.dto';
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user