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