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
0f1d3b06
Commit
0f1d3b06
authored
Dec 17, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#110
setup of router post tasks/my
parent
0871584f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
tasks.ts
planner-api/src/routers/tasks.ts
+11
-10
No files found.
planner-api/src/routers/tasks.ts
View file @
0f1d3b06
...
@@ -75,10 +75,8 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
...
@@ -75,10 +75,8 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
newMember
.
project
=
newPersonalProject
;
newMember
.
project
=
newPersonalProject
;
newMember
.
roleProject
=
MemberRole
.
ADMIN
;
newMember
.
roleProject
=
MemberRole
.
ADMIN
;
await
newMember
.
save
();
await
newMember
.
save
();
console
.
log
(
'newPersonalProject '
,
newPersonalProject
)
}
}
}
}
newTask
.
dateTimeDeadLine
=
dateTimeDeadLine
;
newTask
.
dateTimeDeadLine
=
dateTimeDeadLine
;
newTask
.
author
=
user
;
newTask
.
author
=
user
;
newTask
.
executor
=
executor
;
newTask
.
executor
=
executor
;
...
@@ -142,7 +140,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
...
@@ -142,7 +140,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
newMember
.
project
=
newPersonalProject
;
newMember
.
project
=
newPersonalProject
;
newMember
.
roleProject
=
MemberRole
.
ADMIN
;
newMember
.
roleProject
=
MemberRole
.
ADMIN
;
await
newMember
.
save
();
await
newMember
.
save
();
console
.
log
(
'newPersonalProject '
,
newPersonalProject
)
}
}
}
}
...
@@ -181,7 +178,7 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response
...
@@ -181,7 +178,7 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response
})
})
/**check tasks of current user where he is executor, search by id*/
/**check tasks of current user where he is executor
(works for tbl MyTasks)
, search by id*/
router
.
get
(
'/my'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
get
(
'/my'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
user
=
req
.
body
.
user
const
user
=
req
.
body
.
user
const
tasks
=
await
dataSource
const
tasks
=
await
dataSource
...
@@ -196,14 +193,18 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
...
@@ -196,14 +193,18 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
id
:
user
.
id
id
:
user
.
id
}
}
},
},
{
author
:{
id
:
user
.
id
}
},
]
]
})
})
return
res
.
send
({
tasks
})
const
projects
=
await
dataSource
.
getRepository
(
Project
)
.
find
({
where
:{
members
:{
user
:{
id
:
user
.
id
}
}
}})
return
res
.
send
({
tasks
,
projects
})
})
})
...
...
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