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
60034603
Commit
60034603
authored
Dec 11, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#95
added check on create new copytask
parent
4a12c42e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
helpers.ts
planner-api/src/helpers.ts
+1
-0
copyTasks.ts
planner-api/src/routers/copyTasks.ts
+8
-7
No files found.
planner-api/src/helpers.ts
View file @
60034603
...
...
@@ -92,6 +92,7 @@ export const authAuthorOrExecutorOfDateTimeTask = async(req: Request,res: Respon
.
leftJoinAndSelect
(
"task.author"
,
"users"
)
.
where
(
"dateTimeTask.id = :dateTimeTaskId"
,
{
dateTimeTaskId
})
.
getOne
()
if
(
!
task
)
return
res
.
status
(
404
).
send
({
message
:
'task with possible user involved is not found'
})
if
(
task
?.
executor
?.
token
===
token
)
{
...
...
planner-api/src/routers/copyTasks.ts
View file @
60034603
...
...
@@ -28,14 +28,15 @@ const taskFinderById = async (taskId:string):Promise<null | Task>=>{
}
/** make copy of task in calendar view */
router
.
post
(
"/make-copy"
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
taskId
,
dateTimeDue
,
dateTimeStart
}
=
req
.
body
router
.
post
(
"/make-copy"
,
authAuthorOrExecutorOfTask
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
{
taskId
,
dateTimeDue
,
dateTimeStart
}
=
req
.
body
;
const
task
=
await
taskFinderById
(
taskId
);
if
(
!
task
)
return
res
.
status
(
401
).
send
({
message
:
'task with possible user involved is not found'
})
const
newDateTimeTask
=
new
DateTimeTask
();
newDateTimeTask
.
dateTimeStart
=
dateTimeStart
newDateTimeTask
.
dateTimeDue
=
dateTimeDue
newDateTimeTask
.
task
=
taskId
await
newDateTimeTask
.
save
()
const
task
=
taskFinderById
(
taskId
)
newDateTimeTask
.
dateTimeStart
=
dateTimeStart
;
newDateTimeTask
.
dateTimeDue
=
dateTimeDue
;
newDateTimeTask
.
task
=
taskId
;
await
newDateTimeTask
.
save
();
return
res
.
send
({
task
})
}
)
...
...
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