Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-04-24 17:13:03 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
020f67ae8dbacc93b135969693af2d0b20113c91
020f67ae
1 parent
c6ab154f
update findEmail
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
back/src/api/User/findEmail/findEmail.graphql
back/src/api/User/findEmail/findEmail.js
back/src/api/User/findEmail/findEmail.graphql
View file @
020f67a
type Query {
findEmail(
secret
: String!): User!
findEmail(
phoneNumber
: String!): User!
}
...
...
back/src/api/User/findEmail/findEmail.js
View file @
020f67a
import
{
prisma
}
from
"../../../utils"
;
import
{
prisma
,
generateSecret
}
from
"../../../utils"
;
import
twilio
from
"twilio"
;
export
default
{
Query
:
{
findEmail
:
async
(
_
,
args
)
=>
{
const
{
secret
}
=
args
;
const
{
phoneNumber
}
=
args
;
const
accountSid
=
process
.
env
.
TWILIO_SID
;
const
authToken
=
process
.
env
.
TWILIO_AUTH_TOKEN
;
const
client
=
new
twilio
(
accountSid
,
authToken
);
const
randomWords
=
generateSecret
();
client
.
messages
.
create
({
body
:
`Please enter this word :
${
randomWords
}
`
,
to
:
`
${
phoneNumber
}
`
,
from
:
"KhuChat"
,
})
.
then
((
message
)
=>
console
.
log
(
message
.
sid
));
const
user
=
await
prisma
.
user
.
update
({
where
:
{
phoneNumber
,
},
data
:
{
phoneSecret
:
randomWords
,
},
});
return
user
;
},
},
};
...
...
Please
register
or
login
to post a comment