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
76277e72
Commit
76277e72
authored
Nov 26, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#68
added model DateTimeTask
parent
fb898090
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
15 deletions
+52
-15
DateTimeTask.ts
planner-api/src/models/DateTimeTask.ts
+41
-0
Member.ts
planner-api/src/models/Member.ts
+1
-3
Task.ts
planner-api/src/models/Task.ts
+7
-1
User.ts
planner-api/src/models/User.ts
+2
-2
members.ts
planner-api/src/routers/members.ts
+0
-8
projects.ts
planner-api/src/routers/projects.ts
+1
-1
No files found.
planner-api/src/models/DateTimeTask.ts
0 → 100644
View file @
76277e72
import
{
Column
,
Entity
,
PrimaryGeneratedColumn
,
CreateDateColumn
,
BaseEntity
,
ManyToOne
,
}
from
'typeorm'
;
import
{
Task
}
from
'./Task'
;
interface
IDateTimeTask
{
id
:
string
;
createdAt
:
Date
;
dateTimeStart
:
Date
;
dateTimeDue
:
Date
;
task
:
Task
;
}
@
Entity
({
name
:
"DateTimeTask"
})
export
class
DateTimeTask
extends
BaseEntity
implements
IDateTimeTask
{
@
PrimaryGeneratedColumn
(
"uuid"
)
id
!
:
string
;
@
CreateDateColumn
({
name
:
'createdAt'
,
type
:
Date
,
default
:
new
Date
()
})
createdAt
!
:
Date
;
@
CreateDateColumn
({
name
:
'createdAt'
,
type
:
Date
,
nullable
:
false
})
dateTimeStart
!
:
Date
;
@
CreateDateColumn
({
name
:
'createdAt'
,
type
:
Date
,
nullable
:
false
})
dateTimeDue
!
:
Date
;
@
ManyToOne
(()
=>
Task
,
(
task
:
{
dateTimeTasks
:
DateTimeTask
[];
})
=>
task
.
dateTimeTasks
,{
cascade
:
true
,
onUpdate
:
'CASCADE'
,
nullable
:
true
})
task
!
:
Task
;
}
\ No newline at end of file
planner-api/src/models/Member.ts
View file @
76277e72
...
@@ -5,9 +5,7 @@ import {
...
@@ -5,9 +5,7 @@ import {
CreateDateColumn
,
CreateDateColumn
,
BaseEntity
,
BaseEntity
,
ManyToOne
,
ManyToOne
,
ManyToMany
,
OneToMany
,
JoinTable
}
from
'typeorm'
;
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
import
{
User
}
from
'./User'
;
import
{
Project
}
from
'./Project'
;
import
{
Project
}
from
'./Project'
;
...
...
planner-api/src/models/Task.ts
View file @
76277e72
...
@@ -6,10 +6,12 @@ import {
...
@@ -6,10 +6,12 @@ import {
BaseEntity
,
BaseEntity
,
ManyToOne
,
ManyToOne
,
OneToOne
,
OneToOne
,
JoinTable
JoinTable
,
OneToMany
}
from
'typeorm'
;
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
import
{
User
}
from
'./User'
;
import
{
Project
}
from
'./Project'
;
import
{
Project
}
from
'./Project'
;
import
{
DateTimeTask
}
from
'./DateTimeTask'
;
type
taskFinishType
=
"opened"
|
"done"
|
"failed"
;
type
taskFinishType
=
"opened"
|
"done"
|
"failed"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
...
@@ -27,6 +29,7 @@ import {
...
@@ -27,6 +29,7 @@ import {
priority
:
priorityType
|
null
;
priority
:
priorityType
|
null
;
author
:
User
;
author
:
User
;
project
:
Project
|
null
;
project
:
Project
|
null
;
dateTimeTasks
:
DateTimeTask
[]
|
null
;
executor
:
User
;
executor
:
User
;
}
}
...
@@ -76,4 +79,7 @@ import {
...
@@ -76,4 +79,7 @@ import {
@
ManyToOne
(()
=>
Project
,(
project
:{
tasks
:
Task
[]})
=>
project
.
tasks
,{
eager
:
true
,
nullable
:
true
,
onUpdate
:
'CASCADE'
})
@
ManyToOne
(()
=>
Project
,(
project
:{
tasks
:
Task
[]})
=>
project
.
tasks
,{
eager
:
true
,
nullable
:
true
,
onUpdate
:
'CASCADE'
})
project
!
:
Project
;
project
!
:
Project
;
@
OneToMany
(()
=>
DateTimeTask
,
(
dateTimeTask
:
{
task
:
Task
})
=>
dateTimeTask
.
task
)
dateTimeTasks
!
:
DateTimeTask
[];
}
}
planner-api/src/models/User.ts
View file @
76277e72
...
@@ -37,7 +37,7 @@ interface IUser {
...
@@ -37,7 +37,7 @@ interface IUser {
createdTasks
:
Task
[];
createdTasks
:
Task
[];
// workerInProjects:Project[];
// workerInProjects:Project[];
// adminInProjects:Project[];
// adminInProjects:Project[];
members
hip
:
Member
[];
members
:
Member
[];
}
}
...
@@ -88,7 +88,7 @@ export class User extends BaseEntity implements IUser {
...
@@ -88,7 +88,7 @@ export class User extends BaseEntity implements IUser {
@
OneToMany
(()
=>
Member
,
(
member
:
{
user
:
User
})
=>
member
.
user
)
@
OneToMany
(()
=>
Member
,
(
member
:
{
user
:
User
})
=>
member
.
user
)
members
hip
!
:
Member
[];
members
!
:
Member
[];
// @ManyToMany(() => Project,(project: { user: User }) => project.user)
// @ManyToMany(() => Project,(project: { user: User }) => project.user)
// @JoinTable()
// @JoinTable()
...
...
planner-api/src/routers/members.ts
deleted
100644 → 0
View file @
fb898090
import
express
,{
Router
,
Request
,
Response
}
from
'express'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
Member
}
from
"../models/Member"
;
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
planner-api/src/routers/projects.ts
View file @
76277e72
...
@@ -166,7 +166,7 @@ router.post('/remove-user', async (req: Request, res: Response):Promise<Response
...
@@ -166,7 +166,7 @@ router.post('/remove-user', async (req: Request, res: Response):Promise<Response
.
createQueryBuilder
()
.
createQueryBuilder
()
.
select
(
"user"
)
.
select
(
"user"
)
.
from
(
User
,
"user"
)
.
from
(
User
,
"user"
)
.
leftJoinAndSelect
(
"user.members
hip
"
,
"member"
)
.
leftJoinAndSelect
(
"user.members"
,
"member"
)
.
leftJoinAndSelect
(
'member.project'
,
'project'
)
.
leftJoinAndSelect
(
'member.project'
,
'project'
)
.
where
(
"user.token = :token"
,
{
token
})
.
where
(
"user.token = :token"
,
{
token
})
.
andWhere
(
'project.id=:projectId'
,{
projectId
})
.
andWhere
(
'project.id=:projectId'
,{
projectId
})
...
...
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