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

Add file upload api #267

Merged
merged 75 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
703f4fc
Add minio to docker-compose for local dev
Jan 13, 2021
a41b773
Add handler for file upload endpoint
Jan 13, 2021
6881b4e
add POST /files endpoint to upload files to s3
Jan 13, 2021
d8cdb09
fmt
Jan 13, 2021
788d8ef
fmt
Jan 13, 2021
ed89a9d
Add model, migrations and seeders for File
Jan 14, 2021
237e764
Add db logic to handler.js for file upload
Jan 14, 2021
cb0e6bf
Move s3Uploader to lib/s3Uploader.js
Jan 15, 2021
8e30cac
update branch with latest from main
Jan 15, 2021
d45bbd4
Add first test
Jan 15, 2021
6a4050a
Add versioning tests
Jan 18, 2021
d0b267c
Add s3 Uploader test
Jan 18, 2021
58ff705
update .env.example
Jan 18, 2021
8378bc4
remove debugging statement
Jan 18, 2021
61d8165
Update files model
Jan 19, 2021
630680b
Merge remote-tracking branch 'origin/js-saving-activity-report-fronte…
Jan 19, 2021
d2cff7f
update create-files migration
Jan 19, 2021
9b71eaf
update files/handlers.js to update
Jan 19, 2021
386086f
merge in main
Jan 19, 2021
f8ca042
merge main
Jan 19, 2021
9a22bd3
merge main
Jan 19, 2021
e0ae000
fix merge
Jan 19, 2021
61b57f0
Merge branch 'main' into add-file-upload-api
Jan 19, 2021
59be6bb
merge main
Jan 19, 2021
345db1a
merge main
Jan 19, 2021
e27bb8b
merge main
Jan 19, 2021
8774025
merge main
Jan 19, 2021
168b6d8
update .env.example for non-docker development
Jan 19, 2021
fea7f25
update deps
Jan 19, 2021
9e9b0b4
fmt
Jan 19, 2021
39ab0fe
add openapi documenetation
Jan 19, 2021
cddd72c
update openapi docs for file upload endpoint
Jan 19, 2021
396437d
Add testfile for testing uploads
Jan 20, 2021
335f13e
Add model tests for File upload
Jan 20, 2021
f0e7e33
Add non-happy path tests to routes/files/handers
Jan 21, 2021
096b8cc
update handlers.test.js
Jan 21, 2021
e5265ab
merge main into add-file-upload-api`
Jan 21, 2021
b676dc2
update yarn.lock
Jan 21, 2021
de05f37
merge main into add-file-upload-api
Jan 21, 2021
76bef22
merge main into add-file-upload-api
Jan 21, 2021
9fc044e
fmt
Jan 21, 2021
2d782ea
add bypassauth for tests
Jan 21, 2021
6d43c5c
fmt
Jan 21, 2021
488abe3
Fix merge conflicts
Jan 21, 2021
25d3c96
add attachmentType to file upload api
Jan 21, 2021
41d4762
update openapi documentation
Jan 21, 2021
b603c49
update openapi docs
Jan 22, 2021
8d0ec3e
update .env.example and handlers.js
Jan 22, 2021
5bc0575
fix test
Jan 22, 2021
4c32383
update README and .env.example
Jan 22, 2021
ef551f5
Output logs in json format
rahearn Jan 25, 2021
a242b9c
Update production URLs
rahearn Jan 25, 2021
5d1b75e
Add actual topics
jasalisbury Jan 25, 2021
87d7cbc
Merge branch 'main' into add-file-upload-api
Jan 25, 2021
53826cf
Update README.md
dcmcand Jan 25, 2021
ae110b2
Merge pull request #119 from adhocteam/add-file-upload-api
dcmcand Jan 25, 2021
22d8506
Merge branch 'main' into js-235-add-topics
jasalisbury Jan 25, 2021
58a854f
Merge pull request #129 from adhocteam/js-235-add-topics
jasalisbury Jan 26, 2021
aa912bc
Merge branch 'main' into update-deployed-env-vars
rahearn Jan 26, 2021
eb70469
Add user management workflow diagrams
rahearn Jan 15, 2021
0551a81
Move rds & s3 inside of accreditation boundary
rahearn Jan 26, 2021
4eeb54a
The file attachment migration drops the file enum type
jasalisbury Jan 26, 2021
aab85eb
Set sandbox branch
jasalisbury Jan 26, 2021
2c03fe8
update file upload api
Jan 26, 2021
570207e
Merge pull request #131 from adhocteam/js-drop-attachment-enum
jasalisbury Jan 26, 2021
8b070ef
Merge branch 'main' into update-deployed-env-vars
rahearn Jan 27, 2021
89ec60d
Merge pull request #128 from HHS/update-deployed-env-vars
rahearn Jan 27, 2021
1232a3f
Cleanup s3 variables
Jan 27, 2021
1e009d2
update file upload api
Jan 26, 2021
3a38aa3
Cleanup s3 variables
Jan 27, 2021
99005ad
Merge branch 'cm-pr-267-add-file-upload-api' of github.com:adhocteam/…
Jan 27, 2021
04bbf74
Update src/lib/s3Uploader.js
dcmcand Jan 27, 2021
9618281
update s3uploader.js
Jan 27, 2021
17ea941
Merge branch 'cm-pr-267-add-file-upload-api' of github.com:adhocteam/…
Jan 27, 2021
3cff2f4
Merge pull request #132 from adhocteam/cm-pr-267-add-file-upload-api
dcmcand Jan 27, 2021
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ parameters:
default: "main"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "js-135-submit-report"
default: "js-drop-attachment-enum"
type: string
jobs:
build_and_lint:
Expand Down
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,14 @@ HSES_DATA_PASSWORD=password
# In production, Sequelize instance is created with a postgres URI.
# This URI is automatically dropped into the cloud.gov environment as the env variable DATABASE_URL
DATABASE_URL=secret
# Local development variables to support s3 endpoint development and testing
# Comment this out if you are not using docker
S3_ENDPOINT=http://minio:9000
# Uncomment the following if you aren't using docker for development. Note: This requires minio to be running locally on port 9000
## and manually creating the bucket specified in $S3_BUCKET
# S3_ENDPOINT=http://localhost:9000
S3_BUCKET=ttadp-test
AWS_SECRET_ACCESS_KEY=EXAMPLESECRETKEY
AWS_ACCESS_KEY_ID=EXAMPLEID
MINIO_ROOT_PASSWORD=EXAMPLESECRETKEY
MINIO_ROOT_USER=EXAMPLEID
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For the latest on our product mission, goals, initiatives, and KPIs, see the [Pr
7. Optionally, set `CURRENT_USER` to your current user's uid:gid. This will cause files created by docker compose to be owned by your user instead of root.
8. Run `yarn docker:db:migrate` to run DB migrations
9. Run `yarn docker:db:seed` to seed the database with test data.
10. Run `yarn docker:start` to start the application. The frontend will be available on `localhost:3000` and the backend will run on `localhost:8080`.
10. Run `yarn docker:start` to start the application. The frontend will be available on `localhost:3000` and the backend will run on `localhost:8080` and minio will run on `localhost:9000`.
11. Run `yarn docker:stop` to stop the servers and remove the docker containers.

The frontend [proxies requests](https://create-react-app.dev/docs/proxying-api-requests-in-development/) to paths it doesn't recognize to the backend.
Expand All @@ -30,9 +30,11 @@ Api documentation uses [Redoc](https://github.com/Redocly/redoc) to serve docume

You can also run build commands directly on your host (without docker). Make sure you install dependencies when changing execution method. You could see some odd errors if you install dependencies for docker and then run yarn commands directly on the host, especially if you are developing on windows. If you want to use the host yarn commands be sure to run `yarn deps:local` before any other yarn commands. Likewise if you want to use docker make sure you run `yarn docker:deps`.

You must also install and run minio locally to use the file upload functionality. Please comment out `S3_ENDPOINT=http://minio:9000` and uncomment `S3_ENDPOINT=http://localhost:9000`

