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
475800e8
Commit
475800e8
authored
Nov 25, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#63
added router/projects/my
parent
53e17d6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
projects.ts
planner-api/src/routers/projects.ts
+16
-2
No files found.
planner-api/src/routers/projects.ts
View file @
475800e8
...
@@ -5,7 +5,6 @@ import { User } from '../models/User';
...
@@ -5,7 +5,6 @@ import { User } from '../models/User';
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
userInfo
}
from
'os'
;
import
{
userInfo
}
from
'os'
;
import
{
Task
}
from
'../models/Task'
;
import
{
Task
}
from
'../models/Task'
;
import
{
getRepository
}
from
'typeorm'
;
const
router
:
Router
=
express
.
Router
();
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
const
dataSource
=
myDataSource
;
...
@@ -26,7 +25,22 @@ router.get('/my',async (req:Request, res:Response): Promise<Response>=> {
...
@@ -26,7 +25,22 @@ router.get('/my',async (req:Request, res:Response): Promise<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
projects
:
Project
[]
=
await
dataSource
.
manager
.
find
(
Project
)
const
projects
=
await
dataSource
.
createQueryBuilder
()
.
from
(
Project
,
"project"
)
.
select
(
"project"
)
.
leftJoinAndSelect
(
'project.members'
,
'member'
)
.
loadRelationCountAndMap
(
'project.tasks'
,
'project.tasks'
)
.
leftJoinAndSelect
(
'member.user'
,
'user'
)
.
addSelect
(
'member'
)
.
where
(
'member.userId = :userId'
,{
userId
:
user
.
id
})
// .where("project.id = :id", { id: req.params.id })
// .select(["*","members"])
// .select("*")
.
getMany
()
// const projects:Project[] = await dataSource.manager.find(Project)
return
res
.
send
({
projects
})
return
res
.
send
({
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