|
|
|
@ -66,7 +66,7 @@ function idForLogging(message) {
|
|
|
|
|
|
|
|
|
|
exports._validate = (contact, options = {}) => {
|
|
|
|
|
const { messageId } = options;
|
|
|
|
|
const { name, organization } = contact;
|
|
|
|
|
const { name, number, email, address, organization } = contact;
|
|
|
|
|
|
|
|
|
|
if ((!name || !name.displayName) && !organization) {
|
|
|
|
|
return new Error(
|
|
|
|
@ -74,16 +74,15 @@ exports._validate = (contact, options = {}) => {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disabled as we don't require the users to provide this
|
|
|
|
|
// if (
|
|
|
|
|
// (!number || !number.length) &&
|
|
|
|
|
// (!email || !email.length) &&
|
|
|
|
|
// (!address || !address.length)
|
|
|
|
|
// ) {
|
|
|
|
|
// return new Error(
|
|
|
|
|
// `Message ${messageId}: Contact had no included numbers, email or addresses`
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
if (
|
|
|
|
|
(!number || !number.length) &&
|
|
|
|
|
(!email || !email.length) &&
|
|
|
|
|
(!address || !address.length)
|
|
|
|
|
) {
|
|
|
|
|
return new Error(
|
|
|
|
|
`Message ${messageId}: Contact had no included numbers, email or addresses`
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|