### Running Tests

Run `yarn docker:deps` to install dependencies. Run `yarn docker:db:migrate` and `yarn docker:test` to run all tests for the frontend and backend.
Run `yarn docker:deps` to install dependencies. Run `yarn docker:db:migrate`, `yarn docker:db:seed` and `yarn docker:test` to run all tests for the frontend and backend.

### Docker on Windows

Expand Down
1 change: 1 addition & 0 deletions deployment_config/dev_vars.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env: dev
instances: 1
AUTH_BASE: https://uat.hsesinfo.org
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-dev.app.cloud.gov
rds_instance: ttahub-dev
Expand Down
5 changes: 3 additions & 2 deletions deployment_config/prod_vars.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
env: prod
instances: 2
AUTH_BASE: TKTK
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-prod.app.cloud.gov
REDIRECT_URI_HOST: https://ttahub.ohs.acf.hhs.gov
rds_instance: ttahub-prod
s3_doc_upload_bucket: ttahub-document-upload-prod
TTA_SMART_HUB_URI: https://tta-smarthub-prod.app.cloud.gov
TTA_SMART_HUB_URI: https://ttahub.ohs.acf.hhs.gov
1 change: 1 addition & 0 deletions deployment_config/sandbox_vars.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env: sandbox
instances: 1
AUTH_BASE: https://uat.hsesinfo.org
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-sandbox.app.cloud.gov
rds_instance: ttahub-sandbox
Expand Down
1 change: 1 addition & 0 deletions deployment_config/staging_vars.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env: staging
instances: 1
AUTH_BASE: https://uat.hsesinfo.org
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://tta-smarthub-staging.app.cloud.gov
rds_instance: ttahub-staging
Expand Down
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,20 @@ services:
- "6543:5432"
volumes:
- dbdata:/var/lib/postgresql/data
minio:
image: minio/minio
env_file: .env
ports:
- "9000:9000"
volumes:
- miniodata:/data
command: server /data
aws-cli:
image: amazon/aws-cli
env_file: .env
command: ["--endpoint-url", "$S3_ENDPOINT", "s3api", "create-bucket", "--bucket", "$S3_BUCKET"]


