| 1 | // masterOnboardingProcess.js |
| 2 | // This script creates a new member by using the manually update memberId from .env and then calling each other script in order |
| 3 | // You must create the new member first, manually using the script in members/create-new.js and paste the returned memberId in .env |
| 4 | |
| 5 | // Import necessary scripts |
| 6 | const addMemberToTeam = require('./add-member-to-team'); |
| 7 | const grantWorkspacePermission = require('./create-workspace-permission'); |
| 8 | const addNewConnectionPermission = require('./create-workspace-permission'); // This line seems incorrect, it should import a different script |
| 9 | const addNewWorkspace = require('./create-workspace'); |
| 10 | |
| 11 | // Define an asynchronous function to handle the onboarding process |
| 12 | async function onboardNewMember() { |
| 13 | console.log('Starting the automated part of the onboarding process.'); |
| 14 | |
| 15 | try { |
| 16 | // Assuming addMemberToTeam.js and other scripts use MEMBERID from .env internally |
| 17 | console.log('Adding member to team...'); |
| 18 | await addMemberToTeam(); |
| 19 | console.log('Member successfully added to team.'); |
| 20 | |
| 21 | console.log('Creating a new workspace...'); |
| 22 | await addNewWorkspace(); |
| 23 | console.log('New workspace created successfully.'); |
| 24 | |
| 25 | console.log('Granting workspace permission...'); |
| 26 | await grantWorkspacePermission(); |
| 27 | console.log('Workspace permissions granted successfully.'); |
| 28 | |
| 29 | console.log('Granting connection permission...'); |
| 30 | await addNewConnectionPermission(); // This line seems incorrect, it should call a different function |
| 31 | console.log('Connection permissions granted successfully.'); |
| 32 | |
| 33 | // Include other steps as necessary |
| 34 | |
| 35 | console.log('Onboarding process completed successfully.'); |
| 36 | } catch (error) { |
| 37 | console.error('An error occurred during the onboarding process:', error); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | // Execute the function to start the onboarding process |
| 42 | onboardNewMember(); |