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
92b0fd61
Commit
92b0fd61
authored
Jan 18, 2023
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#161
let to const rename, remove unused imports.
parent
3faff256
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
Task.ts
planner-api/src/models/Task.ts
+0
-3
tasks.ts
planner-api/src/routers/tasks.ts
+5
-6
No files found.
planner-api/src/models/Task.ts
View file @
92b0fd61
...
@@ -5,10 +5,7 @@ import {
...
@@ -5,10 +5,7 @@ import {
CreateDateColumn
,
CreateDateColumn
,
BaseEntity
,
BaseEntity
,
ManyToOne
,
ManyToOne
,
OneToOne
,
JoinTable
,
OneToMany
,
OneToMany
,
JoinColumn
}
from
'typeorm'
;
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
import
{
User
}
from
'./User'
;
import
{
Project
}
from
'./Project'
;
import
{
Project
}
from
'./Project'
;
...
...
planner-api/src/routers/tasks.ts
View file @
92b0fd61
...
@@ -35,7 +35,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
...
@@ -35,7 +35,7 @@ router.post('/', auth, async(req:Request, res:Response):Promise<Response>=>{
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
,
calendar
}
=
req
.
body
;
const
{
user
,
title
,
description
,
project
,
executor
,
dateTimeStart
,
dateTimeDue
,
dateTimeDeadLine
,
priority
,
calendar
}
=
req
.
body
;
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeDueFinal
=
dateTimeDue
let
dateTimeStartFinal
=
dateTimeStart
let
dateTimeStartFinal
=
dateTimeStart
le
t
dateTimeDeadlineFinal
=
dateTimeDeadLine
cons
t
dateTimeDeadlineFinal
=
dateTimeDeadLine
if
(
!
dateTimeDue
&&
dateTimeDeadLine
)
{
if
(
!
dateTimeDue
&&
dateTimeDeadLine
)
{
dateTimeDueFinal
=
dateTimeDeadLine
dateTimeDueFinal
=
dateTimeDeadLine
dateTimeStartFinal
=
subtractHours
(
dateTimeDueFinal
,
1
)
dateTimeStartFinal
=
subtractHours
(
dateTimeDueFinal
,
1
)
...
@@ -122,7 +122,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
...
@@ -122,7 +122,6 @@ router.post('/users', auth, async(req:Request, res:Response):Promise<Response>=>
const
newTask
=
new
Task
();
const
newTask
=
new
Task
();
newTask
.
title
=
title
;
newTask
.
title
=
title
;
newTask
.
description
=
description
;
newTask
.
description
=
description
;
const
currentTime
=
new
Date
();
if
(
project
)
{
if
(
project
)
{
const
watcherOfProject
=
await
dataSource
const
watcherOfProject
=
await
dataSource
.
getRepository
(
Project
)
.
getRepository
(
Project
)
...
@@ -288,9 +287,9 @@ router.get('/related', auth,async (req: Request, res: Response):Promise<Response
...
@@ -288,9 +287,9 @@ router.get('/related', auth,async (req: Request, res: Response):Promise<Response
.
where
(
"member.userId = :userId"
,
{
userId
:
user
.
id
})
.
where
(
"member.userId = :userId"
,
{
userId
:
user
.
id
})
.
getMany
()
.
getMany
()
let
projectIds
:
any
[]
=
[]
let
projectIds
:
string
[]
=
[]
if
(
tasks
.
length
>
0
){
if
(
tasks
.
length
>
0
){
for
(
le
t
task
of
tasks
){
for
(
cons
t
task
of
tasks
){
const
projectId
=
task
?.
project
?.
id
const
projectId
=
task
?.
project
?.
id
projectIds
.
push
(
projectId
)
projectIds
.
push
(
projectId
)
}
}
...
@@ -389,7 +388,7 @@ router.put('/:taskId',auth,authAuthorOrExecutorOfTask,async(req:Request, res:Res
...
@@ -389,7 +388,7 @@ router.put('/:taskId',auth,authAuthorOrExecutorOfTask,async(req:Request, res:Res
/** search all tasks on given projects: project Id array[] */
/** search all tasks on given projects: project Id array[] */
router
.
post
(
'/project'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
post
(
'/project'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
le
t
projectArray
:
string
[]
=
req
.
body
;
cons
t
projectArray
:
string
[]
=
req
.
body
;
try
{
try
{
if
(
projectArray
.
length
===
0
)
{
if
(
projectArray
.
length
===
0
)
{
const
rawTasks
=
await
const
rawTasks
=
await
...
@@ -455,7 +454,7 @@ router.get('/users-tasks', auth,async (req: Request, res: Response):Promise<Resp
...
@@ -455,7 +454,7 @@ router.get('/users-tasks', auth,async (req: Request, res: Response):Promise<Resp
if
(
!
projectsWithTasks
)
return
res
.
status
(
404
).
send
({
Message
:
'projects not found'
})
if
(
!
projectsWithTasks
)
return
res
.
status
(
404
).
send
({
Message
:
'projects not found'
})
let
tasks
:
Task
[]
=
[]
let
tasks
:
Task
[]
=
[]
if
(
projectsWithTasks
.
length
>
0
)
{
if
(
projectsWithTasks
.
length
>
0
)
{
for
(
le
t
project
of
projectsWithTasks
){
for
(
cons
t
project
of
projectsWithTasks
){
if
(
project
?.
tasks
)
{
if
(
project
?.
tasks
)
{
tasks
=
tasks
.
concat
(
project
.
tasks
)
tasks
=
tasks
.
concat
(
project
.
tasks
)
}
}
...
...
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