volumes:
dbdata: {}
miniodata: {}
8 changes: 4 additions & 4 deletions docs/boundary_diagram.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
System Boundary Diagram
=======================

<img src="http://www.plantuml.com/plantuml/png/fLPlRnit3t_lJy4dBmeNQE8-IGOKmp3KYTqqGznwERTzKo2GTRGjL2TTHSgkCVIxJrJEPr_S3Hi61B5CaJ-IF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YuPOWHEUCM-PKkh5fgoebrNjZaWLfbHKphvaOLGq_okdMCGQdBAXzcB3mOM-IXo7MKbGwTZIQPnfAeMxgYPS1Yp_lOAHOpHNXhlhteqAEZHb1C-nDgcvXbZ6qlhia_j0dNJJWnGNCe_w2VD8Av5Im3qX0KaeD2-514I7lilZUaz_llSSEwxyjnaMoaezidN9F5eLPEdZlFhl9co6iZOAPgV3qIX6MKbdm0QQt7q6hK7vEMeMFGQFiZfkW72Dc9fB3jisMf1v8APBIO7a_d4nF4_N1hnDWeLIHEwtJzWut0QtHqZouWNivxyWqBlf8CF7Ei0-v5L96IULmGHq0J9HJIuGaJZnNqaJm3AnVBfEfOERL33VZsM3wlaX_Fim6e_7TU3Q6_kNbnVE4BjXDutUG0zO-C06ZnGevR0METTqnFDY--yLHvPZQHlzlOKWJ7Exqqc-Sj6fJRsQbLnKwfWvi1wQDv7Y_rC5_Cp9d-3KYCVtxs8wmMix-1sYBqKwtJ2dbN5iO40JelthvwkMHNTFZ0JaON6FRf4Uy7xWzDbUHL-XOjWKInERjV3zCulFZGZT6QmnciGLJYYLlZvDkNLwPZjDslGHK9GqsmOXNYPYG8Q3seSp9r_JLGl-Noulp7w18hnoZx7QHGAnh3UZAsXl7XqFR39Cqqcvuhsy7roEOcXgjSNWyjVaV6mdxnh1iCLajRujJSHPajylUAn5aRCYmboUc2w1Dq1Qr4L_vU7txPEfbTo-RjLcqZzhH-BUHJEFS6bfbnmALBe3Iz_xvULFgDkf3vxwgakBA-o_WF9k5zEuk8c0lZn0yib6tR6ImFSYJTtw4jVNRpfEJVYXgZKIBQ1ku19oGxjJsOVHaSpnAxvkTdGMlqPMnidy3" alt="rendered boundary diagram">

