-
Notifications
You must be signed in to change notification settings - Fork 90
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
feat(2915): admin front-end for tenant support #3254
Conversation
# Conflicts: # localenv/mock-account-servicing-entity/generated/graphql.ts # packages/backend/src/graphql/generated/graphql.schema.json # packages/backend/src/graphql/generated/graphql.ts # packages/backend/src/graphql/resolvers/tenant.ts # packages/backend/src/graphql/schema.graphql # packages/frontend/app/generated/graphql.ts # packages/mock-account-service-lib/src/generated/graphql.ts # test/integration/lib/generated/graphql.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few comments
if ( | ||
result.data.email && | ||
result.data.email.trim().length > 0 && | ||
!new RegExp(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/).test( | ||
result.data.email | ||
) | ||
) { | ||
errors.fieldErrors.email = ['Email is invalid.'] | ||
return json({ errors }, { status: 400 }) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does const result = updateTenantSchema.safeParse(formEntries)
take care of checking the email validation already?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there is an issue with the optional vs regEx, that always forces the regex even when the field is marked as optional.
As a workaround, I am validating it as part of the action
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think we were just missing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As indicated by @mkurapov
colinhacks/zod#310
We have a workaround:
[`](email: z.string().email().or(z.literal('')),)
Changes proposed in this pull request
Context
Fixes: #2915
Checklist
fixes #number
user-docs
label (if necessary)