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

Saving an activity report #254

Merged
merged 43 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4b4333a
begin ar
SarahJaine Dec 3, 2020
fa7b032
add ar validation checkRequiredForSubmission
SarahJaine Dec 3, 2020
05b1d98
first pass at secondary tables
SarahJaine Dec 4, 2020
e550671
remove multiselects
SarahJaine Dec 8, 2020
fddb56b
stash
jasalisbury Dec 23, 2020
cab758e
merge main
SarahJaine Dec 23, 2020
7d4965d
nongrantee extends
SarahJaine Dec 30, 2020
521661d
Merge branch 'main' into sj-activity-report
jasalisbury Jan 6, 2021
2d5378e
Merge branch 'main' into stash--saving-pt-2
jasalisbury Jan 6, 2021
c93c902
Merge branch 'main' into sj-activity-report
jasalisbury Jan 6, 2021
7234e1b
Merge branch 'stash--saving-pt-2' into sj-activity-report
jasalisbury Jan 7, 2021
5df666a
Add activity report endpoints
jasalisbury Jan 13, 2021
6879d12
Merge branch 'main' into sj-activity-report
jasalisbury Jan 13, 2021
432110d
Moving around seeders
jasalisbury Jan 13, 2021
fa1f120
Fix test
jasalisbury Jan 13, 2021
04e2024
Change express-session to cookie-session
kryswisnaskas Jan 14, 2021
9c5b32c
Change express-session to cookie-session
kryswisnaskas Jan 14, 2021
7affa8f
Fix axe/cucumber/backend tests
jasalisbury Jan 14, 2021
5b7043c
Merge branch 'main' into sj-activity-report
jasalisbury Jan 14, 2021
293ef60
Revert "stash"
jasalisbury Jan 14, 2021
36b176b
Continuing to revert frontend changes
jasalisbury Jan 14, 2021
471a66d
Merge branch 'sj-activity-report' of github.com:adhocteam/Head-Start-…
jasalisbury Jan 14, 2021
59c2547
Revert last of the frontend changes
jasalisbury Jan 14, 2021
203feae
Add grant fields that had been removed
jasalisbury Jan 14, 2021
244742a
Modify cookie options
kryswisnaskas Jan 14, 2021
ae11a30
Merge branch 'main' into kw-session-store
kryswisnaskas Jan 14, 2021
534cfb2
Remove unneeded code
kryswisnaskas Jan 15, 2021
b4b283b
Merge branch 'kw-session-store' of https://github.com/adhocteam/Head-…
kryswisnaskas Jan 15, 2021
ef0cfba
Move DB access layer to `services`. fix typo
jasalisbury Jan 15, 2021
270b8b2
Merge pull request #102 from adhocteam/sj-activity-report
jasalisbury Jan 15, 2021
f62c137
Add activity reports/participants and nongrantees to model
jasalisbury Jan 15, 2021
7e08de6
Merge pull request #115 from adhocteam/js-update-data-model
jasalisbury Jan 15, 2021
fc3fb8d
Change db operations order for dev & sandbox deploy
rahearn Jan 15, 2021
a7406ff
Merge branch 'main' into dev-deploy-migration-fix
rahearn Jan 15, 2021
9d5aa04
Merge pull request #117 from HHS/dev-deploy-migration-fix
rahearn Jan 15, 2021
36898a7
Rename "activityParticipant" to "activityRecipient"
jasalisbury Jan 18, 2021
6c331e6
Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP …
kryswisnaskas Jan 19, 2021
6020468
Updated comment
kryswisnaskas Jan 19, 2021
53e58d7
Merge pull request #114 from adhocteam/kw-session-store
kryswisnaskas Jan 19, 2021
835fa12
Merge branch 'main' into js-saving-activity-report-feedback
kryswisnaskas Jan 19, 2021
664ebc1
Add descriptions to api doc models
jasalisbury Jan 19, 2021
fc133b5
Update summary of endpoints in API docs. Update activity-recipients
jasalisbury Jan 19, 2021
5d3c525
Merge pull request #120 from adhocteam/js-saving-activity-report-feed…
jasalisbury Jan 19, 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ jobs:
name: Return database to neutral, then migrate and seed
command: |
cf run-task tta-smarthub-sandbox \
"yarn db:seed:undo:prod && yarn db:migrate:undo:prod && yarn db:migrate:prod && yarn db:seed:prod"
"yarn db:migrate:undo:prod && yarn db:migrate:prod && yarn db:seed:prod"
- when: # dev
condition:
and:
Expand All @@ -347,7 +347,7 @@ jobs:
- run:
name: Undo database seeding, then migrate and seed
command: |
cf run-task tta-smarthub-dev "yarn db:seed:undo:prod && yarn db:migrate:prod && yarn db:seed:prod"
cf run-task tta-smarthub-dev "yarn db:migrate:prod && yarn db:seed:undo:prod && yarn db:seed:prod"
- when: # staging
condition:
and:
Expand Down
52 changes: 50 additions & 2 deletions docs/logical_data_model.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
Logical Data Model
==================

