Commit 010f4453 authored by “Yevgeniy's avatar “Yevgeniy

#36 merge stash apply

parent 6affab55
...@@ -97,24 +97,39 @@ router.put('/',async(req:Request, res:Response)=> { ...@@ -97,24 +97,39 @@ router.put('/',async(req:Request, res:Response)=> {
.getOne() .getOne()
if (!user) return res.status(404).send({Message:'user not found'}) if (!user) return res.status(404).send({Message:'user not found'})
const {id,title,description,project,dateTimeDue,dateTimeStart,accomplish,priority, executors} = req.body; const {id,title,description,project,dateTimeDue,dateTimeStart,accomplish,priority} = req.body;
await dataSource // await dataSource
.createQueryBuilder() // .createQueryBuilder()
.update(Task) // .update(Task)
.set({ // .set({
title: title, // title: title,
description: description, // description: description,
project: project, // project: project,
dateTimeStart: dateTimeStart, // dateTimeDue: dateTimeDue,
dateTimeDue: dateTimeDue, // dateTimeStart: dateTimeStart,
accomplish: accomplish, // author:user,
priority: priority, // accomplish: accomplish,
author:user, // priority: priority
executors:executors // })
}) // .where("id = :id", { id: id })
.where("id = :id", { id: id }) // .execute()
.execute() const task = await dataSource
.createQueryBuilder()
.select("task")
.from(Task, "task")
.where("task.id = :id", { id })
// .addSelect('password')
.getOne()
if (!task) return res.status(404).send({Message:'task not found'})
task.title= title
task.description= description
task.project= project
task.dateTimeDue= dateTimeDue
task.dateTimeStart= dateTimeStart
task.author=user
task.accomplish= accomplish
task.priority= priority
await task.save()
res.send({message:'update task successfully'}) res.send({message:'update task successfully'})
// res.send({task}) // res.send({task})
}) })
...@@ -60,7 +60,6 @@ router.post('/', upload.single("avatar"), async (req : Request, res : Response): ...@@ -60,7 +60,6 @@ router.post('/', upload.single("avatar"), async (req : Request, res : Response):
router.post('/sessions/', async (req : Request, res : Response):Promise<object> => { router.post('/sessions/', async (req : Request, res : Response):Promise<object> => {
const {email, password} = req.body; const {email, password} = req.body;
console.log("email" + email, "password" + password )
const user = await dataSource const user = await dataSource
.createQueryBuilder() .createQueryBuilder()
.select("user") .select("user")
...@@ -70,7 +69,6 @@ router.post('/sessions/', async (req : Request, res : Response):Promise<object> ...@@ -70,7 +69,6 @@ router.post('/sessions/', async (req : Request, res : Response):Promise<object>
.getOne() .getOne()
if(!user) return res.status(404).send({Message:'user not found'}) if(!user) return res.status(404).send({Message:'user not found'})
const isMatch:boolean = await user.checkPassword(password); const isMatch:boolean = await user.checkPassword(password);
console.log("123")
if (!isMatch) return res.status(400).send({ if (!isMatch) return res.status(400).send({
error: "Wrong Password" error: "Wrong Password"
}) })
......
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