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()
// .update(Task)
// .set({
// title: title,
// description: description,
// project: project,
// dateTimeDue: dateTimeDue,
// dateTimeStart: dateTimeStart,
// author:user,
// accomplish: accomplish,
// priority: priority
// })
// .where("id = :id", { id: id })
// .execute()
const task = await dataSource
.createQueryBuilder() .createQueryBuilder()
.update(Task) .select("task")
.set({ .from(Task, "task")
title: title, .where("task.id = :id", { id })
description: description, // .addSelect('password')
project: project, .getOne()
dateTimeStart: dateTimeStart, if (!task) return res.status(404).send({Message:'task not found'})
dateTimeDue: dateTimeDue, task.title= title
accomplish: accomplish, task.description= description
priority: priority, task.project= project
author:user, task.dateTimeDue= dateTimeDue
executors:executors task.dateTimeStart= dateTimeStart
}) task.author=user
.where("id = :id", { id: id }) task.accomplish= accomplish
.execute() 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