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
945f33fa
Commit
945f33fa
authored
Nov 04, 2022
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#23
added onoToMany relation to Project for Task
parent
6d19d5d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
Project.ts
planner-api/src/models/Project.ts
+8
-3
projects.ts
planner-api/src/routers/projects.ts
+7
-0
No files found.
planner-api/src/models/Project.ts
View file @
945f33fa
...
...
@@ -5,9 +5,11 @@ import {
CreateDateColumn
,
BaseEntity
,
ManyToOne
,
ManyToMany
ManyToMany
,
OneToMany
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
import
{
Task
}
from
'./Task'
;
interface
IProject
{
...
...
@@ -15,7 +17,8 @@ import {
title
:
string
;
color
:
string
;
admin
:
User
;
workers
:
User
[]
|
undefined
;
workers
:
User
[];
tasks
:
Task
[]
|
null
;
createdAt
:
Date
;
dateDue
:
Date
|
null
;
department
:
boolean
|
false
;
...
...
@@ -43,7 +46,9 @@ import {
@
ManyToOne
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
)
admin
!
:
User
;
@
ManyToMany
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
)
@
ManyToMany
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
)
workers
!
:
User
[];
@
OneToMany
(()
=>
Task
,
(
task
:
{
project
:
Project
;
})
=>
task
.
project
)
tasks
!
:
Task
[]
|
null
;
}
planner-api/src/routers/projects.ts
0 → 100644
View file @
945f33fa
import
express
,{
Router
,
Request
,
Response
}
from
'express'
;
import
{
User
}
from
'../models/User'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
nanoid
}
from
'nanoid'
;
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
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