Skip to content

Commit

Permalink
Main -> Val (#139803)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsummers1 authored Oct 25, 2024
2 parents 96f44cc + f587192 commit a38d456
Show file tree
Hide file tree
Showing 38 changed files with 3,242 additions and 2,246 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: pre-commit/[email protected]
jest-frontend:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -44,4 +48,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRNUM: ${{ github.event.pull_request.number }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
10 changes: 6 additions & 4 deletions services/app-api/handlers/uploads/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ import { UnauthorizedError } from "../../libs/httpErrors";
*/
export const deleteUpload = handler(async (event, _context) => {
const user = getUserCredentialsFromJwt(event);
const body = event.body ? JSON.parse(event.body) : null;
const state = event.pathParameters ? event.pathParameters["state"] : "";
const fileId = event.pathParameters ? event.pathParameters["fileId"] : "";

if (user.role !== AppRoles.STATE_USER || !body || !body.fileId || !state) {
if (user.role !== AppRoles.STATE_USER || !fileId || !state) {
throw new UnauthorizedError("Unauthorized");
}

const decodedFileId = decodeURIComponent(fileId);
// Get file, check aws filename before deleting
const documentParams = {
TableName: process.env.uploadsTableName!,
KeyConditionExpression:
"uploadedState = :uploadedState AND fileId = :fileId",
ExpressionAttributeValues: {
":uploadedState": state,
":fileId": body.fileId,
":fileId": decodedFileId,
},
};
const results = await dynamoDb.query(documentParams);
Expand All @@ -44,7 +46,7 @@ export const deleteUpload = handler(async (event, _context) => {
TableName: process.env.uploadsTableName!,
Key: {
uploadedState: state,
fileId: body.fileId,
fileId: decodedFileId,
},
};

Expand Down
3 changes: 1 addition & 2 deletions services/app-api/handlers/uploads/tests/delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ describe("Test Delete Upload Handler", () => {
test("Should Call S3 delete when entry exists", async () => {
const event: APIGatewayProxyEvent = {
...testEvent,
body: `{"fileId": "uniqueIdString"}`,
pathParameters: { year: "2022", state: "AL" },
pathParameters: { year: "2022", state: "AL", fileId: "uniqueIdString" },
};

const res = await deleteUpload(event, null);
Expand Down
2 changes: 1 addition & 1 deletion services/app-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"aws-jwt-verify": "^3.1.0",
"dompurify": "^3.1.4",
"jsdom": "^24.1.0",
"jsonpath-plus": "^10.0.0",
"jsonpath-plus": "^10.0.7",
"jsonschema": "^1.4.1",
"jwt-decode": "^3.1.2",
"uuid": "^7.0.3"
Expand Down
2 changes: 1 addition & 1 deletion services/app-api/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ functions:
handler: handlers/uploads/delete.deleteUpload
events:
- http:
path: uploads/{year}/{state}
path: uploads/{year}/{state}/{fileId}
method: delete
cors: true
authorizer: aws_iam
Expand Down
11 changes: 7 additions & 4 deletions services/app-api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,9 @@
version "3.1.5"
resolved "https://registry.yarnpkg.com/@smithy/abort-controller/-/abort-controller-3.1.5.tgz#ca7a86a3c6b20fabe59667143f58d9e198616d14"
integrity sha512-DhNPnqTqPoG8aZ5dWkFOgsuY+i0GQ3CI6hMmvCoduNsnU9gUZWZBwGfDQsTTB7NvFPkom1df7jMIJWU90kuXXg==
dependencies:
"@smithy/types" "^3.5.0"
tslib "^2.6.2"

"@smithy/chunked-blob-reader-native@^3.0.0":
version "3.0.0"
Expand Down Expand Up @@ -3504,10 +3507,10 @@ jsonfile@^4.0.0:
optionalDependencies:
graceful-fs "^4.1.6"

jsonpath-plus@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-10.0.0.tgz#7a747d47e20a27867dbbc80b57fd554788b91474"
integrity sha512-v7j76HGp/ibKlXYeZ7UrfCLSNDaBWuJMA0GaMjA4sZJtCtY89qgPyToDDcl2zdeHh4B5q/B3g2pQdW76fOg/dA==
jsonpath-plus@^10.0.7:
version "10.1.0"
resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-10.1.0.tgz#e8724c721ac60ff2db667066131b1a2c992ffcf0"
integrity sha512-gHfV1IYqH8uJHYVTs8BJX1XKy2/rR93+f8QQi0xhx95aCiXn1ettYAd5T+7FU6wfqyDoX/wy0pm/fL3jOKJ9Lg==
dependencies:
"@jsep-plugin/assignment" "^1.2.1"
"@jsep-plugin/regex" "^1.0.3"
Expand Down
16 changes: 16 additions & 0 deletions services/database/data/seed-local/seed-acs.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,22 @@
"percentUninsured": 2.0,
"percentUninsuredMoe": 0.3
},
{
"stateId": "AL",
"year": 2021,
"numberUninsured": 26000,
"numberUninsuredMoe": 4000,
"percentUninsured": 2.2,
"percentUninsuredMoe": 0.4
},
{
"stateId": "AL",
"year": 2022,
"numberUninsured": 22000,
"numberUninsuredMoe": 4000,
"percentUninsured": 1.9,
"percentUninsuredMoe": 0.3
},
{
"stateId": "AK",
"year": 2015,
Expand Down
Loading

0 comments on commit a38d456

Please sign in to comment.