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
6affab55
Commit
6affab55
authored
Nov 14, 2022
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#36
make minor changes cascade porperty in related models
parent
0869aff6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
+8
-10
Project.ts
planner-api/src/models/Project.ts
+1
-1
Task.ts
planner-api/src/models/Task.ts
+2
-5
tasks.ts
planner-api/src/routers/tasks.ts
+5
-4
No files found.
planner-api/src/models/Project.ts
View file @
6affab55
...
...
@@ -68,7 +68,7 @@ import {
@
OneToMany
(()
=>
Task
,
(
task
:
{
project
:
Project
;
})
=>
task
.
project
,{
eager
:
true
})
tasks
!
:
Task
[]
|
null
;
@
ManyToMany
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
,{
eager
:
true
})
@
ManyToMany
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
,{
eager
:
true
,
cascade
:
true
,
onUpdate
:
'CASCADE'
,
onDelete
:
'CASCADE'
})
@
JoinTable
()
workers
!
:
User
[];
}
\ No newline at end of file
planner-api/src/models/Task.ts
View file @
6affab55
...
...
@@ -25,7 +25,7 @@ import {
priority
:
priorityType
|
null
;
author
:
User
;
project
:
Project
|
null
;
executors
:
User
[]
executors
:
User
[]
;
}
@
Entity
({
name
:
'Task'
})
...
...
@@ -64,13 +64,10 @@ import {
@
ManyToOne
(()
=>
User
,
(
user
:
{
tasks
:
Task
[];
})
=>
user
.
tasks
,{
eager
:
true
})
author
!
:
User
;
@
ManyToMany
(()
=>
User
,{
eager
:
true
})
@
ManyToMany
(()
=>
User
,{
eager
:
true
,
cascade
:
true
,
onUpdate
:
'CASCADE'
,
onDelete
:
'CASCADE'
})
@
JoinTable
()
executors
!
:
User
[];
@
ManyToOne
(()
=>
Project
,(
project
:{
tasks
:
Task
[]})
=>
project
.
tasks
)
project
!
:
Project
|
null
;
}
planner-api/src/routers/tasks.ts
View file @
6affab55
...
...
@@ -97,7 +97,7 @@ router.put('/',async(req:Request, res:Response)=> {
.
getOne
()
if
(
!
user
)
return
res
.
status
(
404
).
send
({
Message
:
'user not found'
})
const
{
id
,
title
,
description
,
project
,
dateTimeDue
,
dateTimeStart
,
accomplish
,
priority
}
=
req
.
body
;
const
{
id
,
title
,
description
,
project
,
dateTimeDue
,
dateTimeStart
,
accomplish
,
priority
,
executors
}
=
req
.
body
;
await
dataSource
.
createQueryBuilder
()
.
update
(
Task
)
...
...
@@ -105,11 +105,12 @@ router.put('/',async(req:Request, res:Response)=> {
title
:
title
,
description
:
description
,
project
:
project
,
dateTimeDue
:
dateTimeDue
,
dateTimeStart
:
dateTimeStart
,
author
:
user
,
dateTimeDue
:
dateTimeDue
,
accomplish
:
accomplish
,
priority
:
priority
priority
:
priority
,
author
:
user
,
executors
:
executors
})
.
where
(
"id = :id"
,
{
id
:
id
})
.
execute
()
...
...
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