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
da2988e0
Commit
da2988e0
authored
Nov 15, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'task-42-enhance/echance-fixtures' into 'development'
#42
написал фикстуру для проектов See merge request
!25
parents
36e04fb1
6fc8f84a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
fixtures.ts
planner-api/src/fixtures.ts
+14
-5
No files found.
planner-api/src/fixtures.ts
View file @
da2988e0
...
@@ -15,10 +15,10 @@ const loadFixtures = async () => {
...
@@ -15,10 +15,10 @@ const loadFixtures = async () => {
.
then
(
async
()
=>
{
.
then
(
async
()
=>
{
const
repositoryTask
=
myDataSource
.
getRepository
(
Task
);
const
repositoryTask
=
myDataSource
.
getRepository
(
Task
);
await
repositoryTask
.
delete
({});
await
repositoryTask
.
delete
({});
const
repositoryProject
=
myDataSource
.
getRepository
(
Project
);
await
repositoryProject
.
delete
({})
const
repositoryUser
=
myDataSource
.
getRepository
(
User
);
const
repositoryUser
=
myDataSource
.
getRepository
(
User
);
await
repositoryUser
.
delete
({});
await
repositoryUser
.
delete
({});
const
repositoryProject
=
myDataSource
.
getRepository
(
Project
);
await
repositoryProject
.
delete
({});
console
.
log
(
'========================== '
+
'
\
n'
+
'Data Source has been cleared!'
+
'
\
n'
+
'=========================='
)
console
.
log
(
'========================== '
+
'
\
n'
+
'Data Source has been cleared!'
+
'
\
n'
+
'=========================='
)
const
userRoles
=
[{
role
:
UserRole
.
DIRECTOR
},
{
role
:
UserRole
.
SUPERUSER
},
{
role
:
UserRole
.
USER
},
{
role
:
UserRole
.
USER
}];
const
userRoles
=
[{
role
:
UserRole
.
DIRECTOR
},
{
role
:
UserRole
.
SUPERUSER
},
{
role
:
UserRole
.
USER
},
{
role
:
UserRole
.
USER
}];
...
@@ -39,13 +39,13 @@ const loadFixtures = async () => {
...
@@ -39,13 +39,13 @@ const loadFixtures = async () => {
await
user
.
save
();
await
user
.
save
();
users
.
push
(
user
)
users
.
push
(
user
)
}
}
const
tasks
=
[]
const
tasks
:
Task
[]
=
[]
type
taskFinishType
=
"opened"
|
"done"
|
"failed"
;
type
taskFinishType
=
"opened"
|
"done"
|
"failed"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
const
priorities
:
priorityType
[]
=
[
"A"
,
"B"
,
"C"
]
const
priorities
:
priorityType
[]
=
[
"A"
,
"B"
,
"C"
]
const
accomplish
:
taskFinishType
[]
=
[
"opened"
,
"done"
,
"failed"
]
const
accomplish
:
taskFinishType
[]
=
[
"opened"
,
"done"
,
"failed"
]
for
(
let
i
=
0
;
i
<
15
;
i
++
)
{
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
if
(
i
<=
1
0
)
{
if
(
i
<=
1
5
)
{
const
newTask
=
new
Task
();
const
newTask
=
new
Task
();
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
description
=
faker
.
random
.
words
(
4
);
...
@@ -71,6 +71,15 @@ const loadFixtures = async () => {
...
@@ -71,6 +71,15 @@ const loadFixtures = async () => {
tasks
.
push
(
newTask
)
tasks
.
push
(
newTask
)
}
}
}
}
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
const
newProject
=
new
Project
();
newProject
.
title
=
`Project
${
faker
.
random
.
words
(
1
)}
`
;
newProject
.
color
=
faker
.
random
.
words
(
4
);
newProject
.
admin
=
faker
.
helpers
.
arrayElement
(
users
);
newProject
.
workers
=
faker
.
helpers
.
arrayElements
(
users
,
randomIntFromInterval
(
1
,
3
));
newProject
.
tasks
=
faker
.
helpers
.
arrayElements
(
tasks
,
randomIntFromInterval
(
0
,
19
));
await
newProject
.
save
();
}
console
.
log
(
'========================== '
+
'
\
n'
+
'Fixtures done!'
+
'
\
n'
+
'=========================='
)
console
.
log
(
'========================== '
+
'
\
n'
+
'Fixtures done!'
+
'
\
n'
+
'=========================='
)
})
})
...
...
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