Skip to content

Commit

Permalink
Merge pull request #154 from fdhhhdjd/developer
Browse files Browse the repository at this point in the history
#152 [Backend] Check Email Verification Student
  • Loading branch information
fdhhhdjd authored Feb 27, 2023
2 parents cf5cad0 + 721d6c8 commit 30a3d72
Show file tree
Hide file tree
Showing 10 changed files with 433 additions and 31 deletions.
2 changes: 1 addition & 1 deletion backend-manager-student/src/share/configs/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ module.exports = {
* @param { String }
*/
LINK_RESET_STRING: '${port_reset}/password/reset/${key_reset_random}',
LINK_VERIFY_EMAIL_STUDENT: '${protocol}://${host}/api/v1/user/email/${user_id}/${uniqueString}',
LINK_VERIFY_EMAIL_STUDENT: '${protocol}://${host}/student/api/v1/user/email/${user_id}/${uniqueString}',
/**
* @author Nguyễn Tiến Tài
* @created_at 25/02/2023
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ module.exports = {
* @created_at 23/02/2023
* @description Insert reset password student
*/
insertResetPassword: (data) => new Promise((resolve, reject) => {
try {
const result = knex('reset_password')
.insert(data)
.onConflict('id')
.merge()
.returning(['id', 'user_id']);
resolve(result);
} catch (error) {
reject(error);
}
}),
insertResetPassword: (data) =>
new Promise((resolve, reject) => {
try {
const result = knex('reset_password')
.insert(data)
.onConflict('id')
.merge()
.returning(['id', 'user_id']);
resolve(result);
} catch (error) {
reject(error);
}
}),
/**
* @author Nguyễn Tiến Tài
* @created_at 24/02/2023
Expand All @@ -32,12 +33,13 @@ module.exports = {
* @created_at 24/02/2023
* @description Update reset Password
*/
updateResetPassword: async (data, student_query, return_data) => new Promise((resolve, reject) => {
try {
const result = knex('reset_password').update(data).where(student_query).returning(return_data);
resolve(result);
} catch (error) {
reject(error);
}
}),
};
updateResetPassword: async (data, student_query, return_data) =>
new Promise((resolve, reject) => {
try {
const result = knex('reset_password').update(data).where(student_query).returning(return_data);
resolve(result);
} catch (error) {
reject(error);
}
}),
};
Original file line number Diff line number Diff line change
Expand Up @@ -600,3 +600,100 @@ paths:
$ref: '#/components/responses/isMatchPassword'
503:
$ref: '#/components/responses/ServerFail'

#!@author Nguyễn Tiến Tài
#!created_at 27/02/2023
#!description: Verification link email Student
/api/v1/user/email/:user_id/:uniqueString:
get:
summary: Verification Email Student
tags: [Verification Email Student]
operationId: updateVerificationEmailStudent
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
responses:
200:
description: Verification Email Success or Link already check verify
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
400:
description: Routes param user_id,uniqueString invalid !
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 400
message:
type: string
example: Bad Request
401:
$ref: '#/components/responses/isMatchPassword'
503:
$ref: '#/components/responses/ServerFail'

#!@author Nguyễn Tiến Tài
#!created_at 27/02/2023
#!description: send link repeat email Student
/api/v1/user/private/verification-email:
get:
summary: Send Link Email repeat Student
tags: [Send Link Email Repeat Student]
operationId: sendEmailVerification
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
- $ref: '#/components/parameters/TOKEN'
schema:
$ref: '#/components/headers/AuthHeader'
responses:
200:
description: Send Email Success or Link already check verify.
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
400:
description: Token invalid !
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 400
message:
type: string
example: Bad Request
401:
$ref: '#/components/responses/isMatchPassword'
503:
$ref: '#/components/responses/ServerFail'
Loading

0 comments on commit 30a3d72

Please sign in to comment.