diff --git a/src/migrations/1783945681366-AnswerSubmissionV2.ts b/src/migrations/1783945681366-AnswerSubmissionV2.ts new file mode 100644 index 0000000..ab4687e --- /dev/null +++ b/src/migrations/1783945681366-AnswerSubmissionV2.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AnswerSubmissionV21783945681366 implements MigrationInterface { + name = 'AnswerSubmissionV21783945681366' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "test" ADD "questionsCount" integer NOT NULL DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE "submission" ADD "currentQuestionOrder" integer NOT NULL DEFAULT '1'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "submission" DROP COLUMN "currentQuestionOrder"`); + await queryRunner.query(`ALTER TABLE "test" DROP COLUMN "questionsCount"`); + } + +} diff --git a/src/modules/admin/choices/http/admin-choices.post.endpoints.http b/src/modules/admin/choices/http/admin-choices.post.endpoints.http index e66f6b3..e640039 100644 --- a/src/modules/admin/choices/http/admin-choices.post.endpoints.http +++ b/src/modules/admin/choices/http/admin-choices.post.endpoints.http @@ -3,9 +3,9 @@ Authorization: Bearer {{$global.accessToken}} Content-Type: application/json { - "question": 4, - "text": "Option 2", - "value": 1, - "order": 2, - "score": 2 + "question": 2, + "text": "Option 3", + "value": 3, + "order": 3, + "score": 6 } \ No newline at end of file diff --git a/src/modules/admin/questions/http/admin-questions.post.endpoints.http b/src/modules/admin/questions/http/admin-questions.post.endpoints.http index 07bdf37..8faf5ea 100644 --- a/src/modules/admin/questions/http/admin-questions.post.endpoints.http +++ b/src/modules/admin/questions/http/admin-questions.post.endpoints.http @@ -3,12 +3,11 @@ Authorization: Bearer {{$global.accessToken}} Content-Type: application/json { - "test": 4, - "content": "سوال پنجم", - "order": 4, + "test": 1, + "content": "سوال سوم", "required": true, "type": "numeric", - "metadata": { "min": 1, "max": 100 } + "metadata": { "min": 1, "max": 20 } } POST {{baseUrl}}/admin/questions/range-rules @@ -16,8 +15,8 @@ Authorization: Bearer {{$global.accessToken}} Content-Type: application/json { - "question": 8, + "question": 3, "min": 1, - "max": 5, - "score": 7 + "max": 10, + "score": 10 } \ No newline at end of file diff --git a/src/modules/admin/tests/http/admin-tests.post.endpoints.http b/src/modules/admin/tests/http/admin-tests.post.endpoints.http index d4ef544..fe13ae9 100644 --- a/src/modules/admin/tests/http/admin-tests.post.endpoints.http +++ b/src/modules/admin/tests/http/admin-tests.post.endpoints.http @@ -3,9 +3,8 @@ Content-Type: application/json Authorization: Bearer {{$global.accessToken}} { - "title": "Test Five", - "description": "Description Five", + "title": "Test One", + "description": "Description One", "accessType": "login", - "price": "1234000", "isActive": true } \ No newline at end of file diff --git a/src/modules/auth/http/verify-otp.post.endpoints.http b/src/modules/auth/http/verify-otp.post.endpoints.http index 1e5dd34..91edb9e 100644 --- a/src/modules/auth/http/verify-otp.post.endpoints.http +++ b/src/modules/auth/http/verify-otp.post.endpoints.http @@ -2,8 +2,8 @@ POST {{baseUrl}}/auth/verify-otp Content-Type: application/json { - "phone": "09365858721", - "otp": "40023" + "phone": "09333026363", + "otp": "87074" } {{ diff --git a/src/modules/auth/providers/login.provider.ts b/src/modules/auth/providers/login.provider.ts index 187b023..d2146cd 100644 --- a/src/modules/auth/providers/login.provider.ts +++ b/src/modules/auth/providers/login.provider.ts @@ -52,8 +52,9 @@ export class LoginProvider { return { newUser: true, message, + otpExpiresAt: otpCode.expiresAt, // Just for development - code: otpCode, + code: otpCode.code, }; } diff --git a/src/modules/otp/providers/otp.service.ts b/src/modules/otp/providers/otp.service.ts index d155a0a..cd6bc7b 100644 --- a/src/modules/otp/providers/otp.service.ts +++ b/src/modules/otp/providers/otp.service.ts @@ -32,7 +32,9 @@ export class OtpService { /** * Create new OTP record */ - public async createOTP(phone: string): Promise { + public async createOTP( + phone: string, + ): Promise<{ code: string; expiresAt: Date }> { // OTP request Rate limit const lastOTP = await this.otpRepository.findOne({ where: { phone }, @@ -54,7 +56,7 @@ export class OtpService { await this.otpRepository.save(otp); - return code; + return { code, expiresAt: otp.expiresAt }; } /** diff --git a/src/modules/users/http/users.patch.endpoints.http b/src/modules/users/http/users.patch.endpoints.http index 7159012..9f639f6 100644 --- a/src/modules/users/http/users.patch.endpoints.http +++ b/src/modules/users/http/users.patch.endpoints.http @@ -4,8 +4,8 @@ Authorization: Bearer {{$global.accessToken}} lang: fa { - "firstName": "تست", - "lastName": "تستعلی", + "firstName": "رادمهر", + "lastName": "ترناس", "password": "Password1@", "confirmPassword": "Password1@" } \ No newline at end of file