UML Source
----------
Expand All @@ -23,9 +23,9 @@ Boundary(aws, "AWS GovCloud") {
Boundary(atob, "Accreditation Boundary") {
Container(www_app, "<&layers> TTA Smart Hub Web Application", "NodeJS, Express, React", "Displays and collects TTA data. Multiple instances running")
Container(clamav, "File scanning API", "ClamAV", "Internal application for scanning user uploads")
ContainerDb(www_db, "PostgreSQL Database", "AWS RDS", "Contains content and configuration for TTA Smart Hub")
ContainerDb(www_s3, "AWS S3 bucket", "AWS S3", "Stores static file assets")
}
ContainerDb(www_db, "PostgreSQL Database", "AWS RDS", "Contains content and configuration for TTA Smart Hub")
ContainerDb(www_s3, "AWS S3 bucket", "AWS S3", "Stores static file assets")
}
}
System(HSES, "HSES", "Single Sign On\nMFA via Time-Based App or PIV card\n\nSource of Grantee Data")
Expand Down Expand Up @@ -59,7 +59,7 @@ Lay_R(HSES, aws)
Instructions
------------

1. [Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/fLPlRnit3t_lJy4dBmeNQE8-IGOKmp3KYTqqGznwERTzKo2GTRGjL2TTHSgkCVIxJrJEPr_S3Hi61B5CaJ-IF_wHNnEhmB6olVyPfsqi4LRCDVqy60IrELiQNiLv90pQEqR7PzfN0rK6ezpQnZeEhYzFfrOv_Z2v6rZ5I9n43zT9Mnc7uQmMR3Pi4MQp8HHLSWTlunpcFhfIXIsi3MvwKmpaNR_E7mxj2pZPgtuW32T9CdI0hZoLSC0lW5TFC4-Uxt1ANAFr2Qs3Czf9JphYTGBr0LeR0kLAk9bD4fxpZA08naw7RSt6ktT9qXjQ2re2rIAYP5iRpLY22WYOTUNR9j47ixi2_dzs3j5P90AVmWuRGmY2NPxralTyx5qrZFJLXYJRJmNS-FMrzR4yUGv_z01Q3It2fLydjNmyI-T61w3O4cFrCFx6WlIWxFnG3QnNvUbSMULqOg9nDBoxIjbshLil3wes7OZXzFPlj8EFd9d_vPbLMmpqA-nD7oz9_ERCu8ta5BR0GIqMHWDXM1kD3VwU4_QInb3hWALX9Rotjstg06tdzJURJGgyxiJHRS5FE8TXNLkZCvp4zCwN-5ln0iRVwe2Kod2FIhFSZ0pL2UQnERIt5ZLJ1YmLgpEOHCkcjWZ64Gkt124wPzmofzADJLjLAQdU6vCiIAkic7dDnAXg-55EjuunE6L1xSE4XGzxapmCiPQYKkFeUw_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Noulp7w18hnoZx7QHGAnh3UZAsXl7XqFR39Cqqcvuhsy7roEOcXgjSNWyjVaV6mdxnh1iCLajRujJSHPajylUAn5aRCYmboUc2w1Dq1Qr4L_vU7txPEfbTo-RjLcqZzhH-BUHJEFS6bfbnmALBe3Iz_xvULFgDkf3vxwgakBA-o_WF9k5zEuk8c0lZn0yib6tR6ImFSYJTtw4jVNRpfEJVYXgZKIBQ1ku19oGxjJsOVHaSpnAxvkTdGMlqPMnidy3)
1. Copy and paste the final UML into the UML Source section
1. Update the img src and edit link target to the current values

Expand Down
23 changes: 23 additions & 0 deletions docs/openapi/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,29 @@ components:
type: number
name:
type: string
fileUpload:
type: object
properties:
attachmentType:
type: string
description: "Type of attachment. Acceptable values are ATTACHMENT or RESOURCE"
reportId:
type: number
description: "id of the Activity report the file is associated with"
file:
type: string
format: binary
description: "File to be uploaded"
required:
- attachmentType
- reportId
- File
fileResponse:
type: object
description: ID of file created
properties:
id:
type: number
permission:
type: object
description: A combination of region, scope and user allowing that user to perform an action in a region
Expand Down
20 changes: 20 additions & 0 deletions docs/openapi/paths/files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
post:
tags:
- files
operationId: postFile
description: Upload a file to s3
requestBody:
description: upload a file for an Activity Report
required: true
content:
multipart/form-data:
schema:
$ref: '../index.yaml#/components/schemas/fileUpload'
responses:
200:
description: Returns the id of the uploaded file
content:
application/json:
schema:
type: object
$ref: '../index.yaml#/components/schemas/fileResponse'
2 changes: 2 additions & 0 deletions docs/openapi/paths/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@
$ref: './activity-reports/activity-reports-id.yaml'
'/activity-reports/{activityReportId}/submit':
$ref: './activity-reports/submit.yaml'
'/files':
$ref: './files.yaml'
100 changes: 100 additions & 0 deletions docs/workflow_diagrams.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Workflow Diagrams
=================

