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
b51730d1
Commit
b51730d1
authored
Dec 21, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#116
edit task fixed
parent
bbca53c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
70 deletions
+27
-70
helpers.ts
planner-api/src/helpers.ts
+12
-23
tasks.ts
planner-api/src/routers/tasks.ts
+1
-1
TableRowTask.js
...components/MyTasksCompoments/TableRowTask/TableRowTask.js
+14
-46
No files found.
planner-api/src/helpers.ts
View file @
b51730d1
...
@@ -26,19 +26,17 @@ export const auth = async(req: Request,res: Response, next:NextFunction):Promise
...
@@ -26,19 +26,17 @@ export const auth = async(req: Request,res: Response, next:NextFunction):Promise
/**Check if user with the given token is executor or author of task with the given Id(taskId) */
/**Check if user with the given token is executor or author of task with the given Id(taskId) */
export
const
authAuthorOrExecutorOfTask
=
async
(
req
:
Request
,
res
:
Response
,
next
:
NextFunction
):
Promise
<
void
|
express
.
Response
<
Response
>>=>
{
export
const
authAuthorOrExecutorOfTask
=
async
(
req
:
Request
,
res
:
Response
,
next
:
NextFunction
):
Promise
<
void
|
express
.
Response
<
Response
>>=>
{
const
token
=
req
.
get
(
'Authorization'
);
const
token
=
req
.
get
(
'Authorization'
);
const
{
user
}
=
req
.
body
let
taskId
=
null
let
taskId
=
null
taskId
=
req
.
body
.
taskId
if
(
req
.
body
?.
taskId
)
{
if
(
req
.
body
?.
taskId
)
{
taskId
=
req
.
body
.
taskId
taskId
=
req
.
body
.
taskId
}
else
if
(
req
.
params
?.
taskId
){
}
else
if
(
req
.
params
?.
taskId
){
taskId
=
req
.
params
.
taskId
taskId
=
req
.
params
.
taskId
}
else
return
res
.
send
({
vessage
:
"there are no taskId found"
})
}
else
return
res
.
send
({
vessage
:
"there are no taskId found"
})
if
(
!
token
)
return
res
.
status
(
401
).
send
({
Message
:
'token not exists'
})
if
(
!
token
)
return
res
.
status
(
401
).
send
({
Message
:
'token not exists'
})
req
.
body
=
{...
req
.
body
,
executorStatus
:
false
}
req
.
body
=
{...
req
.
body
,
executorStatus
:
false
}
req
.
body
=
{...
req
.
body
,
authorStatus
:
false
}
req
.
body
=
{...
req
.
body
,
authorStatus
:
false
}
const
task
=
await
dataSource
const
task
=
await
dataSource
.
getRepository
(
Task
)
.
getRepository
(
Task
)
.
findOne
({
.
findOne
({
...
@@ -47,28 +45,23 @@ export const authAuthorOrExecutorOfTask = async(req: Request,res: Response, next
...
@@ -47,28 +45,23 @@ export const authAuthorOrExecutorOfTask = async(req: Request,res: Response, next
author
:
true
,
author
:
true
,
dateTimeTasks
:
true
,
dateTimeTasks
:
true
,
},
},
where
:
[
where
:
{
{
id
:
taskId
,
id
:
taskId
,
executor
:{
}
token
:
token
})
}
},
{
id
:
taskId
,
author
:{
token
:
token
}
},
]})
if
(
!
task
)
return
res
.
status
(
404
).
send
({
message
:
'task with possible user involved is not found'
})
if
(
!
task
)
return
res
.
status
(
404
).
send
({
message
:
'task with possible user involved is not found'
})
req
.
body
=
{...
req
.
body
,
task
:
task
}
if
(
task
.
author
?.
id
===
user
.
id
)
{
if
(
task
?.
executor
?.
token
===
token
)
{
req
.
body
=
{...
req
.
body
,
authorStatus
:
true
}
}
if
(
task
.
executor
?.
id
===
user
.
id
){
req
.
body
=
{...
req
.
body
,
executorStatus
:
true
}
req
.
body
=
{...
req
.
body
,
executorStatus
:
true
}
}
}
if
(
task
?.
author
?.
token
===
token
)
{
const
{
executorStatus
,
authorStatus
}
=
req
.
body
req
.
body
=
{...
req
.
body
,
authorStatus
:
true
}
if
(
!
executorStatus
&&
!
authorStatus
)
{
res
.
status
(
403
).
send
({
message
:
'user is not authorized'
})
}
}
req
.
body
=
{...
req
.
body
,
task
:
task
}
next
()
next
()
};
};
...
@@ -135,9 +128,6 @@ export const authAdminProject = async(req: Request,res: Response, next:NextFunct
...
@@ -135,9 +128,6 @@ export const authAdminProject = async(req: Request,res: Response, next:NextFunct
}
}
/** return user if is in the given project, recieves userId adn projectId */
/**task finder by id, return one task */
/**task finder by id, return one task */
export
const
taskFinderById
=
async
(
taskId
:
string
):
Promise
<
null
|
Task
>=>
{
export
const
taskFinderById
=
async
(
taskId
:
string
):
Promise
<
null
|
Task
>=>
{
const
task
=
await
dataSource
const
task
=
await
dataSource
...
@@ -175,7 +165,6 @@ export const taskFinderByDateTimeTaskId = async (dateTimeTaskId:string):Promise<
...
@@ -175,7 +165,6 @@ export const taskFinderByDateTimeTaskId = async (dateTimeTaskId:string):Promise<
/**member finder by userId and projectId, return one task */
/**member finder by userId and projectId, return one task */
export
const
memberFinderById
=
async
(
userId
:
string
,
projectId
:
string
):
Promise
<
Member
|
null
>=>
{
export
const
memberFinderById
=
async
(
userId
:
string
,
projectId
:
string
):
Promise
<
Member
|
null
>=>
{
const
member
=
await
dataSource
const
member
=
await
dataSource
.
getRepository
(
Member
)
.
getRepository
(
Member
)
...
...
planner-api/src/routers/tasks.ts
View file @
b51730d1
...
@@ -305,7 +305,7 @@ router.delete('/:taskId',async (req: Request, res: Response):Promise<Response>=>
...
@@ -305,7 +305,7 @@ router.delete('/:taskId',async (req: Request, res: Response):Promise<Response>=>
/**change of task by task id */
/**change of task by task id */
router
.
put
(
'/:taskId'
,
authAuthorOrExecutorOfTask
,
async
(
req
:
Request
,
res
:
Response
)
=>
{
router
.
put
(
'/:taskId'
,
auth
,
auth
AuthorOrExecutorOfTask
,
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
;
...
...
planner-front/src/components/MyTasksCompoments/TableRowTask/TableRowTask.js
View file @
b51730d1
...
@@ -34,7 +34,6 @@ const TableRowTask= ({
...
@@ -34,7 +34,6 @@ const TableRowTask= ({
onChange
,
onChange
,
onModalOpen
,
onModalOpen
,
onProjectChange
,
onProjectChange
,
onExecutorChange
,
uniqueProjects
,
uniqueProjects
,
onAuthorChange
,
onAuthorChange
,
onDateChange
,
onDateChange
,
...
@@ -59,6 +58,9 @@ const TableRowTask= ({
...
@@ -59,6 +58,9 @@ const TableRowTask= ({
const
date
=
moment
.
utc
(
dateIso
);
const
date
=
moment
.
utc
(
dateIso
);
return
weekDays
[
date
.
day
()];
return
weekDays
[
date
.
day
()];
}
}
const
calendarOpen
=
(
taskId
)
=>
{
console
.
log
(
'task Id in Calendar Open'
,
taskId
)
}
return
(
return
(
<>
<>
...
@@ -164,16 +166,16 @@ const TableRowTask= ({
...
@@ -164,16 +166,16 @@ const TableRowTask= ({
name="dateTimeStart"
name="dateTimeStart"
onChange={onDateChange}
onChange={onDateChange}
user={user}
user={user}
/> */
}
/> */
}
<
TableCell
>
{
/* <TableCell> */
}
<
Tooltip
title
=
"Перейти в календарь"
>
<
Tooltip
title
=
"Перейти в календарь"
>
<
IconButton
<
IconButton
onClick
=
{(
id
)
=>
{
deleteHandle
(
task
.
id
);
}}
onClick
=
{()
=>
{
calendarOpen
(
task
.
id
)
}}
>
>
<
CalendarMonthIcon
/>
<
CalendarMonthIcon
/>
<
/IconButton
>
<
/IconButton
>
<
/Tooltip
>
<
/Tooltip
>
<
/TableCell
>
{
/* </TableCell> */
}
<
/TableCell
>
<
/TableCell
>
)
:
(
)
:
(
...
@@ -209,15 +211,6 @@ const TableRowTask= ({
...
@@ -209,15 +211,6 @@ const TableRowTask= ({
)}
)}
{
/* <TableCell>
<MaterialUIPickers
task={task}
name="dateTimeStart"
onChange={onDateChange}
user={user}
/>
</TableCell> */
}
{
task
.
isEditMode
&&
task
.
author
.
id
===
user
.
id
?
(
{
task
.
isEditMode
&&
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
>
<
TableCell
>
<
MaterialUIPickers
<
MaterialUIPickers
...
@@ -342,32 +335,7 @@ const TableRowTask= ({
...
@@ -342,32 +335,7 @@ const TableRowTask= ({
{
timeTransform
(
dateTimeTask
.
dateTimeDue
)}
{
timeTransform
(
dateTimeTask
.
dateTimeDue
)}
<
/TableCell
>
<
/TableCell
>
{
/* Edit option datetimeTask */
}
<
TableCell
// style={{width:'0%'}}
>
{
/* <Tooltip title="Редактировать Копию">
{task.isEditMode ? (
<IconButton
aria-label="done"
onClick={() => {
onToggleEditModeDone(dateTimeTask.id);
handleEditDateTimeTask(dateTimeTask);
}}
>
<Done />
</IconButton>
) : (
<IconButton
aria-label="edit"
onClick={() => onToggleEditMode(dateTimeTask.id)}
>
<Edit />
</IconButton>
)}
</Tooltip> */
}
<
/TableCell
>
{
/* delete option datetimeTask */
}
{
/* delete option datetimeTask */
}
{
task
.
author
.
id
===
user
.
id
?
{
task
.
author
.
id
===
user
.
id
?
(
<
TableCell
style
=
{{
width
:
'0%'
}}
>
(
<
TableCell
style
=
{{
width
:
'0%'
}}
>
...
...
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