Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
91a3ef91
Commit
91a3ef91
authored
Nov 14, 2022
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#36
put resolved
parent
010f4453
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
27 deletions
+2
-27
tasks.ts
planner-api/src/routers/tasks.ts
+2
-27
No files found.
planner-api/src/routers/tasks.ts
View file @
91a3ef91
...
@@ -68,14 +68,6 @@ router.get('/my', async (req: Request, res: Response):Promise<Response>=>{
...
@@ -68,14 +68,6 @@ router.get('/my', async (req: Request, res: Response):Promise<Response>=>{
})
})
router
.
delete
(
'/:taskId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
delete
(
'/:taskId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
// const token = req.get('Authorization');
// const user = await dataSource
// .createQueryBuilder()
// .select("user")
// .from(User, "user")
// .where("user.token = :token", { token: token })
// .getOne()
// if(!user) return res.status(404).send({Message:'user not found'})
const
taskId
=
req
.
params
.
taskId
;
const
taskId
=
req
.
params
.
taskId
;
await
myDataSource
await
myDataSource
.
createQueryBuilder
()
.
createQueryBuilder
()
...
@@ -96,29 +88,12 @@ router.put('/',async(req:Request, res:Response)=> {
...
@@ -96,29 +88,12 @@ router.put('/',async(req:Request, res:Response)=> {
.
where
(
"user.token = :token"
,
{
token
:
token
})
.
where
(
"user.token = :token"
,
{
token
:
token
})
.
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
,
executors
,
accomplish
,
priority
}
=
req
.
body
;
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
const
task
=
await
dataSource
.
createQueryBuilder
()
.
createQueryBuilder
()
.
select
(
"task"
)
.
select
(
"task"
)
.
from
(
Task
,
"task"
)
.
from
(
Task
,
"task"
)
.
where
(
"task.id = :id"
,
{
id
})
.
where
(
"task.id = :id"
,
{
id
})
// .addSelect('password')
.
getOne
()
.
getOne
()
if
(
!
task
)
return
res
.
status
(
404
).
send
({
Message
:
'task not found'
})
if
(
!
task
)
return
res
.
status
(
404
).
send
({
Message
:
'task not found'
})
task
.
title
=
title
task
.
title
=
title
...
@@ -127,9 +102,9 @@ router.put('/',async(req:Request, res:Response)=> {
...
@@ -127,9 +102,9 @@ router.put('/',async(req:Request, res:Response)=> {
task
.
dateTimeDue
=
dateTimeDue
task
.
dateTimeDue
=
dateTimeDue
task
.
dateTimeStart
=
dateTimeStart
task
.
dateTimeStart
=
dateTimeStart
task
.
author
=
user
task
.
author
=
user
task
.
executors
=
executors
task
.
accomplish
=
accomplish
task
.
accomplish
=
accomplish
task
.
priority
=
priority
task
.
priority
=
priority
await
task
.
save
()
await
task
.
save
()
res
.
send
({
message
:
'update task successfully'
})
res
.
send
({
message
:
'update task successfully'
})
// res.send({task})
})
})
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment