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
2b9245f9
Commit
2b9245f9
authored
Nov 02, 2022
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#8
remove some imports
parent
9c65cae3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
11 deletions
+5
-11
User.ts
planner-api/src/models/User.ts
+4
-8
users.ts
planner-api/src/routers/users.ts
+1
-3
No files found.
planner-api/src/models/User.ts
View file @
2b9245f9
...
@@ -3,14 +3,11 @@ import {
...
@@ -3,14 +3,11 @@ import {
Entity
,
Entity
,
PrimaryGeneratedColumn
,
PrimaryGeneratedColumn
,
CreateDateColumn
,
CreateDateColumn
,
UpdateDateColumn
,
BeforeInsert
,
BeforeInsert
,
BeforeUpdate
,
BeforeUpdate
,
BaseEntity
,
BaseEntity
,
JoinColumn
,
ManyToOne
ManyToOne
}
from
'typeorm'
;
}
from
'typeorm'
;
import
{
nanoid
}
from
'nanoid'
;
import
bcrypt
from
'bcrypt'
;
import
bcrypt
from
'bcrypt'
;
const
SALT_WORK_FACTOR
=
10
;
const
SALT_WORK_FACTOR
=
10
;
...
@@ -29,7 +26,7 @@ interface IUser {
...
@@ -29,7 +26,7 @@ interface IUser {
displayName
:
string
;
displayName
:
string
;
password
:
string
;
password
:
string
;
role
:
UserRoleType
;
role
:
UserRoleType
;
// createdAt: Date
;
createdAt
:
Date
|
undefined
;
}
}
...
@@ -54,10 +51,10 @@ export class User extends BaseEntity implements IUser {
...
@@ -54,10 +51,10 @@ export class User extends BaseEntity implements IUser {
phone
?:
string
phone
?:
string
@
CreateDateColumn
()
//
@CreateDateColumn()
//
@CreateDateColumn({ name: 'created_at', type: Date, default: new Date() })
@
CreateDateColumn
({
name
:
'created_at'
,
type
:
Date
,
default
:
new
Date
()
})
// createdAt: Date
createdAt
:
Date
|
undefined
;
@
Column
({
@
Column
({
type
:
"enum"
,
type
:
"enum"
,
...
@@ -66,7 +63,6 @@ export class User extends BaseEntity implements IUser {
...
@@ -66,7 +63,6 @@ export class User extends BaseEntity implements IUser {
})
})
role
!
:
UserRoleType
role
!
:
UserRoleType
@
Exclude
()
@
Column
({
type
:
'varchar'
,
nullable
:
false
,
select
:
false
})
@
Column
({
type
:
'varchar'
,
nullable
:
false
,
select
:
false
})
password
!
:
string
password
!
:
string
...
...
planner-api/src/routers/users.ts
View file @
2b9245f9
import
express
,{
Router
,
Request
,
Response
}
from
'express'
;
import
express
,{
Router
,
Request
,
Response
}
from
'express'
;
import
{
User
}
from
'../models/User'
;
import
{
User
}
from
'../models/User'
;
import
{
DataSource
}
from
'typeorm'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
myDataSource
}
from
'../app-data-source'
;
const
router
:
Router
=
express
.
Router
();
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
const
dataSource
=
myDataSource
;
// const dataSource = myDataSource;
router
.
get
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
router
.
get
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
const
users
:
any
=
await
dataSource
.
manager
.
find
(
User
)
const
users
=
await
dataSource
.
manager
.
find
(
User
)
return
res
.
send
({
users
})
return
res
.
send
({
users
})
})
})
...
...
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