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
310f5700
Commit
310f5700
authored
Feb 27, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#167
week-data-start added to the front in store/actions/commonActions
parent
251b2975
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
83 additions
and
23 deletions
+83
-23
projects.ts
planner-api/src/routers/projects.ts
+0
-1
tasks.ts
planner-api/src/routers/tasks.ts
+9
-10
users.ts
planner-api/src/routers/users.ts
+0
-1
WeekCalendar.js
planner-front/src/containers/WeekCalendar/WeekCalendar.js
+10
-6
tasksTypes.js
planner-front/src/store/actionTypes/tasksTypes.js
+4
-0
commonActions.js
planner-front/src/store/actions/commonActions.js
+46
-1
projectsActions.js
planner-front/src/store/actions/projectsActions.js
+1
-1
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+9
-2
usersActions.js
planner-front/src/store/actions/usersActions.js
+1
-1
tasksReducer.js
planner-front/src/store/reducers/tasksReducer.js
+3
-0
No files found.
planner-api/src/routers/projects.ts
View file @
310f5700
...
...
@@ -47,7 +47,6 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> {
.
leftJoinAndSelect
(
'member.user'
,
'user'
)
.
where
(
'project.id IN(:...projectIds)'
,
{
projectIds
})
.
getMany
()
console
.
log
(
'projects
\
n'
,
projects
)
return
res
.
send
({
projects
})
}
catch
(
e
)
{
return
res
.
status
(
502
).
send
({
message
:(
e
as
Error
).
message
})
...
...
planner-api/src/routers/tasks.ts
View file @
310f5700
...
...
@@ -133,7 +133,6 @@ router.get('/user/:userId', async (req: Request, res: Response):Promise<Response
id
:
userId
}},
})
console
.
log
(
'tasks
\
n'
,
tasks
)
return
res
.
send
({
tasks
})
}
catch
(
e
){
return
res
.
status
(
502
).
send
({
message
:(
e
as
Error
).
message
})
...
...
@@ -402,6 +401,7 @@ router.get('/users-tasks', auth,async (req: Request, res: Response):Promise<Resp
* object with key displayName related to userId, list of Project related to user
*/
router
.
get
(
'/week-data-start/:userId'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
console
.
log
(
'week-data-start'
)
const
{
userId
}
=
req
.
params
try
{
const
requesterUser
=
req
.
body
.
user
...
...
@@ -436,18 +436,17 @@ router.get('/week-data-start/:userId',auth, async (req: Request, res: Response):
.
getRepository
(
Task
)
.
find
({
relations
:{
project
:
true
,
executor
:
true
,
},
where
:{
project
:
{
id
:
In
(
projectIds
)
}
}
})
where
:
{
executor
:{
id
:
userId
}
},
})
const
{
displayName
}
=
user
if
(
!
tasks
)
return
res
.
status
(
404
).
send
({
Message
:
'tasks not found'
})
console
.
log
(
'tasks: '
,
tasks
,
"projects
"
,
projects
,
'displayName
'
,
displayName
)
console
.
log
(
'tasks: '
,
tasks
,
"projects
: "
,
projects
,
'displayName :
'
,
displayName
)
return
res
.
send
({
displayName
,
projects
,
tasks
})
}
catch
(
e
){
return
res
.
status
(
502
).
send
({
message
:(
e
as
Error
).
message
})
...
...
planner-api/src/routers/users.ts
View file @
310f5700
...
...
@@ -51,7 +51,6 @@ return res.send({users})
.
where
(
"user.id = :userId"
,
{
userId
})
.
getOne
()
if
(
!
displayName
)
return
res
.
status
(
404
).
send
({
message
:
'displayName not found'
})
console
.
log
(
'displayName
\
n'
,
displayName
)
return
res
.
send
(
displayName
)
}
catch
(
e
)
{
return
res
.
status
(
502
).
send
({
message
:(
e
as
Error
).
message
})
...
...
planner-front/src/containers/WeekCalendar/WeekCalendar.js
View file @
310f5700
...
...
@@ -11,6 +11,7 @@ import DefaultModal from '../../components/UI/DefaultModal/DefaultModal';
import
{
AllHoursOneHourFormat
,
AllHoursTwoHourFormat
}
from
'../../constants'
;
import
{
getWeekInfoString
,
getWeekFromCurrentDate
,
dateToISOLikeButLocal
}
from
'../../helpers/CalendarHelpers'
;
import
{
fetchWeekDataStart
}
from
'../../store/actions/commonActions'
;
import
{
fetchAllUserProjects
}
from
'../../store/actions/projectsActions'
;
import
{
addCalendarTask
,
addCopyCalendarTask
,
deactivateCreateCopyTasksMode
,
deleteCalendarTask
,
editCalendarTask
,
fetchCalendarTasks
}
from
'../../store/actions/tasksActions'
;
import
{
fetchCurrentCalendarDisplayName
}
from
'../../store/actions/usersActions'
;
...
...
@@ -44,14 +45,17 @@ function WeekCalendar() {
useEffect
(()
=>
{
if
(
userCalendarId
)
{
setUserId
(
userCalendarId
)
dispatch
(
fetchCalendarTasks
(
userCalendarId
))
dispatch
(
fetchCurrentCalendarDisplayName
(
userCalendarId
))
dispatch
(
fetchAllUserProjects
())
// dispatch(fetchCalendarTasks(userCalendarId))
// dispatch(fetchCurrentCalendarDisplayName(userCalendarId))
// dispatch(fetchAllUserProjects())
dispatch
(
fetchWeekDataStart
(
userCalendarId
))
}
else
{
setUserId
(
user
.
id
)
dispatch
(
fetchCalendarTasks
(
user
.
id
))
dispatch
(
fetchCurrentCalendarDisplayName
(
user
.
id
))
dispatch
(
fetchAllUserProjects
())
dispatch
(
fetchWeekDataStart
(
user
.
id
))
// dispatch(fetchCalendarTasks(user.id))
// dispatch(fetchCurrentCalendarDisplayName(user.id))
// dispatch(fetchAllUserProjects())
}
},
[
userCalendarId
,
dispatch
,
user
.
id
])
...
...
planner-front/src/store/actionTypes/tasksTypes.js
View file @
310f5700
...
...
@@ -34,6 +34,10 @@ export const ACTIVATE_CREATE_COPY_TASKS_MODE = "ACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
DEACTIVATE_CREATE_COPY_TASKS_MODE
=
"DEACTIVATE_CREATE_COPY_TASKS_MODE"
export
const
FETCH_WEEK_DATA_START_REQUEST
=
"FETCH_WEEK_DATA_START_REQUEST"
;
export
const
FETCH_WEEK_DATA_START_SUCCESS
=
"FETCH_WEEK_DATA_START_SUCCESS"
;
export
const
FETCH_WEEK_DATA_START_FAILURE
=
"FETCH_WEEK_DATA_START_FAILURE"
;
...
...
planner-front/src/store/actions/commonActions.js
View file @
310f5700
import
axios
from
'../../axiosPlanner'
;
import
{
FETCH_WEEK_DATA_START_REQUEST
,
FETCH_WEEK_DATA_START_SUCCESS
,
FETCH_WEEK_DATA_START_FAILURE
,
FETCH_CALENDAR_TASKS_REQUEST
,
}
from
'../actionTypes/tasksTypes'
;
import
{
fetchAllUserProjectsSuccess
}
from
'./projectsActions'
;
import
{
fetchCalendarTasksSuccess
}
from
'./tasksActions'
;
import
{
fetchCurrentCalendarDisplayNameSuccess
}
from
'./usersActions'
;
export
const
showNotification
=
(
message
,
variant
=
"success"
)
=>
{
return
{
type
:
"SHOW_NOTIFICATION"
,
message
,
variant
}
}
export
const
hideNotification
=
()
=>
{
return
{
type
:
"HIDE_NOTIFICATION"
};
};
\ No newline at end of file
};
/** weekDataStart, recieves userId returns type WEEK_DATA_START_REQUEST*/
const
fetchWeekDataStartRequest
=
()
=>
{
return
{
type
:
FETCH_WEEK_DATA_START_REQUEST
}
}
/** weekDataStart, recieves userId returns type WEEK_DATA_START_SUCCESS*/
const
fetchWeekDataStartSuccess
=
(
weekData
)
=>
{
return
{
type
:
FETCH_WEEK_DATA_START_SUCCESS
,
weekData
}
}
/** weekDataStart, recieves userId returns type WEEK_DATA_START_FAILURE*/
const
fetchWeekDataStartFailure
=
(
error
)
=>
{
return
{
type
:
FETCH_WEEK_DATA_START_FAILURE
,
error
}
}
/**fetchWeekDataStart, recieves userId ,make GET request to 'tasks/week-data-start/{userId}, recieves weekdata */
export
const
fetchWeekDataStart
=
(
userId
)
=>
{
return
async
(
dispatch
)
=>
{
dispatch
(
fetchWeekDataStartRequest
());
try
{
console
.
log
(
'fetchWeekDataStart front'
,
userId
)
const
response
=
await
axios
.
get
(
`/tasks/week-data-start/
${
userId
}
`
);
dispatch
(
fetchCalendarTasksSuccess
(
response
.
data
.
tasks
))
dispatch
(
fetchAllUserProjectsSuccess
(
response
.
data
.
projects
));
dispatch
(
fetchCurrentCalendarDisplayNameSuccess
(
response
.
data
.
displayName
));
}
catch
(
error
)
{
dispatch
(
fetchWeekDataStartFailure
(
error
.
response
.
data
));
}
}
}
\ No newline at end of file
planner-front/src/store/actions/projectsActions.js
View file @
310f5700
...
...
@@ -143,7 +143,7 @@ export const createMember = (memberData) => {
};
}
const
fetchAllUserProjectsSuccess
=
(
projects
)
=>
{
export
const
fetchAllUserProjectsSuccess
=
(
projects
)
=>
{
return
{
type
:
FETCH_ALL_USER_PROJECTS_SUCCESS
,
projects
};
};
...
...
planner-front/src/store/actions/tasksActions.js
View file @
310f5700
...
...
@@ -24,6 +24,10 @@ import {
SORT_TASKS
,
FETCH_PROJECTS_NON_WATCHER_SUCCESS
,
FETCH_PROJECTS_NON_WATCHER_FAILURE
,
FETCH_PROJECTS_NON_WATCHER_REQUEST
,
FETCH_WEEK_DATA_START_FAILURE
,
FETCH_WEEK_DATA_START_REQUEST
,
FETCH_WEEK_DATA_START_SUCCESS
}
from
"../actionTypes/tasksTypes"
;
import
axios
from
'../../axiosPlanner'
...
...
@@ -31,7 +35,7 @@ const fetchCalendarTasksRequest = () => {
return
{
type
:
FETCH_CALENDAR_TASKS_REQUEST
}
};
const
fetchCalendarTasksSuccess
=
(
tasks
)
=>
{
export
const
fetchCalendarTasksSuccess
=
(
tasks
)
=>
{
return
{
type
:
FETCH_CALENDAR_TASKS_SUCCESS
,
tasks
}
};
...
...
@@ -352,4 +356,7 @@ export const activateCreateCopyTasksMode = (task, navigate) => {
export
const
deactivateCreateCopyTasksMode
=
()
=>
{
return
{
type
:
DEACTIVATE_CREATE_COPY_TASKS_MODE
}
}
\ No newline at end of file
}
planner-front/src/store/actions/usersActions.js
View file @
310f5700
...
...
@@ -137,7 +137,7 @@ export const fetchUsersAllFields = () => {
}
};
const
fetchCurrentCalendarDisplayNameSuccess
=
(
displayName
)
=>
{
export
const
fetchCurrentCalendarDisplayNameSuccess
=
(
displayName
)
=>
{
return
{
type
:
FETCH_DISPLAYNAME_SUCCESS
,
displayName
}
}
...
...
planner-front/src/store/reducers/tasksReducer.js
View file @
310f5700
...
...
@@ -23,6 +23,7 @@ import {
ACTIVATE_CREATE_COPY_TASKS_MODE
,
DEACTIVATE_CREATE_COPY_TASKS_MODE
,
SORT_TASKS
,
FETCH_WEEK_DATA_START_FAILURE
,
}
from
"../actionTypes/tasksTypes"
;
...
...
@@ -156,6 +157,8 @@ const tasksReduсer = (state = initialState, action) => {
return
{
...
state
,
copyMode
:
{
working
:
true
,
task
:
action
.
task
}
}
case
DEACTIVATE_CREATE_COPY_TASKS_MODE
:
return
{
...
state
,
copyMode
:
{
working
:
false
,
task
:
null
}
}
case
FETCH_WEEK_DATA_START_FAILURE
:
return
{
...
state
,
loading
:
false
,
error
:
action
.
error
};
case
SORT_TASKS
:
let
filteredTasks
=
[]
if
(
action
.
activeTasksOn
)
{
...
...
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