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
d7200131
Commit
d7200131
authored
Nov 22, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#58
fixtures fixed to work
parent
4aa1ced5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
10 deletions
+29
-10
fixtures.ts
planner-api/src/fixtures.ts
+6
-2
Project.ts
planner-api/src/models/Project.ts
+8
-4
Task.ts
planner-api/src/models/Task.ts
+8
-2
projects.ts
planner-api/src/routers/projects.ts
+7
-2
No files found.
planner-api/src/fixtures.ts
View file @
d7200131
...
@@ -14,6 +14,8 @@ const loadFixtures = async () => {
...
@@ -14,6 +14,8 @@ const loadFixtures = async () => {
myDataSource
myDataSource
.
initialize
()
.
initialize
()
.
then
(
async
()
=>
{
.
then
(
async
()
=>
{
const
repositoryMember
=
myDataSource
.
getRepository
(
Member
);
await
repositoryMember
.
delete
({})
const
repositoryTask
=
myDataSource
.
getRepository
(
Task
);
const
repositoryTask
=
myDataSource
.
getRepository
(
Task
);
await
repositoryTask
.
delete
({});
await
repositoryTask
.
delete
({});
const
repositoryProject
=
myDataSource
.
getRepository
(
Project
);
const
repositoryProject
=
myDataSource
.
getRepository
(
Project
);
...
@@ -54,6 +56,8 @@ const loadFixtures = async () => {
...
@@ -54,6 +56,8 @@ const loadFixtures = async () => {
newTask
.
executor
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
executor
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
dateTimeDue
=
faker
.
date
.
soon
(
randomIntFromInterval
(
1
,
15
));
newTask
.
dateTimeDue
=
faker
.
date
.
soon
(
randomIntFromInterval
(
1
,
15
));
newTask
.
dateTimeStart
=
faker
.
date
.
recent
((
randomIntFromInterval
(
0
,
8
)));
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
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
accomplish
=
faker
.
helpers
.
arrayElement
(
accomplish
);
newTask
.
accomplish
=
faker
.
helpers
.
arrayElement
(
accomplish
);
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
...
@@ -64,8 +68,8 @@ const loadFixtures = async () => {
...
@@ -64,8 +68,8 @@ const loadFixtures = async () => {
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
executor
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
executor
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
dateTimeDue
=
null
;
//
newTask.dateTimeDue = null;
newTask
.
dateTimeStart
=
null
;
//
newTask.dateTimeStart = null;
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
newTask
.
accomplish
=
accomplish
[
0
];
newTask
.
accomplish
=
accomplish
[
0
];
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
newTask
.
priority
=
faker
.
helpers
.
arrayElement
(
priorities
);
...
...
planner-api/src/models/Project.ts
View file @
d7200131
...
@@ -23,7 +23,8 @@ import {
...
@@ -23,7 +23,8 @@ import {
// workers:User[];
// workers:User[];
tasks
:
Task
[]
|
null
;
tasks
:
Task
[]
|
null
;
createdAt
:
Date
;
createdAt
:
Date
;
dateDue
:
Date
|
null
;
active
:
boolean
;
// dateDue: Date| null;
// department:boolean;
// department:boolean;
members
:
Member
[];
members
:
Member
[];
}
}
...
@@ -41,10 +42,13 @@ import {
...
@@ -41,10 +42,13 @@ import {
createdAt
!
:
Date
;
createdAt
!
:
Date
;
@
Column
({
name
:
'color'
,
type
:
'varchar'
,
length
:
100
,
nullable
:
true
})
@
Column
({
name
:
'color'
,
type
:
'varchar'
,
length
:
100
,
nullable
:
true
})
color
!
:
string
color
!
:
string
;
@
Column
({
name
:
'dateDue'
,
type
:
Date
,
default
:
null
})
@
Column
({
name
:
'active'
,
type
:
'boolean'
,
default
:
true
})
dateDue
!
:
Date
|
null
;
active
!
:
boolean
;
// @Column({ name: 'dateDue', type: Date, default: null })
// dateDue!: Date| null;
// @Column({ name: 'department', type: Boolean,nullable:true ,default: false})
// @Column({ name: 'department', type: Boolean,nullable:true ,default: false})
// department!: boolean;
// department!: boolean;
...
...
planner-api/src/models/Task.ts
View file @
d7200131
...
@@ -21,6 +21,8 @@ import {
...
@@ -21,6 +21,8 @@ import {
createdAt
:
Date
;
createdAt
:
Date
;
dateTimeStart
:
Date
|
null
;
dateTimeStart
:
Date
|
null
;
dateTimeDue
:
Date
|
null
;
dateTimeDue
:
Date
|
null
;
dateTimeDeadLine
:
Date
|
null
;
dateTimeFactDeadLine
:
Date
|
null
;
accomplish
:
taskFinishType
;
accomplish
:
taskFinishType
;
priority
:
priorityType
|
null
;
priority
:
priorityType
|
null
;
author
:
User
;
author
:
User
;
...
@@ -39,9 +41,13 @@ import {
...
@@ -39,9 +41,13 @@ import {
@
CreateDateColumn
({
name
:
'created_at'
,
type
:
Date
,
default
:
new
Date
()
})
@
CreateDateColumn
({
name
:
'created_at'
,
type
:
Date
,
default
:
new
Date
()
})
createdAt
!
:
Date
;
createdAt
!
:
Date
;
@
Column
({
name
:
'dateTimeStart'
,
type
:
Date
,
nullable
:
true
})
@
Column
({
name
:
'dateTimeStart'
,
type
:
Date
,
nullable
:
true
})
dateTimeStart
!
:
Date
|
null
;
dateTimeStart
!
:
Date
;
@
Column
({
name
:
'dateTimeDue'
,
type
:
Date
,
nullable
:
true
})
@
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
({
@
Column
({
type
:
"enum"
,
type
:
"enum"
,
...
...
planner-api/src/routers/projects.ts
View file @
d7200131
...
@@ -2,6 +2,7 @@ import express,{Router, Request, Response} from 'express';
...
@@ -2,6 +2,7 @@ import express,{Router, Request, Response} from 'express';
import
{
Project
}
from
'../models/Project'
;
import
{
Project
}
from
'../models/Project'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
User
}
from
'../models/User'
;
import
{
User
}
from
'../models/User'
;
import
{
Member
,
MemberRole
}
from
'../models/Member'
;
const
router
:
Router
=
express
.
Router
();
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
const
dataSource
=
myDataSource
;
...
@@ -23,12 +24,16 @@ router.post('/', async (req:Request, res:Response): Promise<Response> => {
...
@@ -23,12 +24,16 @@ router.post('/', async (req:Request, res:Response): Promise<Response> => {
.
select
(
"user"
)
.
select
(
"user"
)
.
from
(
User
,
"user"
)
.
from
(
User
,
"user"
)
.
where
(
"user.token = :token"
,
{
token
:
token
})
.
where
(
"user.token = :token"
,
{
token
:
token
})
.
getOne
()
.
getOne
()
;
if
(
!
user
)
return
res
.
status
(
404
).
send
({
Message
:
'user not found'
})
if
(
!
user
)
return
res
.
status
(
404
).
send
({
Message
:
'user not found'
})
const
member
:
Member
=
new
Member
;
member
.
user
=
user
;
member
.
role
=
MemberRole
.
ADMIN
;
await
member
.
save
();
const
project
:
Project
=
new
Project
()
const
project
:
Project
=
new
Project
()
project
.
title
=
title
;
project
.
title
=
title
;
project
.
color
=
color
;
project
.
color
=
color
;
project
.
dateDue
=
dateDue
||
null
;
project
.
members
=
[
member
]
// project.department = department;
// project.department = department;
// project.workers = workers|| null;
// project.workers = workers|| null;
project
.
tasks
=
tasks
||
null
;
project
.
tasks
=
tasks
||
null
;
...
...
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