<img src="http://www.plantuml.com/plantuml/png/nLL1Jzmy4BtdLypj-uh47jeRGeYMBXKNX83-06yyPAtQ7dSyAK8i_xrnBAp0BjJQLEebgppFl9dtPh8-ZQ9OUcUR_q3z8gCXCAqikWZtHjQWV6THGyjq7-4EKPhum_YWM3cmngCy10HYMLFJj5R52DyZCZms00Smi1s1yOBT01qVT-YHbQ0-EHcErn5ZYhr8GL7O-6v0lN8uVGzhydZPknNo53u0TChOAIH6B1u1-jubTd9uZPqXVp5fulzF7p_0zV9yURsyF5lUGEXNrhIB71WNHe_KBMFgyhCCYM8SHb4kZ2Tzq3jEdfwbPvuQyGUlX1QAcvO2xiC0e36sR88OyWMT9USAsPaOgoNr4Rd2xJJquZNlEQEOVAf86_ty6vFzsG_OafaurhX18RqawoQpwDbCNntAclGKuLpc2-c7bt0CWtPy2pyZZGMVAPJihlLxRsLlAPYsFgUKoNbLcyLaQuQTMCki9T5Vw3_bZ5tCNv1lf6oT1m13glHnYYJ2EtuLPk8vaxjnYYMk4ULMr9LLQQ5MH1QLdzVnAFozjhlXhCBqHF6lJ6Vb1IltTNwbD-jiNK_x_gjrML2Dwpao9sujL49OlYh1LqBHwsrqjZ5f1Ie-v7q4lhIcDYzbxRF3-tgHhZJOR0xf4V94C_94XuURnyazskJhVHlFMRiEo9RuyQjfnYSyRKOeDTv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p4V-7AKUXLFIOBKTIuJXvN-9fb0mR4fGlSfL_PZwPv5AnQ1yt7zVnPP-Fu5HhpRy0">

UML Source
----------

```
@startuml
scale 0.75

' avoid problems with angled crows feet
skinparam linetype ortho

Expand Down Expand Up @@ -121,6 +123,47 @@ class GrantGoal {
* updatedAt : timestamp
}

class NonGrantee {
* id : integer <<generated>>
* name : string
* createdAt : timestamp
* updatedAt : timestamp
}

class ActivityReport {
* id : integer <<generated>>
resourcesUsed : string
additionalNotes : string
numberOfParticipants : integer
deliveryMethod : string
duration : decimal
endDate : date
startDate : date
participantType : string
requester : string
* status : string
programTypes : array<string>
targetPopulations : array<string>
reason : array<string>
participants : array<string>
topics : array<string>
ttaType : array<string>
pageState : json
* userId : integer(32) REFERENCES public.Users.id
* lastUpdatedById : integer(32) REFERENCES public.Users.id
* createdAt : timestamp
* updatedAt : timestamp
}

class ActivityParticipant {
* id : integer <<generated>>
* activityReportId : integer(32) REFERENCES public.ActivityReport.id
grantId : integer(32) REFERENCES public.Grant.id
nonGranteeId : integer(32) REFERENCES public.NonGrantee.id
* createdAt : timestamp
* updatedAt : timestamp
}

User ||-o{ Region
User }o--|{ Permission
Scope }o--|{ Permission
Expand All @@ -135,13 +178,18 @@ Topic .. TopicGoal
Goal .. TopicGoal
Grantee ||--|{ Grant
Region ||--|{ Grant

User ||-o{ ActivityReport
ActivityReport ||-o{ ActivityParticipant
Grant ||-{ ActivityParticipant
NonGrantee ||-{ ActivityParticipant
@enduml
```

