This commit is contained in:
AdisakKanthawilang 2024-11-20 15:05:18 +07:00
parent be2afbde3a
commit 854785434f
2 changed files with 27 additions and 30 deletions

View file

@ -1874,9 +1874,9 @@ export class ProfileController extends Controller {
}
/**
* API Email
* API Email
*
* @summary Email
* @summary Email
*
*/
@Post("send-verify-email")
@ -1889,30 +1889,29 @@ export class ProfileController extends Controller {
subject: string;
}
) {
const profile = await this.profileRepo.findOne({
where:{
id: body.profileId,
email: body.profileId
const profile = await this.profileRepo.findOne({
where:{
id: body.profileId,
email: body.email
}
});
const jwt = require('jsonwebtoken');
const token = jwt.sign({email_id: body.email}, "Stack", {expiresIn: '24h'});
console.log("[token]",token);
const link = process.env.API_URL + "/" + token;
const detail = null;
await new CallAPI()
.PostData(req, "/profile/gen-link-verify-email", {
body: body.email,
.PostData(req, "/placement/notisend-mail", {
subject: body.subject,
body: detail,
Email: body.email,
})
.catch((error) => {
console.error("Error calling API:", error);
});
// const detail = null;
// await new CallAPI()
// .PostData(req, "/placement/notisend-mail", {
// subject: body.subject,
// body: detail,
// Email: body.email,
// })
// .catch((error) => {
// console.error("Error calling API:", error);
// });
});
}
/**
@ -1928,14 +1927,12 @@ export class ProfileController extends Controller {
email: string;
},
) {
// var uuid = require('node-uuid');
// var timeBasedID = uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a'
// var randomID = uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1'
// var url = 'www.privatebox.de/' + randomID; // or + timeBasedID
var jwt = require('jsonwebtoken');
var token = jwt.sign({email_id: body.email}, "Stack", {expiresIn: '24h'});
console.log("[token]",token);
const profile = await this.profileRepo.findOne({
where:{
id: body.profileId,
email: body.email
}
});
}
@ -7970,7 +7967,7 @@ export class ProfileController extends Controller {
Object.assign(profile, body);
Object.assign(history, { ...profile, id: undefined });
profile.emailVerify = "NOT_VERIFIED";
profile.statusEmail = "NOT_VERIFIED";
profile.lastUpdateUserId = request.user.sub;
profile.lastUpdateFullName = request.user.name;
profile.lastUpdatedAt = new Date();

View file

@ -127,7 +127,7 @@ export class Profile extends EntityBase {
comment: "สถานะอีเมล", //VERIFIED = ยืนยัน, NOT_VERIFIED = ไม่ได้ยืนยัน
default: null,
})
emailVerify: string;
statusEmail: string;
@Column({
nullable: true,