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
402aad11
Commit
402aad11
authored
Nov 09, 2022
by
Ermolaev Timur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#17
Реализовал юзеров в фикстуре
parent
d1b8f15f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
641 additions
and
7 deletions
+641
-7
package-lock.json
planner-api/package-lock.json
+577
-0
package.json
planner-api/package.json
+4
-1
fixtures.ts
planner-api/src/fixtures.ts
+54
-0
Task.ts
planner-api/src/models/Task.ts
+1
-1
User.ts
planner-api/src/models/User.ts
+4
-4
tasksActions.js
planner-front/src/store/actions/tasksActions.js
+1
-1
No files found.
planner-api/package-lock.json
View file @
402aad11
This diff is collapsed.
Click to expand it.
planner-api/package.json
View file @
402aad11
...
@@ -7,18 +7,21 @@
...
@@ -7,18 +7,21 @@
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"test"
:
"echo
\"
Error: no test specified
\"
&& exit 1"
,
"dev"
:
"nodemon"
,
"dev"
:
"nodemon"
,
"start"
:
"npm run build && node build/server.js"
,
"start"
:
"npm run build && node build/server.js"
,
"lint"
:
"eslint . --ext .ts"
"lint"
:
"eslint . --ext .ts"
,
"fixtures"
:
"ts-node ./src/fixtures.ts"
},
},
"keywords"
:
[],
"keywords"
:
[],
"author"
:
""
,
"author"
:
""
,
"license"
:
"ISC"
,
"license"
:
"ISC"
,
"devDependencies"
:
{
"devDependencies"
:
{
"@faker-js/faker"
:
"^7.6.0"
,
"@types/node"
:
"^18.11.8"
,
"@types/node"
:
"^18.11.8"
,
"@typescript-eslint/eslint-plugin"
:
"^5.41.0"
,
"@typescript-eslint/eslint-plugin"
:
"^5.41.0"
,
"@typescript-eslint/parser"
:
"^5.41.0"
,
"@typescript-eslint/parser"
:
"^5.41.0"
,
"eslint"
:
"^8.26.0"
,
"eslint"
:
"^8.26.0"
,
"nodemon"
:
"^2.0.20"
,
"nodemon"
:
"^2.0.20"
,
"ts-node"
:
"^10.9.1"
,
"ts-node"
:
"^10.9.1"
,
"typeorm-fixtures-cli"
:
"^3.0.1"
,
"typescript"
:
"^4.8.4"
"typescript"
:
"^4.8.4"
},
},
"dependencies"
:
{
"dependencies"
:
{
...
...
planner-api/src/fixtures.ts
0 → 100644
View file @
402aad11
import
{
myDataSource
}
from
"./app-data-source"
;
import
{
User
,
UserRole
}
from
"./models/User"
;
import
{
faker
}
from
'@faker-js/faker'
;
import
{
Task
}
from
"./models/Task"
;
function
randomIntFromInterval
(
min
:
number
,
max
:
number
)
{
return
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
)
+
min
)
}
const
loadFixtures
=
async
()
=>
{
myDataSource
.
initialize
()
.
then
(
async
()
=>
{
console
.
log
(
`
==========================
Data Source has been initialized!
==========================
`
)
const
userRoles
=
[{
role
:
UserRole
.
DIRECTOR
},
{
role
:
UserRole
.
SUPERUSER
},
{
role
:
UserRole
.
USER
},
{
role
:
UserRole
.
USER
}];
const
users
=
[]
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
const
name
=
faker
.
name
.
firstName
()
const
surname
=
faker
.
name
.
lastName
()
const
displayName
=
name
+
' '
+
surname
[
0
]
+
'.'
const
user
=
new
User
()
user
.
name
=
name
;
user
.
surname
=
surname
;
user
.
password
=
'12345qwert'
;
user
.
displayName
=
displayName
;
user
.
phone
=
faker
.
phone
.
number
(
'+77#########'
)
user
.
email
=
faker
.
internet
.
email
();
user
.
role
=
userRoles
[
i
].
role
;
user
.
generateToken
()
await
user
.
save
();
users
.
push
(
user
)
}
})
.
catch
((
err
)
=>
{
console
.
error
(
"Error during Data Source initialization:"
,
err
)
})
};
loadFixtures
()
\ No newline at end of file
planner-api/src/models/Task.ts
View file @
402aad11
...
@@ -11,7 +11,7 @@ import {
...
@@ -11,7 +11,7 @@ import {
import
{
User
}
from
'./User'
;
import
{
User
}
from
'./User'
;
import
{
Project
}
from
'./Project'
;
import
{
Project
}
from
'./Project'
;
type
taskFinishType
=
"open"
|
"done"
|
"failed"
;
type
taskFinishType
=
"open
ed
"
|
"done"
|
"failed"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
type
priorityType
=
"A"
|
"B"
|
"C"
;
interface
ITask
{
interface
ITask
{
...
...
planner-api/src/models/User.ts
View file @
402aad11
...
@@ -43,20 +43,20 @@ interface IUser {
...
@@ -43,20 +43,20 @@ interface IUser {
export
class
User
extends
BaseEntity
implements
IUser
{
export
class
User
extends
BaseEntity
implements
IUser
{
@
PrimaryGeneratedColumn
(
"uuid"
)
@
PrimaryGeneratedColumn
(
"uuid"
)
id
!
:
string
;
id
!
:
string
;
@
Column
({
name
:
'name'
,
type
:
'varchar'
,
length
:
2
0
,
nullable
:
false
})
@
Column
({
name
:
'name'
,
type
:
'varchar'
,
length
:
3
0
,
nullable
:
false
})
name
!
:
string
;
name
!
:
string
;
@
Column
({
name
:
'surname'
,
type
:
'varchar'
,
length
:
30
,
nullable
:
false
})
@
Column
({
name
:
'surname'
,
type
:
'varchar'
,
length
:
30
,
nullable
:
false
})
surname
!
:
string
;
surname
!
:
string
;
@
Column
({
name
:
'displayName'
,
type
:
'varchar'
,
length
:
3
0
,
nullable
:
false
})
@
Column
({
name
:
'displayName'
,
type
:
'varchar'
,
length
:
3
5
,
nullable
:
false
})
displayName
!
:
string
;
displayName
!
:
string
;
@
Column
({
name
:
'email'
,
type
:
'varchar'
,
length
:
2
0
,
unique
:
true
,
nullable
:
false
})
@
Column
({
name
:
'email'
,
type
:
'varchar'
,
length
:
4
0
,
unique
:
true
,
nullable
:
false
})
@
IsEmail
()
@
IsEmail
()
email
!
:
string
;
email
!
:
string
;
@
Column
({
name
:
'phone'
,
type
:
'varchar'
,
length
:
1
0
,
unique
:
true
,
nullable
:
true
})
@
Column
({
name
:
'phone'
,
type
:
'varchar'
,
length
:
1
5
,
unique
:
true
,
nullable
:
true
})
phone
?:
string
;
phone
?:
string
;
@
Column
({
name
:
'token'
,
type
:
'varchar'
,
length
:
100
,
unique
:
true
,
nullable
:
false
})
@
Column
({
name
:
'token'
,
type
:
'varchar'
,
length
:
100
,
unique
:
true
,
nullable
:
false
})
...
...
planner-front/src/store/actions/tasksActions.js
View file @
402aad11
...
@@ -44,7 +44,7 @@ export const addTask = (task) => {
...
@@ -44,7 +44,7 @@ export const addTask = (task) => {
try
{
try
{
await
axios
.
post
(
"/tasks"
,
task
,
{
await
axios
.
post
(
"/tasks"
,
task
,
{
headers
:
{
headers
:
{
'Authorization'
:
'
aBhHYW8kXUUzjXlxOwGmg
'
'Authorization'
:
'
yjBjcPCQwytwrYo9rRuiK
'
}
}
});
});
dispatch
(
addTaskSuccess
())
dispatch
(
addTaskSuccess
())
...
...
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