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
ad861ff7
Commit
ad861ff7
authored
Nov 28, 2022
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#69
fix fixtures
parent
296994dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
19 deletions
+11
-19
fixtures.ts
planner-api/src/fixtures.ts
+9
-17
projects.ts
planner-api/src/routers/projects.ts
+1
-1
users.ts
planner-api/src/routers/users.ts
+1
-1
No files found.
planner-api/src/fixtures.ts
View file @
ad861ff7
...
...
@@ -8,11 +8,12 @@ import { Member, MemberRole } from "./models/Member";
import
{
DateTimeTask
}
from
"./models/DateTimeTask"
;
function
randomIntFromInterval
(
min
:
number
,
max
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
)
min
=
Math
.
ceil
(
min
);
max
=
Math
.
floor
(
max
);
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
)
+
min
);
}
let
countUsers
=
0
let
countMembers
=
0
let
countProjects
=
0
let
countRolesProject
=
0
const
cycleThroughObject
=
(
countKey
:
number
,
objectObserve
:
any
):
MemberRole
=>
{
...
...
@@ -35,15 +36,6 @@ const cycleArrayOfMembers=(countIndex:number, members:Member[]):Member=>{
}
const
cycleArrayOfProjects
=
(
countIndex
:
number
,
projects
:
Project
[]):
Project
=>
{
let
project
=
projects
[
countIndex
]
countIndex
++
if
(
countIndex
===
projects
.
length
-
1
){
countIndex
=
0
}
return
project
}
const
loadFixtures
=
async
()
=>
{
myDataSource
.
initialize
()
...
...
@@ -86,16 +78,16 @@ const loadFixtures = async () => {
for
(
let
i
=
0
;
i
<
20
;
i
++
)
{
let
dateOfMonth
=
randomIntFromInterval
(
20
,
30
)
let
deadLineDateOfMonth
=
randomIntFromInterval
(
1
,
1
5
)
let
startDateTime
=
new
Date
(
2022
,
1
1
,
dateOfMonth
,
randomIntFromInterval
(
10
,
15
),
0
,
0
);
let
dueDateTime
=
new
Date
(
2022
,
1
1
,
dateOfMonth
,
randomIntFromInterval
(
16
,
20
),
0
,
0
);
let
deadLine
=
new
Date
(
2022
,
1
2
,
deadLineDateOfMonth
,
0
,
0
,
0
);
let
deadLineDateOfMonth
=
randomIntFromInterval
(
1
,
1
0
)
let
startDateTime
=
new
Date
(
2022
,
1
0
,
dateOfMonth
,
randomIntFromInterval
(
16
,
21
),
0
,
0
);
let
dueDateTime
=
new
Date
(
2022
,
1
0
,
dateOfMonth
,
randomIntFromInterval
(
22
,
22
),
0
,
0
);
let
deadLine
=
new
Date
(
2022
,
1
1
,
deadLineDateOfMonth
,
0
,
0
,
0
);
const
newDateTimeTask
=
new
DateTimeTask
()
newDateTimeTask
.
dateTimeStart
=
startDateTime
;
newDateTimeTask
.
dateTimeDue
=
dueDateTime
;
await
newDateTimeTask
.
save
()
if
(
i
<=
15
)
{
const
newTask
=
new
Task
();
const
newTask
=
new
Task
();
newTask
.
title
=
`Buy
${
faker
.
commerce
.
productName
()}
`
;
newTask
.
description
=
faker
.
random
.
words
(
4
);
newTask
.
author
=
faker
.
helpers
.
arrayElement
(
users
);
...
...
planner-api/src/routers/projects.ts
View file @
ad861ff7
...
...
@@ -31,7 +31,7 @@ router.get('/my',auth, async (req:Request, res:Response): Promise<Response>=> {
if
(
rawProjects
.
length
>
0
){
for
(
let
project
of
rawProjects
){
projectIds
.
push
(
project
.
id
)
)
}
}
const
projects
=
await
dataSource
...
...
planner-api/src/routers/users.ts
View file @
ad861ff7
...
...
@@ -33,7 +33,7 @@ const users = await dataSource
.
createQueryBuilder
(
"user"
)
.
getMany
()
return
res
.
send
({
users
})
})
})
/**create new user*/
router
.
post
(
'/'
,
upload
.
single
(
"avatar"
),
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
...
...
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