forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
30
src/auth/dto/actor/forget-password.actor.dto.ts
Normal file
30
src/auth/dto/actor/forget-password.actor.dto.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
export class ForgetPasswordSendCodeDto {
|
||||
@ApiProperty({ example: "balali.arash@gmail.com", type: String })
|
||||
email: string;
|
||||
}
|
||||
|
||||
export class ForgetPasswordVerifyCodeDto {
|
||||
@ApiProperty({ example: "09331009989", type: String })
|
||||
email: string;
|
||||
|
||||
@ApiProperty({ type: String, examples: { true: "22222" } })
|
||||
otp: string;
|
||||
|
||||
@ApiProperty({ type: String })
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
export class ForgetPasswordVerifyCodeDtoRs {
|
||||
@ApiProperty({ example: "balali.arash@gmail.com", type: String })
|
||||
email: string;
|
||||
|
||||
@ApiProperty({ type: String, examples: { true: "22222" } })
|
||||
message: string;
|
||||
|
||||
constructor(user, message) {
|
||||
this.email = user.email;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
41
src/auth/dto/actor/login.actor.dto.ts
Normal file
41
src/auth/dto/actor/login.actor.dto.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { RoleEnum } from "src/Types&Enums/role.enum";
|
||||
|
||||
export class LoginActorDto {
|
||||
@ApiProperty({ example: RoleEnum, type: "array", description: "LOGIN_DTO" })
|
||||
role: RoleEnum[];
|
||||
|
||||
@ApiProperty({})
|
||||
username: string;
|
||||
|
||||
@ApiProperty({})
|
||||
password: string;
|
||||
}
|
||||
|
||||
export class LoginActorDtoRs extends LoginActorDto {
|
||||
private readonly userId;
|
||||
constructor(userData) {
|
||||
super();
|
||||
this.userId = userData._id;
|
||||
this.role = userData.role;
|
||||
this.username = userData.email;
|
||||
this.clientKey = userData.clientKey;
|
||||
this.token = userData.token;
|
||||
this.refreshToken = userData.refreshToken;
|
||||
}
|
||||
|
||||
@ApiProperty({ type: "string", description: "LOGIN_DTO_RS" })
|
||||
fullName: string;
|
||||
|
||||
@ApiProperty({ type: "string", description: "LOGIN_DTO_RS" })
|
||||
role: RoleEnum[];
|
||||
|
||||
@ApiProperty({ type: "string", description: "LOGIN_DTO_RS" })
|
||||
token: string;
|
||||
|
||||
@ApiProperty({ type: "string", description: "LOGIN_DTO_RS" })
|
||||
refreshToken: string;
|
||||
|
||||
@ApiProperty({ type: "string", description: "LOGIN_DTO_RS" })
|
||||
clientKey: string;
|
||||
}
|
||||
98
src/auth/dto/actor/profile.actor.dto.ts
Normal file
98
src/auth/dto/actor/profile.actor.dto.ts
Normal file
@@ -0,0 +1,98 @@
|
||||
import { ApiProperty, ApiSchema } from "@nestjs/swagger";
|
||||
import { IsMobilePhone, IsString, Length } from "class-validator";
|
||||
import { DamageExpertModel } from "src/users/entities/schema/damage-expert.schema";
|
||||
|
||||
export class ProfileActor {
|
||||
public email: string;
|
||||
public fullName: string;
|
||||
public nationalCode: string;
|
||||
public insuActivityCo: string;
|
||||
public userType: string;
|
||||
public mobile: string;
|
||||
public address: string;
|
||||
public state: string;
|
||||
public city: string;
|
||||
|
||||
constructor(Profile: DamageExpertModel) {
|
||||
this.email = Profile?.email;
|
||||
this.fullName = Profile?.firstName + " " + Profile?.lastName;
|
||||
this.nationalCode = Profile?.nationalCode;
|
||||
this.insuActivityCo = Profile?.insuActivityCo;
|
||||
this.userType = Profile?.userType;
|
||||
this.mobile = Profile?.mobile;
|
||||
this.address = Profile?.address;
|
||||
this.state = Profile?.state;
|
||||
this.city = Profile?.city;
|
||||
}
|
||||
}
|
||||
|
||||
@ApiSchema({
|
||||
name: "Edit Actor Profile",
|
||||
description: "Body of the request to edit the actor's profile",
|
||||
})
|
||||
export class ActorEditUserProfileDto {
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "First name of the actor",
|
||||
example: "heshmat",
|
||||
nullable: true,
|
||||
})
|
||||
@IsString()
|
||||
@Length(2, 40)
|
||||
firstName?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "Last name of the actor",
|
||||
example: "Heshmati",
|
||||
nullable: true,
|
||||
})
|
||||
@IsString()
|
||||
@Length(1, 10)
|
||||
lastName?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "Mobile phone of the actor",
|
||||
example: "09123456789",
|
||||
nullable: true,
|
||||
})
|
||||
@IsMobilePhone("fa-IR")
|
||||
mobile?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "تلفن خط ثابت",
|
||||
example: "02122222222",
|
||||
nullable: true,
|
||||
})
|
||||
@IsString()
|
||||
phone?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "City of the user",
|
||||
example: "استان",
|
||||
nullable: true,
|
||||
})
|
||||
@IsString()
|
||||
city?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "State of the user",
|
||||
example: "شهر",
|
||||
nullable: true,
|
||||
})
|
||||
@IsString()
|
||||
state?: string;
|
||||
|
||||
@ApiProperty({
|
||||
type: "string",
|
||||
description: "Address of the user",
|
||||
example: "آدرس",
|
||||
nullable: true,
|
||||
})
|
||||
@IsString()
|
||||
address?: string;
|
||||
}
|
||||
341
src/auth/dto/actor/register.actor.dto.ts
Normal file
341
src/auth/dto/actor/register.actor.dto.ts
Normal file
@@ -0,0 +1,341 @@
|
||||
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;
|
||||
}
|
||||
|
||||
export class RegisterDtoRs extends RegisterDto {
|
||||
@ApiProperty({ type: "string", description: "REGISTER_DTO_RS" })
|
||||
message: string;
|
||||
|
||||
constructor(registerData) {
|
||||
super();
|
||||
this.message = registerData.message || "ثبت نام با موفقیت انجام شد.";
|
||||
}
|
||||
}
|
||||
15
src/auth/dto/actor/states.dto.ts
Normal file
15
src/auth/dto/actor/states.dto.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
export class StatesDtoRs {
|
||||
name: string;
|
||||
id: string;
|
||||
constructor(states) {
|
||||
this.name = states.name;
|
||||
this.id = states.id;
|
||||
}
|
||||
}
|
||||
|
||||
export class StateListDtoRs {
|
||||
list: StatesDtoRs[];
|
||||
constructor(statesLis: []) {
|
||||
this.list = statesLis.map((s) => new StatesDtoRs(s));
|
||||
}
|
||||
}
|
||||
0
src/auth/dto/user/forget-password.dto.ts
Normal file
0
src/auth/dto/user/forget-password.dto.ts
Normal file
44
src/auth/dto/user/login.dto.ts
Normal file
44
src/auth/dto/user/login.dto.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { UserModel } from "src/users/entities/schema/user.schema";
|
||||
|
||||
export class UserLoginDto {
|
||||
@ApiProperty({
|
||||
example: "09226187419",
|
||||
type: "string",
|
||||
description: "User login dto",
|
||||
})
|
||||
mobile: string;
|
||||
}
|
||||
|
||||
export class LoginDtoRs extends UserModel {
|
||||
message: string;
|
||||
@ApiProperty({
|
||||
example: "09226187419",
|
||||
type: "string",
|
||||
description: "User login dto",
|
||||
})
|
||||
tokens: { token: string; rfToken: string };
|
||||
|
||||
@ApiProperty({
|
||||
example: "09226187419",
|
||||
type: "string",
|
||||
description: "User login dto",
|
||||
})
|
||||
userId: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: "09226187419",
|
||||
type: "string",
|
||||
description: "User login dto",
|
||||
})
|
||||
firstName: string;
|
||||
|
||||
lastName: string;
|
||||
username: string;
|
||||
mobile: string;
|
||||
nationalCode: string;
|
||||
constructor(loginData) {
|
||||
super();
|
||||
this.mobile = loginData.mobile;
|
||||
}
|
||||
}
|
||||
17
src/auth/dto/user/verify.dto.ts
Normal file
17
src/auth/dto/user/verify.dto.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
export class UserVerifyOtp {
|
||||
@ApiProperty({
|
||||
example: "09226187419",
|
||||
type: "string",
|
||||
description: "User login dto",
|
||||
})
|
||||
username: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: "258567",
|
||||
type: "string",
|
||||
description: "User login verify dto",
|
||||
})
|
||||
password: string;
|
||||
}
|
||||
Reference in New Issue
Block a user