Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into mmdl #1538

Merged
merged 36 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
955fd3b
Merge pull request #1430 from Enterprise-CMCS/develop
Dark-Knight-1313 Dec 11, 2023
aec72db
Merge pull request #1434 from Enterprise-CMCS/develop
Dark-Knight-1313 Dec 13, 2023
b07dba5
Merge pull request #1437 from Enterprise-CMCS/develop
Dark-Knight-1313 Dec 20, 2023
d5668e6
Merge pull request #1440 from Enterprise-CMCS/develop
Dark-Knight-1313 Jan 5, 2024
e78364b
Merge pull request #1450 from Enterprise-CMCS/develop
Dark-Knight-1313 Feb 2, 2024
e6e5be1
Merge pull request #1467 from Enterprise-CMCS/develop
Dark-Knight-1313 Apr 8, 2024
8bb9bba
Merge pull request #1473 from Enterprise-CMCS/develop
Dark-Knight-1313 May 14, 2024
6fcde78
Merge pull request #1477 from Enterprise-CMCS/develop
Dark-Knight-1313 Jun 26, 2024
b071bff
Merge pull request #1487 from Enterprise-CMCS/develop
Dark-Knight-1313 Jul 12, 2024
ddd8db9
Merge pull request #1493 from Enterprise-CMCS/develop
Dark-Knight-1313 Aug 2, 2024
e28c929
Merge pull request #1502 from Enterprise-CMCS/develop
Dark-Knight-1313 Aug 30, 2024
e46999b
ensure subsequent submission is only for users with access to submit …
bflynn-cms Sep 17, 2024
ff5dab1
Merge develop to masterclone (subsub UAT) (#1508)
bflynn-cms Sep 19, 2024
4b70570
trim content before ready check for addl info (#1509)
bflynn-cms Sep 19, 2024
75491f9
Merge pull request #1511 from Enterprise-CMCS/develop
Dark-Knight-1313 Sep 20, 2024
39b38f6
remove svg icon from faq header buttons and filter panel buttons
anyoussefinia Sep 27, 2024
5099f46
update text on subsequent submissions banner along with associated cy…
anyoussefinia Sep 30, 2024
d301fd2
removed apostrophe
anyoussefinia Sep 30, 2024
6a3998b
modify cypres test files to reflect text change
anyoussefinia Sep 30, 2024
d532c72
added and more as per story request
anyoussefinia Oct 1, 2024
2e91b72
added and more to only subsequent submissions related forms as per st…
anyoussefinia Oct 2, 2024
3049e62
change comma to period
anyoussefinia Oct 2, 2024
5a199ca
Merge pull request #1518 from Enterprise-CMCS/oy2-30490
anyoussefinia Oct 2, 2024
1df087c
Merge pull request #1521 from Enterprise-CMCS/oy2-30444
anyoussefinia Oct 2, 2024
df95d92
removed boolean config prop
anyoussefinia Oct 2, 2024
6c59184
changed jpeg to jpg on FAQ (#1522)
andieswift Oct 2, 2024
af51671
Update terminology from "subsequent submission" to "subsequent docume…
andieswift Oct 3, 2024
e9b9f5a
revert change picked up from other story
anyoussefinia Oct 4, 2024
8e507b4
added space
anyoussefinia Oct 4, 2024
a666d84
Create generate_packages.py (#1520)
bflynn-cms Oct 4, 2024
d12a4ac
remove accidental pickup from other branch
anyoussefinia Oct 4, 2024
7658ebc
Merge pull request #1525 from Enterprise-CMCS/oy2-30157
anyoussefinia Oct 4, 2024
db2f4d7
Emails: Sub Doc Email Fix (#1519)
andieswift Oct 7, 2024
2f5abd1
Merge branch 'develop' into masterclone
anyoussefinia Oct 8, 2024
676faa2
Merge pull request #1528 from Enterprise-CMCS/masterclone
anyoussefinia Oct 8, 2024
60f619a
oy2-30619 - Configure AWS SDK v2 as a lambda layer (#1534)
bflynn-cms Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ tests/cypress/videos
tests/cypress/screenshots
tests/cypress/fixtures/packageDashboardSPAIDs.json
tests/cypress/fixtures/packageDashboardWaiverNumbers.json
tests/cypress/fixtures/savedID.json
tests/cypress/fixtures/savedID.json
/services/layers/aws-sdk-v2-layer/.serverless
15 changes: 15 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,27 @@
stage=${1:-dev}

install_deps() {
local islayer=false # Flag to track whether we navigated into the nodejs folder

# Check if we're inside a layer directory (layers have a 'nodejs' folder)
if [ -d "nodejs" ]; then
# If we're in a Lambda layer, navigate to the 'nodejs' folder
cd nodejs
islayer=true # Set the flag to true since we navigated into nodejs
fi

if [ "$CI" == "true" ]; then # If we're in a CI system
if [ ! -d "node_modules" ]; then # If we don't have any node_modules (CircleCI cache miss scenario), run npm ci. Otherwise, we're all set, do nothing.
npm ci --legacy-peer-deps
fi
else # We're not in a CI system, let's npm install
npm install --legacy-peer-deps
fi

# If we navigated to the nodejs folder (i.e., for a layer), go back to the root folder
if [ "$islayer" = true ]; then
cd ..
fi
}

deploy() {
Expand All @@ -25,6 +39,7 @@ install_deps
services=(
'ui'
'uploads'
'layers/aws-sdk-v2-layer'
'app-api'
'email'
'one-stream'
Expand Down
2 changes: 1 addition & 1 deletion services/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"version": "1.0.0",
"devDependencies": {
"aws-sdk-client-mock": "^0.5.6",
"aws-sdk": "^2.752.0",
"esbuild": "^0.19.4",
"serverless-dotenv-plugin": "^3.12.2",
"serverless-esbuild": "^1.48.4",
"serverless-offline": "^13.5.0"
},
"dependencies": {
"aws-sdk": "^2.752.0",
"@aws-sdk/client-dynamodb": "^3.43.0",
"@aws-sdk/lib-dynamodb": "^3.454.0",
"cmscommonlib": "file:../common",
Expand Down
7 changes: 7 additions & 0 deletions services/admin/scripts/READ.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This /scripts Folder simply contains scripts that are not used in the application or deployed via lambda but are useful for admin type functions.

#####

generate_packages - creates new records in Under Review status by inserting both a OneMAC record and a SEATool record
rebuildPackagesbyPK - force a rebuild of the package record for all packages listed in pk_values.json
setPOCs - set the action_officers (srt) and lead_analyst (cpoc) for all packages listed in pk_values.json
82 changes: 82 additions & 0 deletions services/admin/scripts/createUsers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash

# Variables
USER_POOL_ID="us-east-1_9NXuk7ucb"
INPUT_FILE="users.json"
DYNAMODB_TABLE="onemac-masterclone-one"
DATE=$(date +%s%3N) # Current timestamp in milliseconds

# Read the JSON file and loop through each user
jq -c '.users[]' $INPUT_FILE | while read -r user; do
PASSWORD=$(echo $user | jq -r '.password')
EMAIL=$(echo $user | jq -r '.email')
FAMILY_NAME=$(echo $user | jq -r '.family_name')
GIVEN_NAME=$(echo $user | jq -r '.given_name')
ROLE=$(echo $user | jq -r '.role')

# Concatenate given name and family name to form full name
FULL_NAME="$GIVEN_NAME $FAMILY_NAME"

# Determine territory and GSI fields based on role
if [ "$ROLE" = "systemadmin" ]; then
TERRITORY="N/A"
GSI1SK="Boss"
GSI1PK="systemadmin#N/A"
else
TERRITORY=$(echo $user | jq -r '.territory')
GSI1SK="statesystemadmin#$TERRITORY"
GSI1PK="USER"
fi

echo "Creating user with email: $EMAIL"

# Use the email as the username in Cognito
aws cognito-idp admin-create-user \
--user-pool-id "$USER_POOL_ID" \
--username "$EMAIL" \
--user-attributes Name="email",Value="$EMAIL" \
Name="family_name",Value="$FAMILY_NAME" \
Name="given_name",Value="$GIVEN_NAME" \
Name="email_verified",Value="true" \
--message-action SUPPRESS

# Set the password and mark the user as confirmed
aws cognito-idp admin-set-user-password \
--user-pool-id "$USER_POOL_ID" \
--username "$EMAIL" \
--password "$PASSWORD" \
--permanent

echo "User created with email (used as username): $EMAIL"

# Insert ContactInfo record into DynamoDB
aws dynamodb put-item --table-name "$DYNAMODB_TABLE" --item \
'{"pk": {"S": "'"$EMAIL"'"},
"sk": {"S": "ContactInfo"},
"email": {"S": "'"$EMAIL"'"},
"fullName": {"S": "'"$FULL_NAME"'"},
"GSI1pk": {"S": "'"$GSI1PK"'"},
"GSI1sk": {"S": "'"$EMAIL"'"} }'

echo "ContactInfo record created for user: $EMAIL"

# Insert Roles record into DynamoDB
aws dynamodb put-item --table-name "$DYNAMODB_TABLE" --item \
'{"pk": {"S": "'"$EMAIL"'"},
"sk": {"S": "v0#'"$ROLE"'#'"$TERRITORY"'"},
"date": {"N": "'"$DATE"'"},
"doneByEmail": {"S": "'"$EMAIL"'"},
"doneByName": {"S": "'"$FULL_NAME"'"},
"email": {"S": "'"$EMAIL"'"},
"fullName": {"S": "'"$FULL_NAME"'"},
"GSI1pk": {"S": "'"$GSI1PK"'"},
"GSI1sk": {"S": "'"$GSI1SK"'"},
"GSI2pk": {"S": "'"$ROLE"'#'"$TERRITORY"'"},
"GSI2sk": {"S": "active"},
"Latest": {"S": "1"},
"role": {"S": "'"$ROLE"'"},
"status": {"S": "active"},
"territory": {"S": "'"$TERRITORY"'"} }'

echo "Roles record created for user: $EMAIL"
done
41 changes: 41 additions & 0 deletions services/admin/scripts/delete_packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Variables
DYNAMODB_TABLE="onemac-masterclone-one"
PK_VALUES=("NY-24-9356" "NY-24-6035" "NY-24-3865" "NY-24-1282" "NY-24-1036" "NY-24-9253" "NY-24-9972" "NY-24-1717" "NY-24-5342" "NY-24-8523" "NY-24-1571" "NY-24-7203" "NY-80815.R01.02" "NY-66338.R01.02" "NY-84734.R01.00" "NY-23214.R01.02" "NY-94872.R00.00" "NY-93400.R00.00" "NY-72598.R01.02" "NY-84074.R01.00" "NY-49584.R00.01" "NY-52227.R00.00" "NY-27845.R01.00" "NY-95809.R00.01" "NY-53801.R01.02" "NY-38783.R00.01" "NY-75550.R00.01" "NY-92181.R01.00" "NY-18445.R00.00" "NY-57782.R01.00" "NY-52513.R00.00" "NY-99845.R00.01" "NY-76823.R00.01" "NY-42146.R01.02" "NY-52725.R00.00" "NY-14938.R01.00")

# Counter for deleted items
DELETED_COUNT=0

# Loop through each pk value
for PK in "${PK_VALUES[@]}"; do
# Query DynamoDB for items with the specified pk
ITEMS=$(aws dynamodb query \
--table-name "$DYNAMODB_TABLE" \
--key-condition-expression "pk = :pk" \
--expression-attribute-values '{":pk": {"S": "'"$PK"'"}}' \
--projection-expression "pk, sk" \
--output json | jq -c '.Items[]')

# Loop through the found items and delete them
echo "$ITEMS" | while read -r item; do
pk=$(echo "$item" | jq -r '.pk.S')
sk=$(echo "$item" | jq -r '.sk.S')

# Skip if pk or sk is empty
if [[ -z "$pk" || -z "$sk" ]]; then
continue
fi

# Delete the record
aws dynamodb delete-item \
--table-name "$DYNAMODB_TABLE" \
--key "{\"pk\": {\"S\": \"$pk\"}, \"sk\": {\"S\": \"$sk\"}}"

echo "Deleted record with pk: $pk and sk: $sk"
((DELETED_COUNT++))
done
done

# Output the total number of deleted items
echo "Total number of deleted items: $DELETED_COUNT"
Loading
Loading