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
9507fc82
Commit
9507fc82
authored
Dec 12, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#74
added displayname request router for Timur
parent
4ea6a7bb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
users.ts
planner-api/src/routers/users.ts
+18
-1
MemberForm.js
planner-front/src/components/MemberForm/MemberForm.js
+1
-1
SwitchUserForm.js
...mponents/SwitchUserModal/SwitchUserForm/SwitchUserForm.js
+2
-1
No files found.
planner-api/src/routers/users.ts
View file @
9507fc82
...
@@ -7,6 +7,7 @@ import path from 'path';
...
@@ -7,6 +7,7 @@ import path from 'path';
import
{
config
}
from
"../config"
import
{
config
}
from
"../config"
import
{
Project
}
from
'../models/Project'
;
import
{
Project
}
from
'../models/Project'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
auth
}
from
'../helpers'
;
const
router
:
Router
=
express
.
Router
();
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
const
dataSource
=
myDataSource
;
...
@@ -48,8 +49,24 @@ router.get('/all-fields/', async (req : Request, res : Response):Promise<object>
...
@@ -48,8 +49,24 @@ router.get('/all-fields/', async (req : Request, res : Response):Promise<object>
},
},
}
}
})
})
console
.
log
(
'all fields users '
,
users
)
return
res
.
send
({
users
})
return
res
.
send
({
users
})
})
})
//** return displayName of user, requested by userId */
router
.
get
(
'/display-name/:userId'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
const
{
userId
}
=
req
.
params
const
displayName
=
await
dataSource
.
createQueryBuilder
()
.
select
([
'user.displayName'
])
.
from
(
User
,
"user"
)
.
where
(
"user.id = :userId"
,
{
userId
})
.
getOne
()
if
(
!
displayName
)
return
res
.
status
(
404
).
send
({
message
:
'displayName not found'
})
return
res
.
send
({
displayName
})
})
/**create new user*/
/**create new user*/
router
.
post
(
'/'
,
upload
.
single
(
"avatar"
),
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
router
.
post
(
'/'
,
upload
.
single
(
"avatar"
),
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
...
...
planner-front/src/components/MemberForm/MemberForm.js
View file @
9507fc82
...
@@ -52,7 +52,7 @@ const MemberForm = ({ onSubmit, members }) => {
...
@@ -52,7 +52,7 @@ const MemberForm = ({ onSubmit, members }) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchProject
(
params
.
id
))
dispatch
(
fetchProject
(
params
.
id
))
},
[
members
,
dispatch
,
params
]);
},
[
params
]);
// console.log(user)
// console.log(user)
// const onChange = (e) => {
// const onChange = (e) => {
// const value = e.target.value;
// const value = e.target.value;
...
...
planner-front/src/components/SwitchUserModal/SwitchUserForm/SwitchUserForm.js
View file @
9507fc82
...
@@ -13,12 +13,13 @@ const SwitchUserForm=({submitFormHandler, users})=> {
...
@@ -13,12 +13,13 @@ const SwitchUserForm=({submitFormHandler, users})=> {
setCurrentUser
(
user
)
setCurrentUser
(
user
)
setProjectsRole
([])
setProjectsRole
([])
}
}
console
.
log
(
'projectsRoles '
,
projectsRoles
)
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
currentUser
?.
members
.
length
>
0
)
{
if
(
currentUser
?.
members
.
length
>
0
)
{
for
(
let
member
of
currentUser
.
members
)
{
for
(
let
member
of
currentUser
.
members
)
{
cons
t
newProjectRole
=
{
le
t
newProjectRole
=
{
"projectName"
:
member
.
project
.
title
,
"projectName"
:
member
.
project
.
title
,
"roleName"
:
member
.
roleProject
"roleName"
:
member
.
roleProject
}
}
...
...
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