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
a073ecd6
Commit
a073ecd6
authored
Feb 22, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#167
added fix on the projects that are reformated in the fetchProjectsNonWatcher reducer
parent
637da7d0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
6 deletions
+35
-6
projects.ts
planner-api/src/routers/projects.ts
+3
-1
СustomSelect.js
planner-front/src/components/UI/СustomSelect/СustomSelect.js
+1
-0
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+4
-2
projectsActions.js
planner-front/src/store/actions/projectsActions.js
+25
-2
projectsReducer.js
planner-front/src/store/reducers/projectsReducer.js
+2
-1
No files found.
planner-api/src/routers/projects.ts
View file @
a073ecd6
...
...
@@ -228,7 +228,8 @@ router.put('/change-project-role/:userId',authAdminProject, async (req: Request
/** return projects where user's member.role not equal 'watcher' */
router
.
get
(
'/task_create/:userId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
try
{
const
userId
:
string
=
req
.
params
.
userId
const
userId
=
req
.
params
.
userId
console
.
log
(
'userId'
,
userId
)
const
userProjects
=
await
dataSource
.
createQueryBuilder
()
.
select
(
'project'
)
...
...
@@ -238,6 +239,7 @@ router.get('/task_create/:userId', async (req : Request, res : Response): Promis
.
where
(
"user.id = :id"
,
{
id
:
userId
})
.
andWhere
(
"member.roleProject != :role"
,
{
role
:
MemberRole
.
WATCHER
})
.
getMany
();
console
.
log
(
'userProjects'
,
userProjects
)
return
res
.
send
({
userProjects
})
}
catch
(
e
)
{
return
res
.
status
(
502
).
send
({
message
:(
e
as
Error
).
message
})
...
...
planner-front/src/components/UI/СustomSelect/СustomSelect.js
View file @
a073ecd6
...
...
@@ -2,6 +2,7 @@ import { FormControl, InputLabel, MenuItem, Select } from '@mui/material';
import
{
memo
}
from
'react'
;
function
С
ustomSelect
({
value
,
onChange
,
label
,
variant
=
'standard'
,
items
,
id
,
defaultValue
,
name
,
sx
,
renderValue
})
{
console
.
log
(
'custom select render , '
,
items
)
return
(
<>
<
FormControl
variant
=
{
variant
}
sx
=
{
sx
?.
width
?
sx
:
{
m
:
0
,
minWidth
:
125
}}
>
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
a073ecd6
...
...
@@ -17,7 +17,7 @@ export default function MyTasks() {
const
{
user
}
=
useSelector
((
state
)
=>
state
.
users
);
const
{
tasks
,
sortedTasks
}
=
useSelector
((
state
)
=>
state
.
tasks
,
shallowEqual
);
const
{
allUserProjectsForModalTask
,
projects
}
=
useSelector
(
state
=>
state
.
projects
,
shallowEqual
)
console
.
log
(
'allUserProjectsForModalTask'
,
allUserProjectsForModalTask
)
const
[
newTask
,
setNewTask
]
=
useState
({
priority
:
''
,
title
:
''
,
...
...
@@ -118,9 +118,11 @@ export default function MyTasks() {
dateTimeDeadLine
:
null
})
}
console
.
log
(
'before dispatch fetchProjectsNonWatcherForTaskCreate'
)
dispatch
(
fetchProjectsNonWatcherForTaskCreate
(
user
.
id
))
setAddFormStatus
((
prevState
)
=>
{
return
!
prevState
})
},
[
addFormStatus
])
// }, [addFormStatus])
},
[])
...
...
planner-front/src/store/actions/projectsActions.js
View file @
a073ecd6
import
axios
from
"../../axiosPlanner"
;
import
{
CHANGE_MEMBER_ROLE_FAILURE
,
CHANGE_MEMBER_ROLE_REQUEST
,
CHANGE_MEMBER_ROLE_SUCCESS
,
CREATE_MEMBER_SUCCESS
,
CREATE_PROJECT_SUCCESS
,
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
}
from
"../actionTypes/projectsActionTypes"
;
import
{
CHANGE_MEMBER_ROLE_FAILURE
,
CHANGE_MEMBER_ROLE_REQUEST
,
CHANGE_MEMBER_ROLE_SUCCESS
,
CREATE_MEMBER_SUCCESS
,
CREATE_PROJECT_SUCCESS
,
DELETE_MEMBER_FAILURE
,
DELETE_MEMBER_REQUEST
,
DELETE_MEMBER_SUCCESS
,
DELETE_PROJECT_FAILURE
,
DELETE_PROJECT_REQUEST
,
DELETE_PROJECT_SUCCESS
,
FETCH_ALL_USER_PROJECTS_SUCCESS
,
FETCH_PROJECTS_ERROR
,
FETCH_PROJECTS_REQUEST
,
FETCH_PROJECTS_SUCCESS
,
FETCH_PROJECT_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_REQUEST
,
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_FAILURE
}
from
"../actionTypes/projectsActionTypes"
;
import
{
showNotification
}
from
"./commonActions"
;
const
fetchProjectsRequest
=
()
=>
{
...
...
@@ -164,6 +184,9 @@ export const changeMemberRole = (userId, data) => {
}
}
const
fetchProjectsNonWatcherRequest
=
()
=>
{
return
{
type
:
FETCH_PROJECTS_NON_WATCHER_REQUEST
}
};
const
fetchProjectsNonWatcherSuccess
=
(
projects
)
=>
{
return
{
type
:
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
projects
}
...
...
@@ -175,7 +198,7 @@ const fetchProjectsNonWatcherSuccess = (projects) => {
export
const
fetchProjectsNonWatcherForTaskCreate
=
(
userId
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetch
CalendarTasks
Request
());
dispatch
(
fetch
ProjectsNonWatcher
Request
());
try
{
const
response
=
await
axios
.
get
(
`/projects/task_create/
${
userId
}
`
);
dispatch
(
fetchProjectsNonWatcherSuccess
(
response
.
data
.
projects
))
...
...
planner-front/src/store/reducers/projectsReducer.js
View file @
a073ecd6
...
...
@@ -62,7 +62,8 @@ const projectsReducer = (state = initialState, action) => {
case
FETCH_PROJECTS_NON_WATCHER_REQUEST
:
return
{
...
state
,
loading
:
true
};
case
FETCH_PROJECTS_NON_WATCHER_SUCCESS
:
return
{
...
state
,
loading
:
false
,
allUserProjectsForModalTask
:
action
.
projects
};
const
projectsNonWatcher
=
action
.
projects
.
map
((
project
)
=>
{
return
{
value
:
project
.
id
,
text
:
project
.
title
}})
return
{
...
state
,
loading
:
false
,
allUserProjectsForModalTask
:
projectsNonWatcher
};
case
FETCH_PROJECTS_NON_WATCHER_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
default
:
...
...
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