-
Notifications
You must be signed in to change notification settings - Fork 17
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: Allow empty params in csv file #200
Conversation
} | ||
|
||
const hasInvalidEmailRecipient = (records: MessageBulkInsertInterface[]): boolean => { | ||
return records.some((record) => !validator.isEmail(record.recipient)) |
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.
Not sure if this is the best approach performance wise. I could do this while parsing csv or when we are test hydrating, but it will be messy.
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.
I think it's fine for now.
const hasInvalidSmsRecipient = (records: MessageBulkInsertInterface[]): boolean => { | ||
const re = /^[0-9+]+$/ |
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.
How strict should I be with this regex?
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.
If a +
exists, it should be at the start of the string.
const hasInvalidSmsRecipient = (records: MessageBulkInsertInterface[]): boolean => { | ||
const re = /^[0-9+]+$/ | ||
return records.some((record) => !record.recipient.match(re)) |
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.
re.test(record.recipient)
should be faster. match
returns an array of matched strings
Problem
We want to allow users to upload csv with empty params as long as it is not in recipient column.
Closes #194
Solution
Features:
Improvements:
Validations:
+
and numbers allowedvalidator.isEmail
Tests
SMS
Email
What tests should be run to confirm functionality?