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
6b05046c
Commit
6b05046c
authored
Jan 09, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#136
added personal project creation in user creation process in the fixtures
parent
0d57310f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
fixtures.ts
planner-api/src/fixtures.ts
+21
-0
No files found.
planner-api/src/fixtures.ts
View file @
6b05046c
...
...
@@ -6,6 +6,7 @@ import { priorityType, Task, taskFinishType } from "./models/Task";
import
{
Project
}
from
"./models/Project"
;
import
{
Member
,
MemberRole
}
from
"./models/Member"
;
import
{
DateTimeTask
}
from
"./models/DateTimeTask"
;
import
{
PasswordRecovery
}
from
"./models/PasswordRecovery"
;
function
randomIntFromInterval
(
min
:
number
,
max
:
number
)
{
min
=
Math
.
ceil
(
min
);
...
...
@@ -50,6 +51,8 @@ const loadFixtures = async () => {
await
repositoryProject
.
delete
({})
const
repositoryUser
=
myDataSource
.
getRepository
(
User
);
await
repositoryUser
.
delete
({});
const
repositoryPasswordRecovery
=
myDataSource
.
getRepository
(
PasswordRecovery
);
await
repositoryPasswordRecovery
.
delete
({});
console
.
log
(
'========================== '
+
'
\
n'
+
'Data Source has been cleared!'
+
'
\
n'
+
'=========================='
)
const
userRoles
=
[{
role
:
UserRole
.
SUPERUSER
},
{
role
:
UserRole
.
USER
},
{
role
:
UserRole
.
USER
},{
role
:
UserRole
.
USER
},];
...
...
@@ -68,6 +71,24 @@ const loadFixtures = async () => {
user
.
role
=
userRoles
[
i
].
role
;
user
.
generateToken
()
await
user
.
save
();
const
newProject
=
new
Project
();
newProject
.
title
=
'Личные дела'
;
newProject
.
color
=
'#f595ee'
;
await
newProject
.
save
()
const
newMember
=
new
Member
();
newMember
.
user
=
user
;
newMember
.
project
=
newProject
;
newMember
.
roleProject
=
MemberRole
.
ADMIN
;
await
newMember
.
save
();
const
notDefinedTaskProject
=
new
Project
();
notDefinedTaskProject
.
title
=
'Не определено'
;
notDefinedTaskProject
.
color
=
'#03fcfc'
;
await
notDefinedTaskProject
.
save
()
const
notDefinedTaskProjectMember
=
new
Member
();
notDefinedTaskProjectMember
.
user
=
user
;
notDefinedTaskProjectMember
.
project
=
notDefinedTaskProject
;
notDefinedTaskProjectMember
.
roleProject
=
MemberRole
.
ADMIN
;
await
notDefinedTaskProjectMember
.
save
();
users
.
push
(
user
)
}
...
...
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