Merge branch 'task-163-fix/backend_clean' into 'development'

Task 163 fix/backend clean

See merge request !132
parents 9c547d3b 4e8888f9
node_modules
.idea
build
\ No newline at end of file
"use strict";
console.log('Hello');
......@@ -23,25 +23,24 @@
"nodemon": "^2.0.20",
"ts-node": "^10.9.1",
"typeorm-fixtures-cli": "^3.0.1",
"typescript": "^4.8.4"
},
"dependencies": {
"typescript": "^4.8.4",
"@types/bcrypt": "^5.0.0",
"@types/cors": "^2.8.12",
"@types/express": "^4.17.14",
"@types/nodemailer": "^6.4.6",
"@types/nodemailer": "^6.4.6"
},
"dependencies": {
"bcrypt": "^5.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"cors": "^2.8.5",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",
"mongoose": "^6.7.0",
"multer": "^1.4.5-lts.1",
"nanoid": "^3.3.4",
"nodemailer": "^6.8.0",
"path": "^0.12.7",
"pg": "^8.8.0",
"reflect-metadata": "^0.1.13",
"typeorm": "^0.3.10"
}
......
......@@ -15,7 +15,6 @@ const dataSource = myDataSource;
router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{
try{
const {email} = req.body
console.log("emeil", email)
const user = await dataSource
.getRepository(User)
.findOne({
......@@ -23,14 +22,12 @@ router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{
email:email
}
})
console.log('user ', user)
if (!user) return res.status(404).send({message:'user not found'})
const token = nanoid();
const passwordRecovery = new PasswordRecovery()
passwordRecovery.user= user;
passwordRecovery.token=token;
await passwordRecovery.save()
console.log('passwordRecover ' , passwordRecovery)
const url = `${frontend_url}/reset-password/${token}`;
await transporter.sendMail({
from:"planner45@yandex.com",
......
......@@ -78,24 +78,6 @@ router.get('/all-fields/', async (req : Request, res : Response):Promise<object>
})
//** return displayName of user, requested by userId */
router.get('/display-name/:userId',auth, async (req : Request, res : Response):Promise<object> => {
try{
const {userId} =req.params
const displayName = await dataSource
.createQueryBuilder()
.select(['user.displayName'])
.from(User, "user")
.where("user.id = :userId", { userId })
.getOne()
if (!displayName) return res.status(404).send({message:'displayName not found'})
return res.send({displayName})
} catch(e) {
return res.status(502).send({message:(e as Error).message})
}
})
/**create new user*/
router.post('/', upload.single("avatar"), async (req : Request, res : Response):Promise<object> => {
try{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment