fix: the email vaerification logic error

This commit is contained in:
mahyargdz
2025-02-26 15:25:18 +03:30
parent f8a1a7b784
commit 93c5ad49d3
320 changed files with 215 additions and 92 deletions
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+1 -1
View File
@@ -1 +1 @@
npx --no-install commitlint --edit "$1" npx --no-install commitlint --edit "$1"
+1 -1
View File
@@ -1 +1 @@
npx lint-staged npx lint-staged
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
BIN
View File
Binary file not shown.
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
@@ -0,0 +1,73 @@
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
export class AddBusinessFieldsToUserSubscription1740574122421 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.addColumns("user_subscription", [
new TableColumn({
name: "businessName",
type: "varchar",
length: "250",
isNullable: true,
default: "'Unknown Business'",
}),
new TableColumn({
name: "businessPhone",
type: "varchar",
length: "50",
isNullable: true,
default: "''",
}),
new TableColumn({
name: "description",
type: "text",
// length: "250",
isNullable: true,
default: "''",
}),
]);
await queryRunner.query(
`UPDATE "user_subscription" SET "businessName" = 'Unknown Business', "businessPhone" = '', "description" = '' WHERE "businessName" IS NULL`,
);
await queryRunner.changeColumn(
"user_subscription",
"businessName",
new TableColumn({
name: "businessName",
type: "varchar",
length: "250",
isNullable: false,
}),
);
await queryRunner.changeColumn(
"user_subscription",
"businessPhone",
new TableColumn({
name: "businessPhone",
type: "varchar",
length: "50",
isNullable: false,
}),
);
await queryRunner.changeColumn(
"user_subscription",
"description",
new TableColumn({
name: "description",
type: "text",
isNullable: false,
}),
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropColumns("user_subscription", [
new TableColumn({ name: "businessName", type: "varchar" }),
new TableColumn({ name: "businessPhone", type: "varchar" }),
new TableColumn({ name: "description", type: "text" }),
]);
}
}
View File
Regular → Executable
View File
Regular → Executable
View File
View File
View File
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
+8 -8
View File
@@ -113,14 +113,14 @@
"**/*.(t|j)s" "**/*.(t|j)s"
], ],
"coverageDirectory": "../coverage", "coverageDirectory": "../coverage",
"testEnvironment": "node", "testEnvironment": "node"
"lint-staged": { },
"**/*.ts": [ "lint-staged": {
"pnpm format", "**/*.ts": [
"pnpm lint:fix", "pnpm format",
"git add ." "pnpm lint:fix",
] "git add ."
} ]
}, },
"packageManager": "pnpm@9.15.3+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a" "packageManager": "pnpm@9.15.3+sha512.1f79bc245a66eb0b07c5d4d83131240774642caaa86ef7d0434ab47c0d16f66b04e21e0c086eb61e62c77efc4d7f7ec071afad3796af64892fae66509173893a"
} }
Generated Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
View File
View File
View File
View File
View File
View File
View File
View File
Regular → Executable
+6 -2
View File
@@ -73,8 +73,7 @@ export const enum UserMessage {
PROFILE_PIC_REQUIRED = "عکس پروفایل نمی‌تواند خالی باشد", PROFILE_PIC_REQUIRED = "عکس پروفایل نمی‌تواند خالی باشد",
VERIFY_EMAIL_LINK_SENT = "لینک تایید ایمیل به ایمیل شما ارسال شد", VERIFY_EMAIL_LINK_SENT = "لینک تایید ایمیل به ایمیل شما ارسال شد",
EMAIL_VERIFIED = "ایمیل شما تایید شد", EMAIL_VERIFIED = "ایمیل شما تایید شد",
INVALID_EMAIL_TOKEN = "توکن ایمیل نامعتبر است", INVALID_EMAIL_TOKEN = "توکن ایمیل نامعتبر است یا منقضی شده است",
EXPIRED_EMAIL_TOKEN = "توکن ایمیل منقضی شده است",
PHONE_EXIST = "شماره تلفن قبلا ثبت شده است", PHONE_EXIST = "شماره تلفن قبلا ثبت شده است",
ADDRESS_REQUIRED = "آدرس نمی‌تواند خالی باشد", ADDRESS_REQUIRED = "آدرس نمی‌تواند خالی باشد",
ADDRESS_SHOULD_BE_STRING = "آدرس باید یک رشته باشد", ADDRESS_SHOULD_BE_STRING = "آدرس باید یک رشته باشد",
@@ -340,6 +339,11 @@ export const enum SubscriptionMessage {
SUBS_REQUIRED = "اشتراک مورد نیاز است", SUBS_REQUIRED = "اشتراک مورد نیاز است",
SUBS_SHOULD_BE_ARRAY = "اشتراک باید یک آرایه باشد", SUBS_SHOULD_BE_ARRAY = "اشتراک باید یک آرایه باشد",
USER_SUBS_NOT_FOUND = "اشتراک کاربر یافت نشد", USER_SUBS_NOT_FOUND = "اشتراک کاربر یافت نشد",
BUSINESS_NAME_REQUIRED = "BUSINESS_NAME_REQUIRED",
BUSINESS_NAME_LENGTH = "BUSINESS_NAME_LENGTH",
BUSINESS_PHONE_INVALID = "BUSINESS_PHONE_INVALID",
DESCRIPTION_LENGTH = "DESCRIPTION_LENGTH",
BUSINESS_NAME_STRING = "BUSINESS_NAME_STRING",
} }
export const enum InvoiceMessage { export const enum InvoiceMessage {
View File
View File
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
Regular → Executable
View File
View File
View File
View File
View File
Regular → Executable
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
Regular → Executable
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
@@ -3,7 +3,7 @@ import { IsNotEmpty, IsString, MinLength } from "class-validator";
import { AuthMessage } from "../../../common/enums/message.enum"; import { AuthMessage } from "../../../common/enums/message.enum";
export class UpdatePasswordDto { export class ChangePasswordDto {
@IsNotEmpty({ message: AuthMessage.PASSWORD_NOT_EMPTY }) @IsNotEmpty({ message: AuthMessage.PASSWORD_NOT_EMPTY })
@IsString({ message: AuthMessage.PASSWORD_FORMAT_INVALID }) @IsString({ message: AuthMessage.PASSWORD_FORMAT_INVALID })
@ApiProperty({ description: "old password", example: "12S345SS678" }) @ApiProperty({ description: "old password", example: "12S345SS678" })
View File
View File
View File
View File
+3 -4
View File
@@ -2,16 +2,15 @@ import { Body, Controller, HttpCode, HttpStatus, Patch, Post, UseGuards } from "
import { ApiOperation, ApiTags } from "@nestjs/swagger"; import { ApiOperation, ApiTags } from "@nestjs/swagger";
import { Throttle, ThrottlerGuard } from "@nestjs/throttler"; import { Throttle, ThrottlerGuard } from "@nestjs/throttler";
import { ChangePasswordDto } from "./DTO/change-password.dto";
import { CompleteRegistrationDto } from "./DTO/complete-register.dto"; import { CompleteRegistrationDto } from "./DTO/complete-register.dto";
import { CheckUserExistDto, LoginPasswordDTO } from "./DTO/loginPassword.dto"; import { CheckUserExistDto, LoginPasswordDTO } from "./DTO/loginPassword.dto";
import { RequestOtpDto } from "./DTO/request-otp.dto"; import { RequestOtpDto } from "./DTO/request-otp.dto";
import { UpdatePasswordDto } from "./DTO/update-password.dto";
import { VerifyOtpDto } from "./DTO/verify-otp.dto"; import { VerifyOtpDto } from "./DTO/verify-otp.dto";
import { AuthService } from "./providers/auth.service"; import { AuthService } from "./providers/auth.service";
import { AUTH_THROTTLE_LIMIT, AUTH_THROTTLE_TTL } from "../../common/constants"; import { AUTH_THROTTLE_LIMIT, AUTH_THROTTLE_TTL } from "../../common/constants";
import { AuthGuards } from "../../common/decorators/auth-guard.decorator"; import { AuthGuards } from "../../common/decorators/auth-guard.decorator";
import { UserDec } from "../../common/decorators/user.decorator"; import { UserDec } from "../../common/decorators/user.decorator";
import { User } from "../users/entities/user.entity";
@ApiTags("Auth") @ApiTags("Auth")
@Controller("auth") @Controller("auth")
@@ -80,8 +79,8 @@ export class AuthController {
@ApiOperation({ summary: "Update user password" }) @ApiOperation({ summary: "Update user password" })
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
@Patch("change-password") @Patch("change-password")
updatePassword(@UserDec() user: User, @Body() updatePasswordDto: UpdatePasswordDto) { changePassword(@UserDec("id") userId: string, @Body() changePasswordDto: ChangePasswordDto) {
return this.authService.updatePassword(user.id, updatePasswordDto); return this.authService.changePassword(userId, changePasswordDto);
} }
//***************************** */ //***************************** */
Regular → Executable
View File
View File
View File
View File
View File
View File

Some files were not shown because too many files have changed in this diff Show More