Instructions
------------

1. [Edit this diagram with plantuml.com](http://www.plantuml.com/plantuml/uml/nLL1Jzmy4BtdLypj-uh47jeRGeYMBXKNX83-06yyPAtQ7dSyAK8i_xrnBAp0BjJQLEebgppFl9dtPh8-ZQ9OUcUR_q3z8gCXCAqikWZtHjQWV6THGyjq7-4EKPhum_YWM3cmngCy10HYMLFJj5R52DyZCZms00Smi1s1yOBT01qVT-YHbQ0-EHcErn5ZYhr8GL7O-6v0lN8uVGzhydZPknNo53u0TChOAIH6B1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rCLqWlwCqPHm84LXo6uP8J7XBpznq-4ferrOIXoq0NxDS6Xa5jK4q8DsaZjEolTPsSx0La1vJV2lIIJg6GhrEh_HYdPFhwTnJhKa3bR2UF5FWYQ0YGloRP7WsA3XrYauc9agWO2EVCs1EJMbSYZfBmnEuMA1BNPzvWKye_QbcVQTvjmAFn2Nb2GAsL7TliEmEaahfU759iq26J5L9w7_UBYMnhhMFJ6TxGO7HTq2xFqvkDjNsrw62MbjfCZN6uJBPzf0_rhhUUHYvBP-_34ztWoTiIDeO7t5997UNoHgfO4aDy19zQxeUntm8P41tOiZw6ubB1-AeWMMQPoHZ0sjE9FmLq9tzjZ8oy4tIpUVTMuCdIt4WahBj83CD5_IRYpur_gPZ8eMuVjiMn1tt-0IY8j5Ylx_01v4kW8GyuiN5_c7mxAwwr-i8dgB636Xw_-wIhT8hwt7VGV6SgrB_lLj_WbVnvmHDAMSp4V-7AKUXLFIOBKTIuJXvN-9fb0mR4fGlSfL_PZwPv5AnQ1yt7zVnPP-Fu5HhpRy0)
2. Copy and paste the final UML into the UML Source section
3. Update the img src and edit link target to the current values

Expand Down
117 changes: 108 additions & 9 deletions docs/openapi/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,123 @@ paths:
$ref: "./paths/index.yaml"
components:
schemas:
activityReport:
type: object
description: >
This object represents a report on an activity that a specialist has completed
with 1 to many grants or non-grantees
properties:
id:
type: number
userId:
type: number
description: The id of the author of the report
lastUpdatedById:
type: number
description: The id of the last user to update the report
resourcesUsed:
type: string
description: A list of URLs used in the activity
additionalNotes:
type: string
description: >
Any additional info user's wish to convey about the report that is not
captured elsewhere
numberOfParticipants:
type: number
description: The number of people present at the activity
deliveryMethod:
type: string
description: How the activity was connected, virtual vs in person
duration:
type: number
description: How long the activity took to complete, in hours
endDate:
type: string
startDate:
type: string
activityRecipientType:
type: string
description: The recipient type for the report, grant or non-grantee
requester:
type: string
description: Who requested the TTA, grantee or regional office
programTypes:
type: array
description: The type of grantee program, Head Start, Early Head Start, etc...
items:
type: string
targetPopulations:
type: array
description: The target of the activity report
items:
type: string
reason:
type: array
description: Why the activity was conducted
items:
type: string
participants:
type: array
description: The roles of the people attending the TTA
items:
type: string
topics:
type: array
description: Topics covered during the TTA
items:
type: string
pageState:
type: object
enum: ['Not Started', 'In progress', 'Completed']
description: The state of each page of the form
properties:
1:
type: string
2:
type: string
3:
type: string
4:
type: string
status:
type: string
enum: ['draft', 'submitted']
description: The current state of the report
ttaType:
type: array
description: The type of the activity, Training or Technical Assistance (or both)
items:
type: string
approvingUser:
type: object
description: Users with permission to approve reports
properties:
id:
type: number
name:
type: string
activityRecipient:
type: object
description: A grant or non-grantee that can be added to an activity report
properties:
activityRecipientId:
type: number
name:
type: string
permission:
type: object
description: A combination of region, scope and user allowing that user to perform an action in a region
properties:
userId:
type: number
scopeId:
type: number
regionId:
type: number
user:
type: object
description: A TTA Smart Hub user
properties:
id:
type: number
Expand All @@ -44,12 +152,3 @@ components:
type: array
items:
$ref: '#/components/schemas/permission'
permission:
type: object
properties:
userId:
type: number
scopeId:
type: number
regionId:
type: number
23 changes: 23 additions & 0 deletions docs/openapi/paths/activity-reports/activity-recipients.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
get:
tags:
- activity-reports
summary: >
Potential activity report participants
description: >
An activity recipient is either a grant or nonGrantee.
responses:
200:
description: The possible activity recipients
content:
application/json:
schema:
type: object
properties:
grants:
type: array
items:
$ref: '../../index.yaml#/components/schemas/activityRecipient'
nonGrantees:
type: array
items:
$ref: '../../index.yaml#/components/schemas/activityRecipient'
41 changes: 41 additions & 0 deletions docs/openapi/paths/activity-reports/activity-reports-id.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
get:
tags:
- activity-reports
summary: Retrieve an activity report
parameters:
- in: path
name: activityReportId
required: true
schema:
type: number
responses:
200:
description: The activity report with an Id of {activityReportId}
content:
application/json:
schema:
$ref: '../../index.yaml#/components/schemas/activityReport'
put:
tags:
- activity-reports
summary: Update an activity report
requestBody:
description: A new activity report
required: true
content:
application/json:
schema:
$ref: '../../index.yaml#/components/schemas/activityReport'
parameters:
- in: path
name: activityReportId
required: true
schema:
type: number
responses:
200:
description: The updated activity report
content:
application/json:
schema:
$ref: '../../index.yaml#/components/schemas/activityReport'
18 changes: 18 additions & 0 deletions docs/openapi/paths/activity-reports/activity-reports.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
post:
tags:
- activity-reports
summary: Create a new activity report
requestBody:
description: A new activity report
required: true
content:
application/json:
schema:
$ref: '../../index.yaml#/components/schemas/activityReport'
responses:
200:
description: Successfully created activity report
content:
application/json:
schema:
$ref: '../../index.yaml#/components/schemas/activityReport'
3 changes: 2 additions & 1 deletion docs/openapi/paths/activity-reports/approvers.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
get:
tags:
- activity-reports
operationId: getApproves
summary: Potential activity report approvers
operationId: getApprovers
description: Gets all approvers for any region the current user has write permissions
responses:
200:
Expand Down
8 changes: 7 additions & 1 deletion docs/openapi/paths/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@
$ref: './admin.yaml'
'/admin/users':
$ref: './adminAllUsers.yaml'
'/activity-reports':
$ref: './activity-reports/activity-reports.yaml'
'/activity-reports/approvers':
$ref: './activity-reports/approvers.yaml'
$ref: './activity-reports/approvers.yaml'
'/activity-reports/activity-recipients':
$ref: './activity-reports/activity-recipients.yaml'
'/activity-reports/{activityReportId}':
$ref: './activity-reports/activity-reports-id.yaml'
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,18 @@
"axios": "^0.21.1",
"chromedriver": "^87.0.0",
"client-oauth2": "^4.3.3",
"cookie-session": "^1.4.0",
"cron": "^1.8.2",
"csv-parse": "^4.14.1",
"cucumber-html-reporter": "^5.2.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-session": "^1.17.1",
"express-unless": "^0.5.0",
"express-winston": "^4.0.5",
"helmet": "^4.1.0",
"http-codes": "^1.0.0",
"lodash": "^4.17.20",
"memorystore": "^1.6.2",
"moment": "^2.29.1",
"mz": "^2.7.0",
"newrelic": "^7.0.1",
"pg": "^8.3.3",
Expand Down
Loading