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

MCR-4888: Add update email settings api #3104

Open
wants to merge 13 commits into
base: mcr-4893-parameter-store-flagged
Choose a base branch
from

Conversation

JasonLin0991
Copy link
Contributor

@JasonLin0991 JasonLin0991 commented Jan 24, 2025

Summary

MCR-4888

AC:

  • This API an only be called by Admin user, allows update of the new fields.
  • Enforce email validations here   - create a zod schema type EmailSettings to validate with z.string().email().optional() for each item in the string array.
  • We can go ahead and error if emails not sent in for updates of any field, no need for partial updates, just make sure errors tells you which field or email to fix.

Related issues

Screenshots

Test cases covered

settings.test.ts
Tests the Zod custom validator for emailSettingsSchema

  • 'should validate emails with display names'
  • 'should validate plain emails'
  • 'should trim white space of emails'
  • 'should reject empty email settings'
  • 'should reject invalid email format'
  • 'should reject empty email arrays'
  • 'should reject malformed email aliases'

updateEmailSettings.test.ts
resolver tests

  • 'updates email settings'
  • 'errors when on failed email validations'
  • 'errors when user is not an admin'

QA guidance

@JasonLin0991 JasonLin0991 changed the base branch from main to mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag January 24, 2025 16:10
… into jl-mcr-4888-add-update-email-settings-api
… into jl-mcr-4888-add-update-email-settings-api
… into jl-mcr-4888-add-update-email-settings-api
@JasonLin0991 JasonLin0991 marked this pull request as ready for review January 24, 2025 22:41
@JasonLin0991 JasonLin0991 added the AI Assist Github Copilot test for DSG label Jan 24, 2025
@haworku haworku changed the base branch from mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag to mcr-4893-parameter-store-flagged January 29, 2025 22:05
expect(result.success).toBe(false)
})

it('should reject malformed email aliases', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@JasonLin0991 ⭐on covering the test cases

@haworku haworku changed the base branch from mcr-4893-parameter-store-flagged to mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag January 30, 2025 16:23
@haworku haworku changed the base branch from mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag to mcr-4893-parameter-store-flagged January 30, 2025 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Assist Github Copilot test for DSG
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants