Skip to content

Commit

Permalink
Merge pull request #46 from Muzikie/45-add-support-for-oauth
Browse files Browse the repository at this point in the history
Add support for oauth
  • Loading branch information
reyraa authored Oct 1, 2024
2 parents e2060e3 + bb4e346 commit 7451fa9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions config/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ module.exports = ({ env }) => ({
'users-permissions': {
config: {
jwtSecret: env('ADMIN_JWT_SECRET'),
providers: {
google: {
clientId: env('GOOGLE_CLIENT_ID'),
redirectUri: 'muzikie://auth/callback',
},
},
},
},
upload: {
Expand Down
2 changes: 2 additions & 0 deletions src/api/contribution/controllers/contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export default factories.createCoreController('api::contribution.contribution',

// Return the created contribution
const sanitizedEntity = await this.sanitizeOutput(contribution, ctx);

// before returning the value, make sure to update the Solana project too
return this.transformResponse(sanitizedEntity);
} catch (err) {
ctx.throw(500, err);
Expand Down
23 changes: 21 additions & 2 deletions src/api/project/controllers/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,30 @@ export default factories.createCoreController(
// Proceed with creating the the project
const result = await super.create(ctx);

// TODO: Call the Smart Contract method here to register the project on the blockchain
// and if not created, revert the centralized project creation.

// const wallet = await strapi.entityService.findMany(
// 'api::wallet.wallet',
// {
// users_permissions_user: user.id,
// },
// );

// if(wallet.length) {
// // TODO: Call the Smart Contract method here to register the project on the blockchain
// // and if not created, revert the centralized project creation.


// // If the Smart contract interaction was unsuccessful, we have to delete the recently created
// // Project using result.data.id
// throw new Error(`Error transaction: ${result.data.id}`);
// } else {
// throw new Error('Wallet not found');
// }


return result;
} catch (err) {
// const id = err.message.split('Error transaction:')[1]
ctx.throw(500, err);
}
},
Expand Down

0 comments on commit 7451fa9

Please sign in to comment.