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
99d6d937
Commit
99d6d937
authored
Nov 22, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'task-58-enhance/model_Member' into 'development'
Task 58 enhance/model member See merge request
!38
parents
cf98dee7
50f4e782
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
211 additions
and
84 deletions
+211
-84
app-data-source.ts
planner-api/src/app-data-source.ts
+2
-1
fixtures.ts
planner-api/src/fixtures.ts
+21
-6
Member.ts
planner-api/src/models/Member.ts
+50
-0
Project.ts
planner-api/src/models/Project.ts
+26
-17
Task.ts
planner-api/src/models/Task.ts
+12
-6
User.ts
planner-api/src/models/User.ts
+11
-8
projects.ts
planner-api/src/routers/projects.ts
+44
-11
tasks.ts
planner-api/src/routers/tasks.ts
+45
-35
No files found.
planner-api/src/app-data-source.ts
View file @
99d6d937
...
...
@@ -2,6 +2,7 @@ import { DataSource } from "typeorm";
import
{
User
}
from
'./models/User'
;
import
{
Task
}
from
'./models/Task'
;
import
{
Project
}
from
"./models/Project"
;
import
{
Member
}
from
"./models/Member"
;
export
const
myDataSource
=
new
DataSource
({
type
:
"postgres"
,
...
...
@@ -10,7 +11,7 @@ export const myDataSource = new DataSource({
username
:
"pluser"
,
password
:
"pluser"
,
database
:
"planner"
,
entities
:
[
User
,
Task
,
Project
],
entities
:
[
User
,
Task
,
Project
,
Member
],
logging
:
true
,
synchronize
:
true
,
// in build switch to false
migrationsRun
:
false
...
...
planner-api/src/fixtures.ts
View file @
99d6d937
...
...
@@ -4,6 +4,7 @@ import { User, UserRole } from "./models/User";
import
{
faker
}
from
'@faker-js/faker'
;
import
{
Task
}
from
"./models/Task"
;
import
{
Project
}
from
"./models/Project"
;
import
{
Member
,
MemberRole
}
from
"./models/Member"
;
function
randomIntFromInterval
(
min
:
number
,
max
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
)
...
...
@@ -13,6 +14,8 @@ const loadFixtures = async () => {
myDataSource
.
initialize
()
.
then
(
async
()
=>
{
const
repositoryMember
=
myDataSource
.
getRepository
(
Member
);
await
repositoryMember
.
delete
({})
const
repositoryTask
=
myDataSource
.
getRepository
(
Task
);
await
repositoryTask
.
delete
({});
const
repositoryProject
=
myDataSource
.
getRepository
(
Project
);
...
...
@@ -50,9 +53,11 @@ const loadFixtures = async () => {
const
newTask
=
new
Task
();
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
executor
s
=
faker
.
helpers
.
arrayElements
(
users
,
randomIntFromInterval
(
0
,
3
)
);
newTask
.
executor
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
dateTimeDue
=
faker
.
date
.
soon
(
randomIntFromInterval
(
1
,
15
));
newTask
.
dateTimeStart
=
faker
.
date
.
recent
((
randomIntFromInterval
(
0
,
8
)));
newTask
.
dateTimeDeadLine
=
faker
.
date
.
soon
(
randomIntFromInterval
(
1
,
15
));
newTask
.
dateTimeFactDeadLine
=
faker
.
date
.
soon
(
randomIntFromInterval
(
1
,
15
));
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
accomplish
=
faker
.
helpers
.
arrayElement
(
accomplish
);
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
...
...
@@ -62,9 +67,9 @@ const loadFixtures = async () => {
const
newTask
=
new
Task
();
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
executor
s
=
faker
.
helpers
.
arrayElements
(
users
,
randomIntFromInterval
(
0
,
3
)
);
newTask
.
dateTimeDue
=
null
;
newTask
.
dateTimeStart
=
null
;
newTask
.
executor
=
faker
.
helpers
.
arrayElement
(
users
);
//
newTask.dateTimeDue = null;
//
newTask.dateTimeStart = null;
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
accomplish
=
accomplish
[
0
];
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
...
...
@@ -73,14 +78,24 @@ const loadFixtures = async () => {
}
}
const
members
:
Member
[]
=
[]
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
const
newMember
=
new
Member
();
newMember
.
user
=
faker
.
helpers
.
arrayElement
(
users
);
newMember
.
roleProject
=
faker
.
helpers
.
objectValue
(
MemberRole
);
await
newMember
.
save
();
members
.
push
(
newMember
)
}
const
projects
:
Project
[]
=
[]
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
const
newProject
=
new
Project
();
newProject
.
title
=
`Project
${
faker
.
random
.
words
(
1
)}
`
;
newProject
.
color
=
faker
.
random
.
words
(
1
);
newProject
.
admin
=
faker
.
helpers
.
arrayElement
(
users
);
newProject
.
members
=
faker
.
helpers
.
arrayElements
(
members
,
randomIntFromInterval
(
1
,
3
))
// newProject.admin = faker.helpers.arrayElement(users);
newProject
.
tasks
=
faker
.
helpers
.
arrayElements
(
tasks
,
randomIntFromInterval
(
1
,
3
));
newProject
.
workers
=
faker
.
helpers
.
arrayElements
(
users
,
randomIntFromInterval
(
1
,
3
));
//
newProject.workers = faker.helpers.arrayElements(users, randomIntFromInterval(1, 3));
await
newProject
.
save
();
projects
.
push
(
newProject
)
}
...
...
planner-api/src/models/Member.ts
0 → 100644
View file @
99d6d937
import
{
Column
,
Entity
,
PrimaryGeneratedColumn
,
CreateDateColumn
,
BaseEntity
,
ManyToOne
,
ManyToMany
,
OneToMany
,
JoinTable
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
import
{
Project
}
from
'./Project'
;
import
{
Task
}
from
'./Task'
;
export
enum
MemberRole
{
USER
=
"user"
,
WATCHER
=
"watcher"
,
ADMIN
=
"admin"
}
interface
IMember
{
id
:
string
;
user
:
User
;
project
:
Project
;
createdAt
:
Date
;
roleProject
:
MemberRole
;
}
@
Entity
({
name
:
"Member"
})
export
class
Member
extends
BaseEntity
implements
IMember
{
@
PrimaryGeneratedColumn
(
"uuid"
)
id
!
:
string
;
@
CreateDateColumn
({
name
:
'createdAt'
,
type
:
Date
,
default
:
new
Date
()
})
createdAt
!
:
Date
;
@
ManyToOne
(()
=>
User
,
(
user
:
{
members
:
Member
[];
})
=>
user
.
members
,{
cascade
:
true
,
onUpdate
:
'CASCADE'
,
eager
:
true
})
user
!
:
User
;
@
ManyToOne
(()
=>
Project
,
(
project
:
{
members
:
Member
[];
})
=>
project
.
members
,{
cascade
:
true
,
onUpdate
:
'CASCADE'
,
nullable
:
true
})
project
!
:
Project
;
@
Column
({
type
:
"enum"
,
enum
:
MemberRole
,
default
:
MemberRole
.
USER
})
roleProject
!
:
MemberRole
}
\ No newline at end of file
planner-api/src/models/Project.ts
View file @
99d6d937
...
...
@@ -9,8 +9,9 @@ import {
OneToMany
,
JoinTable
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
//
import {User} from './User';
import
{
Task
}
from
'./Task'
;
import
{
Member
}
from
'./Member'
;
...
...
@@ -18,12 +19,14 @@ import {
id
:
string
;
title
:
string
;
color
:
string
;
admin
:
User
;
workers
:
User
[];
//
admin:User;
//
workers:User[];
tasks
:
Task
[]
|
null
;
createdAt
:
Date
;
dateDue
:
Date
|
null
;
department
:
boolean
;
active
:
boolean
;
// dateDue: Date| null;
// department:boolean;
members
:
Member
[];
}
@
Entity
({
name
:
'Project'
})
...
...
@@ -39,21 +42,27 @@ import {
createdAt
!
:
Date
;
@
Column
({
name
:
'color'
,
type
:
'varchar'
,
length
:
100
,
nullable
:
true
})
color
!
:
string
color
!
:
string
;
@
Column
({
name
:
'
dateDue'
,
type
:
Date
,
default
:
null
})
dateDue
!
:
Date
|
null
;
@
Column
({
name
:
'
active'
,
type
:
'boolean'
,
default
:
true
})
active
!
:
boolean
;
@
Column
({
name
:
'department'
,
type
:
Boolean
,
nullable
:
true
,
default
:
false
})
department
!
:
boolean
;
// @Column({ name: 'dateDue', type: Date, default: null
})
// dateDue!: Date| null
;
@
ManyToOne
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
,{
eager
:
tru
e
})
admin
!
:
User
;
// @Column({ name: 'department', type: Boolean,nullable:true ,default: fals
e})
// department!: boolean
;
@
OneToMany
(()
=>
Task
,
(
task
:
{
project
:
Project
;
})
=>
task
.
project
)
tasks
!
:
Task
[]
|
null
;
// @ManyToOne(() => User, (user: { projects: Project[]; }) => user.projects,{eager : true}
)
// admin!: User
;
@
ManyToMany
(()
=>
User
,
(
user
:
{
projects
:
Project
[];
})
=>
user
.
projects
,{
eager
:
true
,
cascade
:
true
,
onUpdate
:
'CASCADE'
,
onDelete
:
'CASCADE'
})
@
JoinTable
()
workers
!
:
User
[];
@
OneToMany
(()
=>
Task
,
(
task
:
{
project
:
Project
;
})
=>
task
.
project
,{
nullable
:
true
})
tasks
!
:
Task
[];
@
OneToMany
(()
=>
Member
,
(
member
:
{
project
:
Project
;
})
=>
member
.
project
)
members
!
:
Member
[];
// @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 @
99d6d937
...
...
@@ -5,7 +5,7 @@ import {
CreateDateColumn
,
BaseEntity
,
ManyToOne
,
ManyToMany
,
OneToOne
,
JoinTable
}
from
'typeorm'
;
import
{
User
}
from
'./User'
;
...
...
@@ -21,11 +21,13 @@ import {
createdAt
:
Date
;
dateTimeStart
:
Date
|
null
;
dateTimeDue
:
Date
|
null
;
dateTimeDeadLine
:
Date
|
null
;
dateTimeFactDeadLine
:
Date
|
null
;
accomplish
:
taskFinishType
;
priority
:
priorityType
|
null
;
author
:
User
;
project
:
Project
|
null
;
executor
s
:
User
[]
;
executor
:
User
;
}
@
Entity
({
name
:
'Task'
})
...
...
@@ -39,9 +41,13 @@ import {
@
CreateDateColumn
({
name
:
'created_at'
,
type
:
Date
,
default
:
new
Date
()
})
createdAt
!
:
Date
;
@
Column
({
name
:
'dateTimeStart'
,
type
:
Date
,
nullable
:
true
})
dateTimeStart
!
:
Date
|
null
;
dateTimeStart
!
:
Date
;
@
Column
({
name
:
'dateTimeDue'
,
type
:
Date
,
nullable
:
true
})
dateTimeDue
!
:
Date
|
null
;
dateTimeDue
!
:
Date
;
@
Column
({
name
:
'dateTimeDeadLine'
,
type
:
Date
,
nullable
:
true
})
dateTimeDeadLine
!
:
Date
;
@
Column
({
name
:
'dateTimeFactDeadLine'
,
type
:
Date
,
nullable
:
true
})
dateTimeFactDeadLine
!
:
Date
;
@
Column
({
type
:
"enum"
,
...
...
@@ -64,9 +70,9 @@ import {
@
ManyToOne
(()
=>
User
,
(
user
:
{
tasks
:
Task
[];
})
=>
user
.
tasks
,{
eager
:
true
})
author
!
:
User
;
@
ManyTo
Many
(()
=>
User
,{
eager
:
true
,
cascad
e
:
true
,
onUpdate
:
'CASCADE'
})
@
ManyTo
One
(()
=>
User
,
(
user
:
{
tasks
:
Task
[]})
=>
user
.
tasks
,{
eager
:
true
,
nullabl
e
:
true
,
onUpdate
:
'CASCADE'
})
@
JoinTable
()
executor
s
!
:
User
[]
;
executor
!
:
User
;
@
ManyToOne
(()
=>
Project
,(
project
:{
tasks
:
Task
[]})
=>
project
.
tasks
,{
eager
:
true
,
nullable
:
true
,
onUpdate
:
'CASCADE'
})
project
!
:
Project
;
...
...
planner-api/src/models/User.ts
View file @
99d6d937
...
...
@@ -8,6 +8,7 @@ import {
ManyToMany
,
OneToMany
,
JoinTable
,
OneToOne
,
}
from
'typeorm'
;
import
{
IsEmail
}
from
"class-validator"
;
...
...
@@ -16,6 +17,7 @@ import bcrypt from 'bcrypt';
import
{
nanoid
}
from
'nanoid'
;
import
{
Task
}
from
'./Task'
;
import
{
Project
}
from
'./Project'
;
import
{
Member
}
from
'./Member'
;
const
SALT_WORK_FACTOR
=
10
;
...
...
@@ -33,8 +35,9 @@ interface IUser {
token
:
string
;
createdAt
:
Date
;
createdTasks
:
Task
[];
workerInProjects
:
Project
[];
adminInProjects
:
Project
[];
// workerInProjects:Project[];
// adminInProjects:Project[];
membership
:
Member
[];
}
...
...
@@ -80,16 +83,16 @@ export class User extends BaseEntity implements IUser {
@
OneToMany
(()
=>
Task
,
(
task
:
{
user
:
User
})
=>
task
.
user
)
createdTasks
!
:
Task
[];
@
ManyToMany
(()
=>
Task
,
(
task
:
{
users
:
User
[]
})
=>
task
.
users
)
@
OneToMany
(()
=>
Task
,
(
task
:
{
user
:
User
})
=>
task
.
user
)
tasks
!
:
Task
[];
@
OneToMany
(()
=>
Project
,
(
project
:
{
user
:
User
})
=>
project
.
user
)
adminInProjects
!
:
Project
[];
@
OneToMany
(()
=>
Member
,
(
member
:
{
user
:
User
})
=>
member
.
user
)
membership
!
:
Member
[];
@
ManyToMany
(()
=>
Project
,(
project
:
{
user
:
User
})
=>
project
.
user
)
@
JoinTable
()
workerInProjects
!
:
Project
[];
//
@ManyToMany(() => Project,(project: { user: User }) => project.user)
//
@JoinTable()
//
workerInProjects!: Project[];
@
BeforeInsert
()
...
...
planner-api/src/routers/projects.ts
View file @
99d6d937
...
...
@@ -2,6 +2,10 @@ import express,{Router, Request, Response} from 'express';
import
{
Project
}
from
'../models/Project'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
User
}
from
'../models/User'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
import
{
userInfo
}
from
'os'
;
import
{
Task
}
from
'../models/Task'
;
import
{
getRepository
}
from
'typeorm'
;
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
...
...
@@ -12,27 +16,40 @@ router.get('/',async (req:Request, res:Response): Promise<Response>=> {
return
res
.
send
({
projects
})
})
router
.
get
(
'/my'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
token
=
req
.
get
(
'Authorization'
);
const
user
=
await
dataSource
.
createQueryBuilder
()
.
select
(
"user"
)
.
from
(
User
,
"user"
)
.
where
(
"user.token = :token"
,
{
token
:
token
})
.
getOne
();
if
(
!
user
)
return
res
.
status
(
404
).
send
({
Message
:
'user not found'
})
const
projects
:
Project
[]
=
await
dataSource
.
manager
.
find
(
Project
)
return
res
.
send
({
projects
})
})
router
.
post
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>
=>
{
if
(
!
req
.
body
)
return
res
.
status
(
400
).
send
({
Message
:
'problem in incoming req.body'
})
const
token
=
req
.
get
(
'Authorization'
);
console
.
log
(
"token:"
+
token
)
const
{
title
,
dateDue
,
color
,
department
,
workers
,
tasks
}
=
req
.
body
;
const
{
title
,
color
}
=
req
.
body
;
const
user
=
await
dataSource
.
createQueryBuilder
()
.
select
(
"user"
)
.
from
(
User
,
"user"
)
.
where
(
"user.token = :token"
,
{
token
:
token
})
.
getOne
()
.
getOne
()
;
if
(
!
user
)
return
res
.
status
(
404
).
send
({
Message
:
'user not found'
})
const
member
:
Member
=
new
Member
;
member
.
user
=
user
;
member
.
roleProject
=
MemberRole
.
ADMIN
;
await
member
.
save
();
const
project
:
Project
=
new
Project
()
project
.
title
=
title
;
project
.
color
=
color
;
project
.
dateDue
=
dateDue
||
null
;
project
.
department
=
department
;
project
.
workers
=
workers
||
null
;
project
.
tasks
=
tasks
||
null
;
project
.
admin
=
user
;
project
.
members
=
[
member
]
await
project
.
save
()
return
res
.
send
({
project
})
})
...
...
@@ -42,14 +59,30 @@ router.get("/:id",async (req:Request, res:Response): Promise<Response> => {
.
createQueryBuilder
()
.
select
(
"project"
)
.
from
(
Project
,
"project"
)
.
leftJoinAndSelect
(
'project.admin'
,
'user'
)
.
leftJoinAndSelect
(
'project.members'
,
'member'
)
.
leftJoinAndSelect
(
'member.user'
,
'user'
)
.
where
(
"project.id = :id"
,
{
id
:
req
.
params
.
id
})
.
getOne
()
if
(
!
project
)
return
res
.
status
(
404
).
send
({
Message
:
'no info on this project'
})
return
res
.
send
({
project
})
const
tasks
=
await
dataSource
.
getRepository
(
'Task'
)
.
find
(
{
relations
:{
executor
:
true
,
author
:
true
,
},
where
:{
project
:{
id
:
req
.
params
.
id
}
}
}
)
return
res
.
send
({
project
,
tasks
})
})
router
.
get
(
'/userId/:userId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
get
(
'/user/:userId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
userId
:
string
=
req
.
params
.
userId
const
userProjects
=
await
dataSource
.
createQueryBuilder
()
...
...
planner-api/src/routers/tasks.ts
View file @
99d6d937
...
...
@@ -2,7 +2,6 @@ import express,{Router, Request, Response} from 'express';
import
{
Task
}
from
'../models/Task'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
User
}
from
'../models/User'
;
import
{
Project
}
from
'../models/Project'
;
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
...
...
@@ -10,14 +9,18 @@ const dataSource = myDataSource;
router
.
get
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>
=>
{
const
tasks
=
await
dataSource
.
getRepository
(
Task
)
.
find
()
.
find
({
relations
:{
executor
:
true
,
author
:
true
,
}})
return
res
.
send
({
tasks
})
})
router
.
post
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
token
=
req
.
get
(
'Authorization'
);
const
newTask
=
new
Task
();
const
{
title
,
description
,
project
,
executors
,
dateTimeDue
,
dateTimeStart
,
accomplish
,
priority
}
=
req
.
body
;
const
{
title
,
description
,
project
,
dateTimeDue
,
dateTimeStart
,
accomplish
,
priority
}
=
req
.
body
;
const
user
=
await
dataSource
.
createQueryBuilder
()
.
select
(
"user"
)
...
...
@@ -28,7 +31,6 @@ router.post('/', async(req:Request, res:Response):Promise<Response>=>{
newTask
.
title
=
title
;
newTask
.
description
=
description
;
newTask
.
project
=
project
;
newTask
.
executors
=
executors
;
newTask
.
dateTimeDue
=
dateTimeDue
;
newTask
.
dateTimeStart
=
dateTimeStart
;
newTask
.
author
=
user
;
...
...
@@ -38,14 +40,28 @@ router.post('/', async(req:Request, res:Response):Promise<Response>=>{
return
res
.
send
({
newTask
})
})
router
.
get
(
'/:userId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
router
.
get
(
'/
user/
:userId'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
Response
>=>
{
const
userId
=
req
.
params
.
userId
;
const
tasks
=
await
dataSource
.
getRepository
(
Task
)
.
createQueryBuilder
(
'task'
)
.
innerJoinAndSelect
(
'task.executors'
,
'user'
)
.
where
(
'user.id = :userId'
,
{
userId
:
userId
})
.
getMany
()
.
find
({
relations
:{
executor
:
true
,
author
:
true
,
},
where
:[
{
executor
:{
id
:
userId
}
},
{
author
:{
id
:
userId
}
},
]
})
return
res
.
send
({
tasks
})
})
...
...
@@ -60,10 +76,24 @@ router.get('/my', async (req: Request, res: Response):Promise<Response>=>{
if
(
!
user
)
return
res
.
status
(
404
).
send
({
Message
:
'user not found'
})
const
tasks
=
await
dataSource
.
getRepository
(
Task
)
.
createQueryBuilder
(
'task'
)
.
innerJoinAndSelect
(
'task.executors'
,
'user'
)
.
where
(
'user.id = :userId'
,
{
userId
:
user
.
id
})
.
getMany
()
.
find
({
relations
:{
executor
:
true
,
author
:
true
,
},
where
:[
{
executor
:{
id
:
user
.
id
}
},
{
author
:{
id
:
user
.
id
}
},
]
})
return
res
.
send
({
tasks
})
})
...
...
@@ -104,7 +134,7 @@ router.put('/',async(req:Request, res:Response)=> {
task
.
dateTimeDue
=
dateTimeDue
task
.
dateTimeStart
=
dateTimeStart
task
.
author
=
user
task
.
executors
=
executors
//
task.executors=executors
task
.
accomplish
=
accomplish
task
.
priority
=
priority
await
task
.
save
()
...
...
@@ -121,7 +151,7 @@ router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
.
getRepository
(
Task
)
.
find
({
relations
:{
executors
:
true
,
//
executors:true,
author
:
true
,
project
:
true
}
...
...
@@ -141,24 +171,4 @@ router.post('/project',async (req: Request, res: Response):Promise<Response>=>{
// router.post('/projects',async (req: Request, res: Response):Promise<Response>=>{
// let projectArray :string[]= req.body;
// console.log('projectArray ', projectArray)
// if (projectArray.length===0) {
// const tasks = await
// dataSource
// .getRepository(Task)
// .createQueryBuilder('task')
// // .innerJoinAndSelect('task.executors', 'user')
// .innerJoinAndSelect('task.executors AND task.author', 'user')
// .where('task.project IS NULL')
// .getMany()
// return res.send({tasks})
// }
// ///ssome code
// return res.send({message:"some other staff"})
// })
export
default
router
;
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