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
9de7da77
Commit
9de7da77
authored
Jan 27, 2023
by
Евгений Положенцев
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'task-163-fix/backend_clean' into 'development'
Task 163 fix/backend clean See merge request
!132
parents
9c547d3b
4e8888f9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
29 deletions
+6
-29
.gitignore
planner-api/.gitignore
+1
-0
server.js
planner-api/build/server.js
+0
-2
package.json
planner-api/package.json
+5
-6
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/.gitignore
View file @
9de7da77
node_modules
node_modules
.idea
.idea
build
\ No newline at end of file
planner-api/build/server.js
deleted
100644 → 0
View file @
9c547d3b
"use strict"
;
console
.
log
(
'Hello'
);
planner-api/package.json
View file @
9de7da77
...
@@ -23,25 +23,24 @@
...
@@ -23,25 +23,24 @@
"nodemon"
:
"^2.0.20"
,
"nodemon"
:
"^2.0.20"
,
"ts-node"
:
"^10.9.1"
,
"ts-node"
:
"^10.9.1"
,
"typeorm-fixtures-cli"
:
"^3.0.1"
,
"typeorm-fixtures-cli"
:
"^3.0.1"
,
"typescript"
:
"^4.8.4"
"typescript"
:
"^4.8.4"
,
},
"dependencies"
:
{
"@types/bcrypt"
:
"^5.0.0"
,
"@types/bcrypt"
:
"^5.0.0"
,
"@types/cors"
:
"^2.8.12"
,
"@types/cors"
:
"^2.8.12"
,
"@types/express"
:
"^4.17.14"
,
"@types/express"
:
"^4.17.14"
,
"@types/nodemailer"
:
"^6.4.6"
,
"@types/nodemailer"
:
"^6.4.6"
},
"dependencies"
:
{
"bcrypt"
:
"^5.1.0"
,
"bcrypt"
:
"^5.1.0"
,
"class-transformer"
:
"^0.5.1"
,
"class-transformer"
:
"^0.5.1"
,
"class-validator"
:
"^0.13.2"
,
"class-validator"
:
"^0.13.2"
,
"cors"
:
"^2.8.5"
,
"cors"
:
"^2.8.5"
,
"express"
:
"^4.18.2"
,
"express"
:
"^4.18.2"
,
"express-async-errors"
:
"^3.1.1"
,
"express-async-errors"
:
"^3.1.1"
,
"mongoose"
:
"^6.7.0"
,
"multer"
:
"^1.4.5-lts.1"
,
"multer"
:
"^1.4.5-lts.1"
,
"nanoid"
:
"^3.3.4"
,
"nanoid"
:
"^3.3.4"
,
"nodemailer"
:
"^6.8.0"
,
"nodemailer"
:
"^6.8.0"
,
"path"
:
"^0.12.7"
,
"path"
:
"^0.12.7"
,
"pg"
:
"^8.8.0"
,
"reflect-metadata"
:
"^0.1.13"
,
"reflect-metadata"
:
"^0.1.13"
,
"typeorm"
:
"^0.3.10"
"typeorm"
:
"^0.3.10"
}
}
...
...
planner-api/src/routers/passwordRecovery.ts
View file @
9de7da77
...
@@ -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 @
9de7da77
...
@@ -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