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
83e48c87
Commit
83e48c87
authored
Dec 20, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#110
remove consoles and comments
parent
5c5a9798
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1 addition
and
57 deletions
+1
-57
helpers.ts
planner-api/src/helpers.ts
+0
-4
projects.ts
planner-api/src/routers/projects.ts
+0
-5
tasks.ts
planner-api/src/routers/tasks.ts
+0
-5
NewTaskForm.js
...-front/src/components/UsersTasksCompoments/NewTaskForm.js
+0
-1
MyTasks.js
planner-front/src/containers/MyTasks/MyTasks.js
+1
-32
UsersTasks.js
planner-front/src/containers/UsersTasks/UsersTasks.js
+0
-10
No files found.
planner-api/src/helpers.ts
View file @
83e48c87
...
@@ -212,11 +212,7 @@ export let transporter = nodemailer.createTransport({
...
@@ -212,11 +212,7 @@ export let transporter = nodemailer.createTransport({
export
const
subtractHours
=
(
date
:
Date
,
hours
:
number
)
=>
{
export
const
subtractHours
=
(
date
:
Date
,
hours
:
number
)
=>
{
const
dateCopy
=
new
Date
(
date
);
const
dateCopy
=
new
Date
(
date
);
console
.
log
(
'dateCopy '
,
dateCopy
)
dateCopy
.
setHours
(
dateCopy
.
getHours
()
-
hours
);
dateCopy
.
setHours
(
dateCopy
.
getHours
()
-
hours
);
console
.
log
(
'dateCopy afterset '
,
dateCopy
)
return
dateCopy
;
return
dateCopy
;
}
}
...
...
planner-api/src/routers/projects.ts
View file @
83e48c87
...
@@ -121,7 +121,6 @@ router.get('/user/:userId', async (req : Request, res : Response): Promise<Respo
...
@@ -121,7 +121,6 @@ router.get('/user/:userId', async (req : Request, res : Response): Promise<Respo
router
.
post
(
'/add-user/'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
post
(
'/add-user/'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
userId
,
projectId
,
roleProject
}
=
req
.
body
;
const
{
userId
,
projectId
,
roleProject
}
=
req
.
body
;
console
.
log
(
"req body"
+
req
.
body
)
const
newMember
:
Member
=
new
Member
();
const
newMember
:
Member
=
new
Member
();
try
{
try
{
newMember
.
user
=
userId
;
newMember
.
user
=
userId
;
...
@@ -139,10 +138,8 @@ router.post('/add-user/', authAdminProject, async (req: Request, res: Response):
...
@@ -139,10 +138,8 @@ router.post('/add-user/', authAdminProject, async (req: Request, res: Response):
/** Remove user from specific project by userId */
/** Remove user from specific project by userId */
router
.
delete
(
'/remove-user/:userId'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
delete
(
'/remove-user/:userId'
,
authAdminProject
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
console
.
log
(
'req.body '
,
req
.
body
)
const
{
projectId
}
=
req
.
body
;
const
{
projectId
}
=
req
.
body
;
const
{
userId
}
=
req
.
params
;
const
{
userId
}
=
req
.
params
;
console
.
log
(
'projectId '
,
projectId
,
'userId '
,
userId
)
try
{
try
{
const
projectMember
=
await
dataSource
const
projectMember
=
await
dataSource
...
@@ -161,10 +158,8 @@ router.delete('/remove-user/:userId', authAdminProject,async (req: Request, res:
...
@@ -161,10 +158,8 @@ router.delete('/remove-user/:userId', authAdminProject,async (req: Request, res:
}
}
}
}
})
})
console
.
log
(
'projectMember '
,
projectMember
)
if
(
!
projectMember
)
return
res
.
status
(
404
).
send
({
message
:
"this member is not present"
})
if
(
!
projectMember
)
return
res
.
status
(
404
).
send
({
message
:
"this member is not present"
})
await
Member
.
delete
({
id
:
projectMember
.
id
})
await
Member
.
delete
({
id
:
projectMember
.
id
})
console
.
log
(
'projectMember deleted successfully'
)
return
res
.
send
({
message
:
"User removed from project successfully"
})
return
res
.
send
({
message
:
"User removed from project successfully"
})
}
catch
(
e
){
}
catch
(
e
){
return
res
.
send
({
message
:
'Failed to remove user from project'
})
return
res
.
send
({
message
:
'Failed to remove user from project'
})
...
...
planner-api/src/routers/tasks.ts
View file @
83e48c87
...
@@ -27,7 +27,6 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
...
@@ -27,7 +27,6 @@ router.get('/', async(req:Request, res:Response):Promise<Response> => {
/**create new task for table MyTask*/
/**create new task for table MyTask*/
router
.
post
(
'/'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
post
(
'/'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
console
.
log
(
'dateTimeStart '
,
dateTimeStart
,
'dateTimeDue '
,
dateTimeDue
,
'dateTimeDeadLine '
,
dateTimeDeadLine
)
//** if dateTimeDue is null , then dateTimeDeadLine copied to dateTimeDue and dateTimeStart = dateTimeDue - 1 hour*/
//** if dateTimeDue is null , then dateTimeDeadLine copied to dateTimeDue and dateTimeStart = dateTimeDue - 1 hour*/
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeStartFinal
=
dateTimeStart
let
dateTimeStartFinal
=
dateTimeStart
...
@@ -36,7 +35,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
...
@@ -36,7 +35,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
dateTimeDueFinal
=
dateTimeDeadLine
dateTimeDueFinal
=
dateTimeDeadLine
dateTimeStartFinal
=
subtractHours
(
dateTimeDueFinal
,
1
)
dateTimeStartFinal
=
subtractHours
(
dateTimeDueFinal
,
1
)
}
}
console
.
log
(
'dateTimeDueFinal '
,
dateTimeDueFinal
,
'dateTimeStartFinal '
,
dateTimeStartFinal
,
'dateTimeDeadLine '
,
dateTimeDeadLine
,
' dateTimeDeadlineFinal '
,
dateTimeDeadlineFinal
)
const
newTask
=
new
Task
();
const
newTask
=
new
Task
();
newTask
.
title
=
title
;
newTask
.
title
=
title
;
...
@@ -112,7 +110,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
...
@@ -112,7 +110,6 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
router
.
post
(
'/users'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
post
(
'/users'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
}
=
req
.
body
;
const
newTask
=
new
Task
();
const
newTask
=
new
Task
();
console
.
log
(
'project '
,
project
,
)
newTask
.
title
=
title
;
newTask
.
title
=
title
;
newTask
.
description
=
description
;
newTask
.
description
=
description
;
if
(
project
)
{
if
(
project
)
{
...
@@ -252,7 +249,6 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
...
@@ -252,7 +249,6 @@ router.get('/my',auth, async (req: Request, res: Response):Promise<Response>=>{
/**return tasks & users of projects in which current user is involved, search by token*/
/**return tasks & users of projects in which current user is involved, search by token*/
router
.
get
(
'/related'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
get
(
'/related'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
console
.
log
(
'related'
)
const
user
=
req
.
body
.
user
const
user
=
req
.
body
.
user
const
tasks
=
await
dataSource
const
tasks
=
await
dataSource
.
createQueryBuilder
()
.
createQueryBuilder
()
...
@@ -313,7 +309,6 @@ router.put('/:taskId',authAuthorOrExecutorOfTask,async(req:Request, res:Response
...
@@ -313,7 +309,6 @@ router.put('/:taskId',authAuthorOrExecutorOfTask,async(req:Request, res:Response
const
{
taskId
}
=
req
.
params
const
{
taskId
}
=
req
.
params
const
{
authorStatus
,
executorStatus
,
title
,
description
,
note
,
archive
,
project
,
dateTimeTaskId
,
dateTimeStart
,
const
{
authorStatus
,
executorStatus
,
title
,
description
,
note
,
archive
,
project
,
dateTimeTaskId
,
dateTimeStart
,
dateTimeDue
,
executor
,
accomplish
,
dateTimeDeadLine
,
dateTimeFactDeadLine
,
priority
}
=
req
.
body
;
dateTimeDue
,
executor
,
accomplish
,
dateTimeDeadLine
,
dateTimeFactDeadLine
,
priority
}
=
req
.
body
;
console
.
log
(
'dateTimeTaskId '
,
dateTimeTaskId
)
const
task
=
await
taskFinderById
(
taskId
)
const
task
=
await
taskFinderById
(
taskId
)
if
(
!
task
)
return
res
.
status
(
404
).
send
({
Message
:
'task not found'
})
if
(
!
task
)
return
res
.
status
(
404
).
send
({
Message
:
'task not found'
})
let
dateTimeTask
=
null
;
let
dateTimeTask
=
null
;
...
...
planner-front/src/components/UsersTasksCompoments/NewTaskForm.js
View file @
83e48c87
...
@@ -69,7 +69,6 @@ export default function NewTaskForm({
...
@@ -69,7 +69,6 @@ export default function NewTaskForm({
const
onProjectChange
=
(
e
,
task
)
=>
{
const
onProjectChange
=
(
e
,
task
)
=>
{
const
value
=
e
.
target
.
value
;
const
value
=
e
.
target
.
value
;
console
.
log
(
' onProjectChange value '
,
value
,
'task '
,
task
)
const
project
=
projects
.
find
((
project
)
=>
project
.
id
===
value
);
const
project
=
projects
.
find
((
project
)
=>
project
.
id
===
value
);
setCurrentProject
(
project
)
setCurrentProject
(
project
)
const
newTask
=
{
...
task
};
const
newTask
=
{
...
task
};
...
...
planner-front/src/containers/MyTasks/MyTasks.js
View file @
83e48c87
...
@@ -35,10 +35,6 @@ export default function EnhancedTable() {
...
@@ -35,10 +35,6 @@ export default function EnhancedTable() {
task
:
null
,
task
:
null
,
});
});
// useEffect(() => {
// dispatch(fetchAllTasks());
// // filterProjectsNamesFromTasks();
// }, [dispatch]);
useEffect
(()
=>
{
useEffect
(()
=>
{
dispatch
(
fetchAllTasks
());
dispatch
(
fetchAllTasks
());
...
@@ -47,9 +43,6 @@ export default function EnhancedTable() {
...
@@ -47,9 +43,6 @@ export default function EnhancedTable() {
}
}
},
[
tasks
?.
length
,
addTaskForm
,
setAddTaskForm
,
dispatch
]);
},
[
tasks
?.
length
,
addTaskForm
,
setAddTaskForm
,
dispatch
]);
console
.
log
(
'tasks '
,
tasks
,
'projects '
,
projects
)
console
.
log
(
'tasks '
,
tasks
,
'projects '
,
projects
)
// useEffect(() => {
// dispatch(fetchAllTasks());
// }, [addTaskForm, setAddTaskForm, dispatch]);
...
@@ -163,16 +156,9 @@ export default function EnhancedTable() {
...
@@ -163,16 +156,9 @@ export default function EnhancedTable() {
};
};
const
deleteDateTimeTaskHandle
=
(
dateTimeTaskId
)
=>
{
const
deleteDateTimeTaskHandle
=
(
dateTimeTaskId
)
=>
{
console
.
log
(
'delete by dateTimeTaskId '
,
dateTimeTaskId
)
dispatch
(
deleteDateTimeTask
(
dateTimeTaskId
))
dispatch
(
deleteDateTimeTask
(
dateTimeTaskId
))
}
}
const
handleEditDateTimeTask
=
(
dateTimeTask
)
=>
{
console
.
log
(
'edit by dateTImeTask'
)
// dispatch(handleEditDateTimeTask(dateTimeTask))
}
const
onModalOpen
=
(
event
,
task
)
=>
{
const
onModalOpen
=
(
event
,
task
)
=>
{
event
.
stopPropagation
();
event
.
stopPropagation
();
setModal
({
...
modal
,
open
:
true
,
id
:
task
.
id
});
setModal
({
...
modal
,
open
:
true
,
id
:
task
.
id
});
...
@@ -187,31 +173,15 @@ export default function EnhancedTable() {
...
@@ -187,31 +173,15 @@ export default function EnhancedTable() {
const
[
filterProjectTumbler
,
setFilterProjectTumbler
]
=
React
.
useState
(
false
);
const
[
filterProjectTumbler
,
setFilterProjectTumbler
]
=
React
.
useState
(
false
);
const
onClose
=
(
projectIdListForTaskSelect
)
=>
{
const
onClose
=
(
projectIdListForTaskSelect
)
=>
{
console
.
log
(
'projectIdListForTaskSelect '
,
projectIdListForTaskSelect
)
let
tasksFilteredByProject
=
tasks
let
tasksFilteredByProject
=
tasks
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
}
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setFilterProjectTumbler
(
true
)
setFilterProjectTumbler
(
true
)
}
}
// const rawProjects = tasks?.map((task) => task.project);
if
(
// const uniqueProjects = rawProjects?.reduce((results, value, index) => {
// const exist = results.find((v) => {
// return v !== null && v.id === value?.id;
// });
// if (!exist && value !== null) {
// results.push(value);
// }
// return results;
// }, []);
// console.log('tasks', tasks)
if
(
tasks
&&
tasks
&&
tasks
?.
length
>
0
&&
tasks
?.
length
>
0
&&
recievedTasks
&&
recievedTasks
&&
...
@@ -255,7 +225,6 @@ export default function EnhancedTable() {
...
@@ -255,7 +225,6 @@ export default function EnhancedTable() {
task
=
{
task
}
task
=
{
task
}
deleteHandle
=
{
deleteHandle
}
deleteHandle
=
{
deleteHandle
}
handleEditTask
=
{
handleEditTask
}
handleEditTask
=
{
handleEditTask
}
handleEditDateTimeTask
=
{
handleEditDateTimeTask
}
deleteDateTimeTask
=
{
deleteDateTimeTaskHandle
}
deleteDateTimeTask
=
{
deleteDateTimeTaskHandle
}
onChange
=
{
onChange
}
onChange
=
{
onChange
}
onModalOpen
=
{
onModalOpen
}
onModalOpen
=
{
onModalOpen
}
...
...
planner-front/src/containers/UsersTasks/UsersTasks.js
View file @
83e48c87
...
@@ -46,15 +46,8 @@ export default function UsersTasks() {
...
@@ -46,15 +46,8 @@ export default function UsersTasks() {
}
}
},
[
dispatch
,
},
[
dispatch
,
tasks
?.
length
,
tasks
?.
length
,
// tasks,
addTaskForm
,
setAddTaskForm
]);
addTaskForm
,
setAddTaskForm
]);
// useEffect(() => {
// dispatch(fetchAllTasksByMembership());
// }, [addTaskForm, setAddTaskForm]);
const
handleRequestSort
=
(
property
)
=>
{
const
handleRequestSort
=
(
property
)
=>
{
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
const
isAsc
=
orderBy
===
property
&&
order
===
"asc"
;
setOrder
(
isAsc
?
"desc"
:
"asc"
);
setOrder
(
isAsc
?
"desc"
:
"asc"
);
...
@@ -106,7 +99,6 @@ export default function UsersTasks() {
...
@@ -106,7 +99,6 @@ export default function UsersTasks() {
for
(
let
member
of
project
.
members
){
for
(
let
member
of
project
.
members
){
executorList
.
push
(
member
.
user
)
executorList
.
push
(
member
.
user
)
}
}
console
.
log
(
'executorList '
,
executorList
)
}
}
setExecutors
(
executorList
)
setExecutors
(
executorList
)
...
@@ -199,12 +191,10 @@ export default function UsersTasks() {
...
@@ -199,12 +191,10 @@ export default function UsersTasks() {
const
onClose
=
(
projectIdListForTaskSelect
)
=>
{
const
onClose
=
(
projectIdListForTaskSelect
)
=>
{
console
.
log
(
'projectIdListForTaskSelect '
,
projectIdListForTaskSelect
)
let
tasksFilteredByProject
=
tasks
let
tasksFilteredByProject
=
tasks
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
if
(
projectIdListForTaskSelect
.
length
>
0
)
{
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
tasksFilteredByProject
=
tasks
.
filter
(
task
=>
projectIdListForTaskSelect
.
includes
(
task
.
project
?.
id
))
}
}
console
.
log
(
'tasksFilteredByProject '
,
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setRecievedTasks
(
tasksFilteredByProject
)
setFilterProjectTumbler
(
true
)
setFilterProjectTumbler
(
true
)
}
}
...
...
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