Skip to content

Commit

Permalink
Change SP and remove nodemail
Browse files Browse the repository at this point in the history
  • Loading branch information
Frave07 committed Mar 30, 2023
1 parent a55c4d2 commit 17f2b20
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 135 deletions.
53 changes: 10 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@
"author": "Frave Developer",
"license": "ISC",
"dependencies": {
"bcrypt": "^5.0.1",
"cors": "^2.8.5",
"express": "^4.17.1",
"fs-extra": "^10.0.0",
"jsonwebtoken": "^8.5.1",
"multer": "^1.4.3",
"mysql2": "^2.3.2",
"nodemailer": "^6.7.0",
"rimraf": "^3.0.2",
"socket.io": "^2.4.1",
"uuidv4": "^6.2.12"
"bcrypt": "5.0.1",
"cors": "2.8.5",
"express": "4.17.1",
"fs-extra": "10.0.0",
"jsonwebtoken": "8.5.1",
"multer": "1.4.3",
"mysql2": "2.3.2",
"rimraf": "3.0.2",
"socket.io": "2.4.1",
"uuidv4": "6.2.12"
},
"devDependencies": {
"@types/bcrypt": "^5.0.0",
Expand All @@ -31,7 +30,6 @@
"@types/fs-extra": "^9.0.13",
"@types/jsonwebtoken": "^8.5.5",
"@types/multer": "^1.4.7",
"@types/nodemailer": "^6.4.4",
"@types/socket.io": "^2.1.13",
"dotenv": "^10.0.0",
"nodemon": "^2.0.13",
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/auth_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SignIn } from "../interfaces/login.interface";
import { connect } from '../database/connection';
import { generateJsonWebToken } from '../lib/generate_jwt';
import { IVerifyUser } from '../interfaces/userdb';
import { sendEmailVerify } from '../lib/nodemail';
// import { sendEmailVerify } from '../lib/nodemail';


export const login = async ( req: Request, res: Response): Promise<Response> => {
Expand Down Expand Up @@ -98,7 +98,7 @@ const resendCodeEmail = async (email: string): Promise<void> => {

await conn.query('UPDATE users SET token_temp = ? WHERE email = ?', [ randomNumber, email ]);

await sendEmailVerify('Codigo de verificación', email, `<h1> Social Frave </h1><hr> <b>${ randomNumber } </b>`);
// await sendEmailVerify('Codigo de verificación', email, `<h1> Social Frave </h1><hr> <b>${ randomNumber } </b>`);

conn.end();

Expand Down
4 changes: 1 addition & 3 deletions src/controllers/user_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import { v4 as uuidv4 } from 'uuid';
import { RowDataPacket } from 'mysql2';
import { connect } from '../database/connection';
import { IChangePassword, IUpdateProfile, User, INewFriend, IAcceptFollowerRequest } from '../interfaces/user.interface';
import { sendEmailVerify } from '../lib/nodemail';


export const createUser = async ( req: Request, res: Response ): Promise<Response> => {

Expand All @@ -33,7 +31,7 @@ export const createUser = async ( req: Request, res: Response ): Promise<Respons

await conn.query(`CALL SP_REGISTER_USER(?,?,?,?,?,?,?);`, [ uuidv4(), fullname, username, email, pass, uuidv4(), randomNumber ]);

await sendEmailVerify('Codigo de verificación', email, `<h1> Social Frave </h1><hr> <b>${ randomNumber } </b>`);
// await sendEmailVerify('Codigo de verificación', email, `<h1> Social Frave </h1><hr> <b>${ randomNumber } </b>`);

conn.end();

Expand Down
27 changes: 2 additions & 25 deletions src/database/SP_social_media.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CREATE PROCEDURE SP_REGISTER_USER(IN uidPerson VARCHAR(100), IN fullname VARCHAR
BEGIN
INSERT INTO person(uid, fullname, image) VALUE (uidPerson, fullname, 'avatar-default.png');

INSERT INTO users(uid, username, email, passwordd, person_uid, token_temp) VALUE (uidUser, username, email, pass, uidPerson, temp);
INSERT INTO users(uid, username, email, passwordd, person_uid, token_temp, email_verified) VALUE (uidUser, username, email, pass, uidPerson, temp, 1);
END//


Expand All @@ -29,7 +29,7 @@ END//
DELIMITER //
CREATE PROCEDURE SP_GET_ALL_POSTS_HOME(IN ID VARCHAR(100))
BEGIN
SELECT img.post_uid AS post_uid, pos.is_comment, pos.type_privacy, pos.created_at, pos.person_uid, ANY_VALUE(username) AS username,
SELECT img.post_uid AS post_uid, pos.is_comment, pos.type_privacy, pos.created_at, pos.person_uid, username AS username,
per.image AS avatar, GROUP_CONCAT( DISTINCT img.image ) images,
(SELECT COUNT(co.post_uid) FROM comments co WHERE co.post_uid = pos.uid ) AS count_comment,
(SELECT COUNT(li.post_uid) FROM likes li WHERE li.post_uid = pos.uid ) AS count_likes,
Expand Down Expand Up @@ -262,26 +262,3 @@ END//

/*---------------------------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------------------------*/























28 changes: 1 addition & 27 deletions src/database/db_social_media.sql
Original file line number Diff line number Diff line change
Expand Up @@ -168,30 +168,4 @@ CREATE TABLE messages

FOREIGN KEY(source_uid) REFERENCES users(person_uid),
FOREIGN KEY(target_uid) REFERENCES users(person_uid)
);


























);
23 changes: 0 additions & 23 deletions src/lib/nodemail.ts

This file was deleted.

0 comments on commit 17f2b20

Please sign in to comment.