-
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
Changes from 4 commits
eb90363
c7cebdd
931cfdb
ba36ccf
9c50867
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,4 +96,9 @@ const getSmsStats = async (campaignId: number): Promise<CampaignStats> => { | |
return { error: stats.error, unsent: stats.unsent, sent: stats.sent, status: job.status } | ||
} | ||
|
||
export { populateSmsTemplate, upsertSmsTemplate, getSmsStats } | ||
const hasInvalidSmsRecipient = (records: MessageBulkInsertInterface[]): boolean => { | ||
const re = /^[0-9+]+$/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. If a |
||
return records.some((record) => !record.recipient.match(re)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
export { populateSmsTemplate, upsertSmsTemplate, getSmsStats, hasInvalidSmsRecipient } |
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.