forked from Yara724/api
357 lines
7.3 KiB
TypeScript
357 lines
7.3 KiB
TypeScript
import { ApiProperty } from "@nestjs/swagger";
|
|
import { Exclude } from "class-transformer";
|
|
import { IsEmail } from "class-validator";
|
|
import { Types } from "mongoose";
|
|
import { Degrees } from "src/Types&Enums/degrees.enum";
|
|
import {
|
|
ExpertizedAtEnum,
|
|
PreviousWorkEnum,
|
|
SkillEnum,
|
|
} from "src/Types&Enums/damage-expert.enum";
|
|
import { RoleEnum } from "src/Types&Enums/role.enum";
|
|
import { UserType } from "src/Types&Enums/userType.enum";
|
|
|
|
@Exclude()
|
|
export class RegisterDto {
|
|
clientKey?: string;
|
|
@ApiProperty({
|
|
example: "Soheil",
|
|
type: "string",
|
|
description: "firstname of actor",
|
|
})
|
|
firstName: string;
|
|
|
|
@ApiProperty({
|
|
enum: RoleEnum,
|
|
examples: RoleEnum,
|
|
type: "string",
|
|
description: "firstname of actor",
|
|
})
|
|
role: RoleEnum;
|
|
|
|
userType: UserType;
|
|
|
|
@ApiProperty({
|
|
example: "Hajizadeh",
|
|
type: "string",
|
|
description: "lastname of actor",
|
|
})
|
|
lastName: string;
|
|
|
|
@ApiProperty({
|
|
example: "4311402422",
|
|
type: "string",
|
|
description: "nationalCode of actor",
|
|
})
|
|
nationalCode: string;
|
|
|
|
@ApiProperty({
|
|
example: "dev.callmeskylark@gmail.com",
|
|
type: "string",
|
|
description: "email of actor",
|
|
})
|
|
email: string;
|
|
|
|
@ApiProperty({
|
|
example: "123321",
|
|
type: "string",
|
|
description: "password of actor",
|
|
})
|
|
password: string;
|
|
|
|
@ApiProperty({
|
|
example: "7522312365495123",
|
|
type: "string",
|
|
description: "sheba of actor",
|
|
})
|
|
sheba?: string;
|
|
|
|
@ApiProperty({
|
|
example: "02133564521",
|
|
type: "string",
|
|
description: "phone of actor",
|
|
})
|
|
phone?: string;
|
|
|
|
@ApiProperty({
|
|
example: "09226187419",
|
|
type: "string",
|
|
description: "mobile of actor",
|
|
})
|
|
mobile: string;
|
|
|
|
@ApiProperty({
|
|
example: "Tehran",
|
|
type: "string",
|
|
description: "province of actor",
|
|
})
|
|
state?: string;
|
|
|
|
@ApiProperty({
|
|
example: "Tehran",
|
|
type: "string",
|
|
description: "city of actor",
|
|
})
|
|
city?: string;
|
|
|
|
@ApiProperty({
|
|
example: "Gisha , No 7",
|
|
type: "string",
|
|
description: "address of actor",
|
|
})
|
|
address?: string;
|
|
|
|
@ApiProperty({
|
|
enum: Degrees,
|
|
examples: Degrees,
|
|
type: String,
|
|
description: "expDegree of actor",
|
|
})
|
|
expDegree?: Degrees;
|
|
|
|
@ApiProperty({
|
|
example: "5",
|
|
type: "number",
|
|
description: "insuActivityTime of actor",
|
|
})
|
|
insuActivityTime?: number;
|
|
|
|
@ApiProperty({
|
|
example: "64fc4978b74d670939b08920",
|
|
type: String,
|
|
description: "insuActivityCo of actor",
|
|
})
|
|
insuActivityCo: string;
|
|
|
|
@ApiProperty({
|
|
example: "5",
|
|
type: "number",
|
|
description: "policeActivityTime of actor",
|
|
})
|
|
policeActivityTime?: number;
|
|
|
|
@ApiProperty({
|
|
examples: ["headquarters", "queue"],
|
|
type: "string",
|
|
description: "policeActivityKind of actor",
|
|
})
|
|
policeActivityKind?: string;
|
|
|
|
@ApiProperty({
|
|
example: "Tehran",
|
|
type: String,
|
|
description: "policeServicePlace of actor",
|
|
})
|
|
policeServicePlace?: string;
|
|
}
|
|
|
|
export class GenuineRegisterDto extends RegisterDto {
|
|
@ApiProperty({
|
|
type: () => ({
|
|
fullName: { type: "string", example: "John Doe" },
|
|
nationalCode: { type: "string", example: "4311402422" },
|
|
dob: {
|
|
type: "string",
|
|
example: "1990-01-01",
|
|
description: "date of birth in ISO string or yyyy-mm-dd",
|
|
},
|
|
mobile: { type: "string", example: "09226187419" },
|
|
}),
|
|
description: "personal information of damage expert (duplicated with some flat fields)",
|
|
required: false,
|
|
})
|
|
personalInfo?: {
|
|
fullName: string;
|
|
nationalCode: string;
|
|
dob: string;
|
|
mobile: string;
|
|
};
|
|
|
|
@ApiProperty({
|
|
type: () => ({
|
|
nationalCard: {
|
|
type: "string",
|
|
example: "665f0e5ab74d670939b08920",
|
|
description: "fileId of uploaded national card",
|
|
},
|
|
selfie: {
|
|
type: "string",
|
|
example: "665f0e5ab74d670939b08921",
|
|
description: "fileId of uploaded selfie",
|
|
},
|
|
activityCert: {
|
|
type: "string",
|
|
example: "665f0e5ab74d670939b08922",
|
|
description: "fileId of uploaded activity certificate",
|
|
},
|
|
}),
|
|
description:
|
|
"IDs of already uploaded documents in upload module (no files uploaded directly here)",
|
|
required: false,
|
|
})
|
|
personalDocs?: {
|
|
nationalCard?: string;
|
|
selfie?: string;
|
|
activityCert?: string;
|
|
};
|
|
|
|
@ApiProperty({
|
|
type: () => ({
|
|
state: {
|
|
type: "number",
|
|
example: 8,
|
|
description: "state id from /actor/register/form/states/list",
|
|
},
|
|
city: {
|
|
type: "number",
|
|
example: 101,
|
|
description: "city id from /actor/register/form/cities/list/:stateId",
|
|
},
|
|
expertizedAt: {
|
|
type: "array",
|
|
items: { enum: Object.values(ExpertizedAtEnum) },
|
|
example: [ExpertizedAtEnum.BADANE, ExpertizedAtEnum.FANI],
|
|
description: "one or more expertized fields",
|
|
},
|
|
}),
|
|
required: false,
|
|
})
|
|
workExperience?: {
|
|
state: number;
|
|
city: number;
|
|
expertizedAt: ExpertizedAtEnum[];
|
|
};
|
|
|
|
@ApiProperty({
|
|
type: () => ({
|
|
workingYears: {
|
|
type: "number",
|
|
example: 5,
|
|
},
|
|
casesCount: {
|
|
type: "number",
|
|
example: 120,
|
|
},
|
|
previousWork: {
|
|
enum: PreviousWorkEnum,
|
|
example: PreviousWorkEnum.INSURANCE_COMPANY,
|
|
},
|
|
}),
|
|
required: false,
|
|
})
|
|
workRecords?: {
|
|
workingYears: number;
|
|
casesCount: number;
|
|
previousWork: PreviousWorkEnum;
|
|
};
|
|
|
|
@ApiProperty({
|
|
type: "array",
|
|
items: {
|
|
type: "string",
|
|
enum: Object.values(SkillEnum),
|
|
},
|
|
required: false,
|
|
description: "one or more skills of the damage expert",
|
|
example: [SkillEnum.SMOOTHING, SkillEnum.SCENE_EXPERT],
|
|
})
|
|
skills?: SkillEnum[];
|
|
|
|
@ApiProperty({
|
|
type: () => ({
|
|
IBAN: {
|
|
type: "string",
|
|
example: "IR820540102680020817909002",
|
|
},
|
|
cardNum: {
|
|
type: "string",
|
|
example: "6037991234567890",
|
|
},
|
|
accountNum: {
|
|
type: "string",
|
|
example: "0101234567000",
|
|
},
|
|
}),
|
|
required: false,
|
|
})
|
|
financialInfo?: {
|
|
IBAN: string;
|
|
cardNum: string;
|
|
accountNum: string;
|
|
};
|
|
}
|
|
|
|
export class LegalRegisterDto implements RegisterDto {
|
|
userType: UserType;
|
|
@ApiProperty()
|
|
firstName: string;
|
|
|
|
@ApiProperty()
|
|
role: RoleEnum;
|
|
|
|
@ApiProperty()
|
|
lastName: string;
|
|
|
|
@ApiProperty()
|
|
nationalCode: string;
|
|
|
|
@ApiProperty()
|
|
email: string;
|
|
|
|
@ApiProperty()
|
|
password: string;
|
|
|
|
@ApiProperty()
|
|
mobile: string;
|
|
|
|
@ApiProperty({
|
|
example: "64fc4978b74d670939b08920",
|
|
type: String,
|
|
description: "insuActivityCo of actor",
|
|
})
|
|
insuActivityCo: string;
|
|
}
|
|
|
|
export class InsurerRegisterDto {
|
|
@ApiProperty()
|
|
firstName: string;
|
|
|
|
@ApiProperty()
|
|
lastName: string;
|
|
|
|
@ApiProperty({ description: "just submit by Email" })
|
|
@IsEmail()
|
|
username: string;
|
|
|
|
@ApiProperty()
|
|
password: string;
|
|
|
|
@ApiProperty({ example: "{saman : 651abe5814ed4bb6ee20cd81}" })
|
|
clientKey: Types.ObjectId;
|
|
|
|
@ApiProperty()
|
|
phone?: string;
|
|
|
|
@ApiProperty()
|
|
mobile?: string;
|
|
|
|
@ApiProperty()
|
|
city?: string;
|
|
|
|
@ApiProperty()
|
|
state?: string;
|
|
|
|
@ApiProperty()
|
|
address?: string;
|
|
}
|
|
|
|
export class RegisterDtoRs extends RegisterDto {
|
|
@ApiProperty({ type: "string", description: "REGISTER_DTO_RS" })
|
|
message: string;
|
|
|
|
constructor(registerData) {
|
|
super();
|
|
this.message = registerData.message || "ثبت نام با موفقیت انجام شد.";
|
|
}
|
|
}
|