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
e08a5006
Commit
e08a5006
authored
Nov 09, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17
Реализовал очищение данных
parent
9d00e81b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
fixtures.ts
planner-api/src/fixtures.ts
+9
-16
No files found.
planner-api/src/fixtures.ts
View file @
e08a5006
...
...
@@ -3,8 +3,7 @@ import { User, UserRole } from "./models/User";
import
{
faker
}
from
'@faker-js/faker'
;
import
{
Task
}
from
"./models/Task"
;
import
{
Project
}
from
"./models/Project"
;
function
randomIntFromInterval
(
min
:
number
,
max
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
)
...
...
@@ -14,13 +13,13 @@ const loadFixtures = async () => {
myDataSource
.
initialize
()
.
then
(
async
()
=>
{
cons
ole
.
log
(
`
==========================
Data Source has been initialized!
==========================
`
)
cons
t
repositoryTask
=
myDataSource
.
getRepository
(
Task
);
await
repositoryTask
.
delete
({});
const
repositoryUser
=
myDataSource
.
getRepository
(
User
);
await
repositoryUser
.
delete
({});
const
repositoryProject
=
myDataSource
.
getRepository
(
Project
);
await
repositoryProject
.
delete
({});
console
.
log
(
'========================== '
+
'
\
n'
+
'Data Source has been cleared!'
+
'
\
n'
+
'=========================='
)
const
userRoles
=
[{
role
:
UserRole
.
DIRECTOR
},
{
role
:
UserRole
.
SUPERUSER
},
{
role
:
UserRole
.
USER
},
{
role
:
UserRole
.
USER
}];
const
users
=
[]
...
...
@@ -72,13 +71,7 @@ Data Source has been initialized!
tasks
.
push
(
newTask
)
}
}
console
.
log
(
`
==========================
Fixtures done!
==========================
`
)
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