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
010f4453
Commit
010f4453
authored
Nov 14, 2022
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#36
merge stash apply
parent
6affab55
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
20 deletions
+33
-20
tasks.ts
planner-api/src/routers/tasks.ts
+33
-18
users.ts
planner-api/src/routers/users.ts
+0
-2
No files found.
planner-api/src/routers/tasks.ts
View file @
010f4453
...
...
@@ -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
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
()
.
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
()
.
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})
})
planner-api/src/routers/users.ts
View file @
010f4453
...
...
@@ -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"
})
...
...
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