LabiciIvan / exchange-bot

1 stars 0 forks source link

PRO - Refactor PRO files #39

Open LabiciIvan opened 1 year ago

LabiciIvan commented 1 year ago

REFACTOR FILES

A refactoring needs to files located in middleware, services. folder. This refactoring purpouse is to simplify the code and to make it more verbose while doing same work in the background ( BEHIND THE SCENES ) .

OLD_URL => http://localhost:8000/users. NEW_URL => http://localhost:8000/EB/api/v1/users.

hashPWD - This function must be changed to a function that will execute the bcrypt from within and actually await for the resolved or rejected promise.

app.js - This is the main entry file for the PRO SERVER, to be able to have the project scalable we must refactor some bits from this file, one of major refactoring is changing the name for Routes. -> UsersRouters => Users -> ExchangesRouters => Exchanges -> corsOptions => CORS -> in app.js split logic for corsOptions, by removing line 14-19 from app.js to /services/CORS.js

GROUP UNDER auth folder .

checkSignUpData - This function is responsible with checking the sign up data, -> checkSignUpData => check

checkAccountExists - This checks if account account with provided email exists in DB or not. -> checkAccountExists => exists

checkLoginPassword - This will check if the submited password matches the one from DB.
-> checkLoginPassword => login

limitResetPassword - This limits password reset once a day for any user.
-> limitResetPassword => limitResetPWD

resetPassword - This will updated in the DB the new PASSWORD.
-> resetPassword => resetPWD

hashPWD - This will hash the password before storing it in DB.
-> hashPWD => hashPWD