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

chore: key cleanup #326

Merged
merged 24 commits into from
Oct 6, 2020
Merged

chore: key cleanup #326

merged 24 commits into from
Oct 6, 2020

Conversation

arshadali172
Copy link
Contributor

@arshadali172 arshadali172 commented Sep 17, 2020

Problem

Closes https://github.com/datagovsg/formsg-private/issues/8

Solution

  • Include script for removing dangling keys in login, user, feedback and submission collection. Refer to the issue for how these keys were identified
  • Include script for migrating emails in forms collection from comma-separated string of emails to array of emails
  • Coerce email string into email array before saving into database as this has caused issues in the past

Notes

  • Coercion of email string into email array on the frontend or backend controller level is not that straightforward as there are multiple places that need to be changed (create/duplicate/edit for the backend and create/edit for the frontend). Editing on the mongoose level seemed the most straightforward given that frontend changes will take a while to propagate and the frontend is to be re-written

Tests

  • Can submit email mode form with 1 email
  • Can submit email model form with multiple emails (create form flow)
  • Can submit email model form with multiple emails (edit form flow)
  • Can submit email model form with multiple emails (duplicate form flow)
  • Can submit email model form with multiple emails (template form flow)

@arshadali172
Copy link
Contributor Author

recipientEmails is the submission collection faces similar issues as emails in the form collection. Should we edit this too?

Copy link
Contributor

@liangyuanruo liangyuanruo left a comment

Choose a reason for hiding this comment

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

may i request for one last cleanup, and that is to rename all the folders in scripts/ to prepend the date that they were introduced into the codebase? e.g. 20200917_unused_key_cleanup

@arshadali172
Copy link
Contributor Author

may i request for one last cleanup, and that is to rename all the folders in scripts/ to prepend the date that they were introduced into the codebase? e.g. 20200917_unused_key_cleanup

done

@arshadali172 arshadali172 changed the base branch from develop to release-v4.38.1 October 6, 2020 08:48
@tshuli tshuli merged commit 1a3ea78 into release-v4.38.1 Oct 6, 2020
@liangyuanruo liangyuanruo deleted the key-cleanup branch November 12, 2020 06:07
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

3 participants