Collection of various workflows and processes present in the TTA Smart Hub application.

Account Creation
----------------

<img src="http://www.plantuml.com/plantuml/png/dP91JyCm38Nl_HNcjlq5Tc0W8OtpDkvMwgtMqcJ4piR-FKcAKPd4XLkL-dtlvSLhKKoQHzyzd1CUHuGiz4v9sQ5_Eq0CNPle7lT22Nmy2d202oDijg_RLSS7MBHV0qex0dGkvg1FIz210Ynk9CiEO0AmGAAU4pcb7ZJ2RlUysR_0bNMeIX8ffoSAgo8nTbNvw4xKtqCDEsPH40fzeNza4fsXuvaIQamL33bKa6LSDOHeF9SFyaBpsvY-o4SMuHW4XFJF27YhzTHsiEIuC5qXaOkfbohWz0k4tiVhP5zIVxl38iG9QJaiAD0dYygFjysPkOrn8MUD8xRtypTmYL2fhqxcKNERCH_-K-A05xglfJWOS2fqTg4vtz2Mk0KiaBO17AQjCiQw4FFelm00" alt="rendered account creation diagram">

### UML Source

```
@startuml
!pragma useVerticalIf on
start
:User logs in via HSES;
if (User has HSES account?) then (yes)
:User is redirected to TTAHUB with access token;
if (User is locked?) then (yes)
:User must send request to TTAHUB operators to unlock account;
stop
elseif (User has TTAHUB permissions set?) then (yes)
:User may log in and view records their permissions allow;
end
else (no)
if (User account exists?) then (no)
:User account is automatically created;
else (yes)
endif
:User must send request to TTAHUB operators to have permissions set;
endif
stop
else (no)
:User must request account creation within HSES;
stop
@enduml
```

[Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/dP91JyCm38Nl_HNcjlq5Tc0W8OtpDkvMwgtMqcJ4piR-FKcAKPd4XLkL-dtlvSLhKKoQHzyzd1CUHuGiz4v9sQ5_Eq0CNPle7lT22Nmy2d202oDijg_RLSS7MBHV0qex0dGkvg1FIz210Ynk9CiEO0AmGAAU4pcb7ZJ2RlUysR_0bNMeIX8ffoSAgo8nTbNvw4xKtqCDEsPH40fzeNza4fsXuvaIQamL33bKa6LSDOHeF9SFyaBpsvY-o4SMuHW4XFJF27YhzTHsiEIuC5qXaOkfbohWz0k4tiVhP5zIVxl38iG9QJaiAD0dYygFjysPkOrn8MUD8xRtypTmYL2fhqxcKNERCH_-K-A05xglfJWOS2fqTg4vtz2Mk0KiaBO17AQjCiQw4FFelm00)

Account Termination
-------------------

<img src="http://www.plantuml.com/plantuml/png/XOynQeP048NxFSKhjKkQ49BYzm2f0XvWq56NpEx8pgxYxRCA5e64DCFmU7mVhxDCAPSWxdfSufKfu-sJDyyxYd423OEMcD-Tdz3qPo9a6QBpp2DyHD34o0j5FBy-OQJ3GBC-sffnH7EmjQuIWsuC4i7AANWphz4m9GteVsXOZFzNlVnf-j3XwnSacgYjupZwwPwvBrvgVaBlhY4hqhN-SRLTLqy9yWq0" alt="rendered account termination diagram">

### UML Source

```
@startuml
start
repeat :Review user account;
if (User last logged in more than 180 days ago?) then (yes)
:Remove all permissions from User account;
elseif (User last logged in more than 60 days ago?) then (yes)
:Lock User account;
else (no)
endif
repeat while (more accounts to review?)
end
@enduml
```

[Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/XOynQeP048NxFSKhjKkQ49BYzm2f0XvWq56NpEx8pgxYxRCA5e64DCFmU7mVhxDCAPSWxdfSufKfu-sJDyyxYd423OEMcD-Tdz3qPo9a6QBpp2DyHD34o0j5FBy-OQJ3GBC-sffnH7EmjQuIWsuC4i7AANWphz4m9GteVsXOZFzNlVnf-j3XwnSacgYjupZwwPwvBrvgVaBlhY4hqhN-SRLTLqy9yWq0)


Setting Permissions
-------------------

<img src="http://www.plantuml.com/plantuml/png/ZP11JWCn34NtESNVCRt2T44hRa3R0qIfPuZ8s60x86wF9niaLjrOzlzVxqi-cMVrlhKqbZIVIv7EZYrpNacXz5Nfsz0jZW_IhPfLuT0_EvaVKrqmtNQp6ZAkrpDUX5rpST7d0_oD6DCFsI41yuNyFycGerBlbLUu3FV9eD88esQDJ6wuU5wMFVCgvgJ7HCq84yk3t4Bi6XpHFwO4iT3e2XxVwvBc6pSfxmCsj7IA4V_v1G00" alt="setting access permissions diagram">

### UML Source

```
@startuml
start
:Account manager reviews user permission request;
if (User is a TTA Contractor?) then (yes)
:Set user permissions according to user's role on regional Staffing Roster;
else (no)
:Set user permissions according to central or regional office role;
endif
:Unlock user;
end
@enduml
```

[Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/ZP11JWCn34NtESNVCRt2T44hRa3R0qIfPuZ8s60x86wF9niaLjrOzlzVxqi-cMVrlhKqbZIVIv7EZYrpNacXz5Nfsz0jZW_IhPfLuT0_EvaVKrqmtNQp6ZAkrpDUX5rpST7d0_oD6DCFsI41yuNyFycGerBlbLUu3FV9eD88esQDJ6wuU5wMFVCgvgJ7HCq84yk3t4Bi6XpHFwO4iT3e2XxVwvBc6pSfxmCsj7IA4V_v1G00)

--------------------------------------------------------------------------------

### Instructions

1. Edit each diagram using the relevant link
1. Copy and paste the final UML into the UML Source section
1. Update the img src and edit link target to the current values

### Notes

* See the help docs for [PlantUML Activity Diagrams](https://plantuml.com/activity-diagram-beta) for syntax help.
36 changes: 34 additions & 2 deletions frontend/src/pages/ActivityReport/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,38 @@ export const programTypes = [
];

export const topics = [
'first',
'second',
'Behavioral / Mental Health',
'Child Assessment, Development, Screening',
'CLASS: Classroom Management',
'CLASS: Emotional Support',
'CLASS: Instructional Support',
'Coaching',
'Communication',
'Community and Self-Assessment',
'Culture & Language',
'Curriculum (Early Childhood or Parenting)',
'Data and Evaluation',
'ERSEA',
'Environmental Health and Safety',
'Facilities',
'Family Support Services',
'Fiscal / Budget',
'Five-Year Grant',
'Human Resources',
'Leadership / Governance',
'Learning Environments',
'Nutrition',
'Oral Health',
'Parent and Family Engagement',
'Partnerships and Community Engagement',
'Physical Health and Screenings',
'Pregnancy Services / Expectant Families',
'Program Planning and Services',
'QIP',
'Recordkeeping and Reporting',
'Safety Practices',
'Teaching Practices / Teacher-Child Interactions',
'Technology and Information Systems',
'Transition Practices',
'Transportation',
];
3 changes: 2 additions & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ applications:
buildpacks:
- nodejs_buildpack
env:
AUTH_BASE: https://uat.hsesinfo.org
AUTH_BASE: ((AUTH_BASE))
AUTH_CLIENT_ID: ((AUTH_CLIENT_ID))
AUTH_CLIENT_SECRET: ((AUTH_CLIENT_SECRET))
LOG_JSON_FORMAT: "true"
NEW_RELIC_APP_NAME: tta-smarthub-((env))
NEW_RELIC_LICENSE_KEY: ((NEW_RELIC_LICENSE_KEY))
NODE_ENV: production
Expand Down
Loading