Some scripts to setup activities with users and challenge and mission data. In configs/configs.js
file, you can change the tenant
const, which will then update the base URL.
- Fork the repo
$ git clone git@github.com:<user_name>/challengesV2-data-setup-1.git
$ cd challengesV2-data-setup
$ git remote add upstream git@github.com:AudaxHealthInc/challengesV2-data-setup.git
$ npm i
- Install the CLI module globally so you can run the shell command anywhere.
$ npm install -g
- Run the CLI
$ cds
A script to create X number of users. In generateUsers.js
file you can change the number of users generated by updating the param numberOfUsers
for generateUsers()
. The script will save the users to a new file under the user_data
directory. This json
file of users will then be used for later scripts.
Creates 1 new user. The user data will be outputted to the console. Remember to update TENANT
config in the configs/configs.js
file.
A script to generate a challenge. The script will generate a random name for the challenge and automatically set the dates. Any other changes to request body will have to be made in the challengesScripts/generateChallenge.js
file. After the challenge is created, the challengeId will be saved to challenge_data/challenge_ids.txt
file and the CHALLENGE_ID
const config will ge updated in the configs
directory. Updating the CHALLENGE_ID
after creating a user will allow us to automatically run the other challenges scripts with the new challenge.
This will join a group of users to challenge. To run this script, the generateUsers
script needs to be run first, and the USER_DATA_FILE
config needs to be updated to point to the file with the recently created users. Also, you will need to update the CHALLENGE_ID
const in the configs/configs.js
file if you want to run a challenge that was not generated with generateChallenge
script. You can grab an old challenge ID from challenge_data/challenge_ids.txt
file or run the generateChallenge
script again.
This script will post a random check-in amount for a group of users. Remember to update the configs/configs.js
file with the appropriate CHALLENGE_ID
and set of users config const, USER_DATA_FILE
.
This will delete a list of challenges. You will have to provide a list of challenge IDs in challengesScripts/deleteChallenges.js
.
This will create X number of teams and join the teams to a challenge. In order to run this script you must first run the generateChallenge
script with TEAM type challenge. This will save the challenge ID to the configs which is used in this script.
This will join a users to team. The script should divvy up the group users to teams (e.g., if you have 40 users and 4 teams then the script will join 10 users per team).
Prerequisites: 1. Generate users with generateUsers
, 2. Generate a TEAM
challenge with generateChallenge
, 3. Generate X number of teams with generateNewTeams
, 4. Finally join users to teams with this script.