-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: add ams model id and other fields to general characteristics * chore: migrated model abbreviation to model plan * chore: add role to plan discussion, begin updating store queries * feat: updated sql to include role * chore: updated user_role naming to be consistent, fix: most recent discussion role endpoint * chore: updated postman collection * chore: cleaned up old migration * chore: removed testing code * chore: removed old ghost code from branch-off * chore: go mod tidy * fix: updated inputs to fix broken tests * fix: added user role to plan discussion test inputs * chore: updated postman collection * feat: added user role description to plan discussion with constraints and unit tests * wip: email notifications when model plan dates change * fix: reverted file to main version * chore: removed debug print code * chore: fix sql constraints, remove trigger * wip: bug fixes and refactoring * fix: added userRole and userRoleDiscussion to discussion replies, improved constraints * fix: server tests relating to discussion reply create input * chore: simplified email recipients table, added email recipient seeding * chore: fixed broken unit test * fix: resolved broken unit test * chore: simplified some unnecessary code * Merge branch 'EASI-2713/email_notif_on_model_plan_dates_changed' of github.com:CMSgov/mint-app into EASI-2713/email_notif_on_model_plan_dates_changed # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit. * chore: cleaned up migrations from merging features * chore: migrated date changed recipient emails to envrc as we don't have a pipeline for loading configs before dbseed runs which leads to unpredictable first-run behavior on the server * chore: removed ghost code * chore: added checkDateFieldChanged documentation * wip: design changes to simplify model plan date changes email * fix: composing date ranges into common key structs * chore: several major bugs resolved regarding email date changes * chore: updated unit tests * chore: removed debug print and updated gomod * chore: removed gomod change * chore: simplified template and removed unnecessary data structure simplifying conversion code * chore: restructured code and removed debug print statements * fix: date change evaluation bugs * chore: removed print statements, added test coverage TODOs * chore: added test coverage to plan_basics_helper * Added 'copytime' to non-range fields to prevent pointer updates from causing issues --------- Co-authored-by: Clay Benson <[email protected]>
- Loading branch information
1 parent
cd70a2d
commit 08c9e8c
Showing
18 changed files
with
1,060 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ export EMAIL_TEMPLATE_DIR=$APP_DIR/pkg/email/templates | |
export [email protected] | ||
export [email protected] | ||
export [email protected] | ||
export [email protected],[email protected] | ||
|
||
# AWS variables | ||
export AWS_REGION=us-west-2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,7 @@ services: | |
- EMAIL_HOST=email | ||
- EMAIL_PORT=1025 | ||
- MINT_TEAM_EMAIL | ||
- DATE_CHANGED_RECIPIENT_EMAILS | ||
- EMAIL_SENDER | ||
- EMAIL_ENABLED | ||
- [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package email | ||
|
||
import "time" | ||
|
||
// ModelPlanDateChangedSubjectContent defines the parameters necessary for the corresponding email subject | ||
type ModelPlanDateChangedSubjectContent struct { | ||
ModelName string | ||
} | ||
|
||
// DateChange defines the parameters necessary for parsing date changes, both singular and ranges | ||
// If the OldRange and NewRange are both nil, then the change is singular | ||
type DateChange struct { | ||
Field string | ||
IsRange bool | ||
OldDate, NewDate *time.Time | ||
OldRangeStart, OldRangeEnd, NewRangeStart, NewRangeEnd *time.Time | ||
} | ||
|
||
// ModelPlanDateChangedBodyContent defines the parameters necessary for the corresponding email body | ||
type ModelPlanDateChangedBodyContent struct { | ||
ClientAddress string | ||
ModelName string | ||
ModelID string | ||
DateChanges []DateChange | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | ||
<title>Content</title> | ||
<style type="text/css"> | ||
/* CSS Reset */ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
/* General */ | ||
body { | ||
padding-left: 5px; | ||
text-align: left; | ||
} | ||
|
||
/* Headings */ | ||
h1 { | ||
font-size: 30pt; | ||
font-weight: bold; | ||
font-style: normal; | ||
color: #1B1B1B; | ||
font-family: 'Public Sans', sans-serif; | ||
text-decoration: none; | ||
} | ||
|
||
h2 { | ||
font-size: 24pt; | ||
font-weight: bold; | ||
font-style: normal; | ||
color: #1B1B1B; | ||
font-family: 'Public Sans', sans-serif; | ||
text-decoration: none; | ||
} | ||
|
||
h3 { | ||
font-size: 16.5pt; | ||
font-weight: bold; | ||
font-style: normal; | ||
color: #1B1B1B; | ||
font-family: 'Public Sans', sans-serif; | ||
text-decoration: none; | ||
line-height: 1.4; | ||
} | ||
|
||
/* Subtitle */ | ||
.subtitle { | ||
font-size: 15.5pt; | ||
font-weight: normal; | ||
font-style: normal; | ||
color: #71767A; | ||
font-family: 'Public Sans', sans-serif; | ||
text-decoration: none; | ||
} | ||
|
||
/* Paragraph */ | ||
p { | ||
font-size: 12pt; | ||
font-weight: normal; | ||
font-style: normal; | ||
color: #1B1B1B; | ||
font-family: 'Public Sans', sans-serif; | ||
text-decoration: none; | ||
line-height: 1.4; | ||
} | ||
|
||
/* Links */ | ||
a { | ||
font-size: 12pt; | ||
color: #005EA2; | ||
font-family: 'Public Sans', sans-serif; | ||
text-decoration: none; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1 style="padding-top: 3pt;">MINT</h1> | ||
<p class="subtitle" style="padding-top: 11pt;">The Model Innovation Tool</p> | ||
<br/> | ||
<h2 style="padding-top: 14pt;">Dates updated for {{.ModelName}}</h2> | ||
<br/> | ||
<br/> | ||
<h3>Anticipated high level timeline</h3> | ||
<br /> | ||
|
||
{{define "oldDate"}} | ||
{{if .}} | ||
{{.Format "01/02/2006"}} | ||
{{else}} | ||
no date entered | ||
{{end}} | ||
{{end}} | ||
|
||
{{define "newDate"}} | ||
{{if .}} | ||
{{.Format "01/02/2006"}} | ||
{{else}} | ||
no date entered | ||
{{end}} | ||
{{end}} | ||
|
||
{{range .DateChanges}} | ||
<p> | ||
<b>{{.Field}}:</b> | ||
<br /> | ||
{{if .IsRange}} | ||
<span style="color: red; text-decoration: line-through;"> | ||
{{template "oldDate" .OldRangeStart}} - {{template "oldDate" .OldRangeEnd}}<br/> | ||
</span> | ||
{{template "newDate" .NewRangeStart}} - {{template "newDate" .NewRangeEnd}} | ||
{{else}} | ||
<span style="color: red; text-decoration: line-through;">{{template "oldDate" .OldDate}}</span><br/> | ||
{{template "newDate" .NewDate}} | ||
{{end}} | ||
<br /> | ||
<br /> | ||
</p> | ||
{{end}} | ||
|
||
<br/> | ||
<p style="padding-top: 14pt;"> | ||
<a href="{{.ClientAddress}}/models/{{.ModelID}}/task-list/" class="link"> | ||
View this Model Plan in MINT | ||
</a> | ||
</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dates updated for {{.ModelName}} |
Oops, something went wrong.