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

refactor: use shared function to initialize models #1172

Merged
merged 1 commit into from
May 4, 2021

Conversation

lamkeewei
Copy link
Contributor

Problem

When adding/removing a model, developer need to remember to update both test and runtime loaders.

Solution

Improvements:

  • Introduce shared initializeModels function to be used in both test and runtime sequelize loaders.

Bug fixes

  • Load Agency model for tests

@lamkeewei lamkeewei requested a review from miazima May 4, 2021 04:57
Copy link
Contributor

@miazima miazima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we could extract out too to prevent inconsistencies?

// Create the default credential names in the credentials table
// Each name should be accompanied by an entry in Secrets Manager
await Promise.all(
[
DefaultCredentialName.Email,
formatDefaultCredentialName(DefaultCredentialName.SMS),
formatDefaultCredentialName(DefaultCredentialName.Telegram),
].map((name) => Credential.upsert({ name }))
)

@lamkeewei
Copy link
Contributor Author

Is this something we could extract out too to prevent inconsistencies?

// Create the default credential names in the credentials table
// Each name should be accompanied by an entry in Secrets Manager
await Promise.all(
[
DefaultCredentialName.Email,
formatDefaultCredentialName(DefaultCredentialName.SMS),
formatDefaultCredentialName(DefaultCredentialName.Telegram),
].map((name) => Credential.upsert({ name }))
)

Yep definitely. But I'm keeping this here first because I think using the seeders from #1168 will be more appropriate for this purpose.

@lamkeewei lamkeewei merged commit 8cdd8d6 into develop May 4, 2021
@lamkeewei lamkeewei deleted the refactor-load-models branch May 4, 2021 08:37
lamkeewei added a commit that referenced this pull request May 5, 2021
* develop:
  refactor: use shared function to initialize models (#1172)
  chore: setup scaffolding for backend tests (#940)
  1.23.0
  fix(frontend): fix frontend test flakiness (#1162)
  fix: update successful delivery status only if error does not exist (#1150)
  chore: upgrade dependencies (#1153)
  feat: add unit tests for error states in critical workflows (#1118)
  feat: support whitelisting domains through `agencies` table (#1141)
  feat: add tests for happy paths in critical workflows (#1110)
  fix: prevent campaign names from causing dashboard rows to overflow (#1147)
  fix(email): Fix SendGrid fallback integration (#1026)
lamkeewei added a commit that referenced this pull request May 5, 2021
* develop:
  feat: refactor msg template components; add telegram character limit (#1148)
  refactor: use shared function to initialize models (#1172)
  chore: setup scaffolding for backend tests (#940)
  1.23.0
  fix(frontend): fix frontend test flakiness (#1162)
  fix: update successful delivery status only if error does not exist (#1150)
  chore: upgrade dependencies (#1153)
  feat: add unit tests for error states in critical workflows (#1118)
  feat: support whitelisting domains through `agencies` table (#1141)
  feat: add tests for happy paths in critical workflows (#1110)
  fix: prevent campaign names from causing dashboard rows to overflow (#1147)
lamkeewei added a commit that referenced this pull request May 10, 2021
* develop:
  fix: fix error when updating Telegram ID for an existing phone number (#1178)
  chore: upgrade React; use new JSX transform; sort imports (#1129)
  fix(backend): docker build and tsc output directory structure (#1177)
  feat: refactor msg template components; add telegram character limit (#1148)
  refactor: use shared function to initialize models (#1172)
  chore: setup scaffolding for backend tests (#940)
  1.23.0
  fix(frontend): fix frontend test flakiness (#1162)
  fix: update successful delivery status only if error does not exist (#1150)
  chore: upgrade dependencies (#1153)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants