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
4e8888f9
Commit
4e8888f9
authored
Jan 27, 2023
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#163
router users changed
parent
1882dab8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
21 deletions
+0
-21
passwordRecovery.ts
planner-api/src/routers/passwordRecovery.ts
+0
-3
users.ts
planner-api/src/routers/users.ts
+0
-18
No files found.
planner-api/src/routers/passwordRecovery.ts
View file @
4e8888f9
...
@@ -15,7 +15,6 @@ const dataSource = myDataSource;
...
@@ -15,7 +15,6 @@ const dataSource = myDataSource;
router
.
post
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
void
|
Response
>=>
{
router
.
post
(
'/'
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
void
|
Response
>=>
{
try
{
try
{
const
{
email
}
=
req
.
body
const
{
email
}
=
req
.
body
console
.
log
(
"emeil"
,
email
)
const
user
=
await
dataSource
const
user
=
await
dataSource
.
getRepository
(
User
)
.
getRepository
(
User
)
.
findOne
({
.
findOne
({
...
@@ -23,14 +22,12 @@ router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{
...
@@ -23,14 +22,12 @@ router.post ('/', async (req:Request, res:Response):Promise<void |Response>=>{
email
:
email
email
:
email
}
}
})
})
console
.
log
(
'user '
,
user
)
if
(
!
user
)
return
res
.
status
(
404
).
send
({
message
:
'user not found'
})
if
(
!
user
)
return
res
.
status
(
404
).
send
({
message
:
'user not found'
})
const
token
=
nanoid
();
const
token
=
nanoid
();
const
passwordRecovery
=
new
PasswordRecovery
()
const
passwordRecovery
=
new
PasswordRecovery
()
passwordRecovery
.
user
=
user
;
passwordRecovery
.
user
=
user
;
passwordRecovery
.
token
=
token
;
passwordRecovery
.
token
=
token
;
await
passwordRecovery
.
save
()
await
passwordRecovery
.
save
()
console
.
log
(
'passwordRecover '
,
passwordRecovery
)
const
url
=
`
${
frontend_url
}
/reset-password/
${
token
}
`
;
const
url
=
`
${
frontend_url
}
/reset-password/
${
token
}
`
;
await
transporter
.
sendMail
({
await
transporter
.
sendMail
({
from
:
"planner45@yandex.com"
,
from
:
"planner45@yandex.com"
,
...
...
planner-api/src/routers/users.ts
View file @
4e8888f9
...
@@ -78,24 +78,6 @@ router.get('/all-fields/', async (req : Request, res : Response):Promise<object>
...
@@ -78,24 +78,6 @@ router.get('/all-fields/', async (req : Request, res : Response):Promise<object>
})
})
//** return displayName of user, requested by userId */
router
.
get
(
'/display-name/:userId'
,
auth
,
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
try
{
const
{
userId
}
=
req
.
params
const
displayName
=
await
dataSource
.
createQueryBuilder
()
.
select
([
'user.displayName'
])
.
from
(
User
,
"user"
)
.
where
(
"user.id = :userId"
,
{
userId
})
.
getOne
()
if
(
!
displayName
)
return
res
.
status
(
404
).
send
({
message
:
'displayName not found'
})
return
res
.
send
({
displayName
})
}
catch
(
e
)
{
return
res
.
status
(
502
).
send
({
message
:(
e
as
Error
).
message
})
}
})
/**create new user*/
/**create new user*/
router
.
post
(
'/'
,
upload
.
single
(
"avatar"
),
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
router
.
post
(
'/'
,
upload
.
single
(
"avatar"
),
async
(
req
:
Request
,
res
:
Response
):
Promise
<
object
>
=>
{
try
{
try
{
...
...
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