File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed
Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ module.exports.createExpressApp = (store) => {
3333 } ,
3434 async ( accessToken , refreshToken , profile , done ) => {
3535 try {
36- let user = await findOrCreateUser ( profile , store ) ;
36+ let user = await findOrCreateUser ( profile , store , accessToken ) ;
3737 let repositories = await getRepositories (
3838 accessToken ,
3939 user . dataValues . login ,
Original file line number Diff line number Diff line change 1- const cleanProfile = ( profile ) => ( {
1+ const cleanProfile = ( profile , accessToken ) => ( {
22 avatarUrl : `${ profile . _json . avatar_url } ` ,
33 bio : `${ profile . _json . bio } ` ,
44 githubUrl : `${ profile . _json . html_url } ` ,
@@ -8,6 +8,7 @@ const cleanProfile = (profile) => ({
88 login : `${ profile . _json . login } ` ,
99 name : `${ profile . _json . name } ` ,
1010 websiteUrl : `${ profile . _json . blog } ` ,
11+ accessToken : `${ accessToken } `
1112} ) ;
1213
1314const cleanRepository = ( id , repository ) => ( {
@@ -24,8 +25,8 @@ const cleanRepository = (id, repository) => ({
2425 isStarred : repository . isStarred
2526} ) ;
2627
27- const findOrCreateUser = async ( rawProfile , store ) => {
28- let profile = cleanProfile ( rawProfile ) ;
28+ const findOrCreateUser = async ( rawProfile , store , accessToken ) => {
29+ let profile = cleanProfile ( rawProfile , accessToken ) ;
2930 try {
3031 let user = await store . user . findByPk ( profile . id ) ;
3132 if ( ! user ) {
Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ const user = (sequelize, DataTypes) => {
5151 type : DataTypes . STRING ,
5252 allowNull : false ,
5353 } ,
54+ accessToken : {
55+ type : DataTypes . STRING ,
56+ allowNull : false ,
57+ }
5458 } ,
5559 {
5660 timestamps : false ,
You can’t perform that action at this time.
0 commit comments