1
0
Fork 0
mirror of synced 2024-08-03 04:21:46 +12:00

fix small bug in worker and send email endpoint

This commit is contained in:
Prateek Banga 2023-09-21 16:12:56 +05:30
parent 35d842171c
commit b4de44c905
2 changed files with 6 additions and 6 deletions

View file

@ -1307,16 +1307,16 @@ App::post('/v1/messaging/messages/email')
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MESSAGE) ->label('sdk.response.model', Response::MODEL_MESSAGE)
->param('providerId', '', new Text(128), 'Email Provider ID.') ->param('providerId', '', new Text(128), 'Email Provider ID.')
->param('to', [], new ArrayList(new Text(0)), 'List of Topic IDs or List of User IDs or List of Target IDs.') ->param('to', [], new ArrayList(new Text(65535)), 'List of Topic IDs or List of User IDs or List of Target IDs.')
->param('subject', '', new Text(0), 'Email Subject.') ->param('subject', '', new Text(128), 'Email Subject.')
->param('content', '', new Text(0), 'Email Content.') ->param('content', '', new Text(65407), 'Email Content.')
->param('from', '', new Text(0), 'Email from.', true) ->param('from', '', new Text(128), 'Email from.', true)
->param('html', false, new Boolean(false), 'Is content of type HTML', true) ->param('html', false, new Boolean(false), 'Is content of type HTML', true)
->inject('dbForProject') ->inject('dbForProject')
->inject('project') ->inject('project')
->inject('messaging') ->inject('messaging')
->inject('response') ->inject('response')
->action(function (string $providerId, array $to, string $subject, string $content, string $from, string $html, string $deliveryTime, Database $dbForProject, Document $project, Messaging $messaging, Response $response) { ->action(function (string $providerId, array $to, string $subject, string $content, string $from, string $html, Database $dbForProject, Document $project, Messaging $messaging, Response $response) {
$provider = $dbForProject->getDocument('providers', $providerId); $provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) { if ($provider->isEmpty()) {

View file

@ -76,7 +76,7 @@ class MessagingV1 extends Worker
{ {
$credentials = $record->getAttribute('credentials'); $credentials = $record->getAttribute('credentials');
return match ($record->getAttribute('provider')) { return match ($record->getAttribute('provider')) {
'mailgun' => new Mailgun($credentials['apiKey'], $credentials['domain']), 'mailgun' => new Mailgun($credentials['apiKey'], $credentials['domain'], $credentials['isEuRegion']),
'sendgrid' => new SendGrid($credentials['apiKey']), 'sendgrid' => new SendGrid($credentials['apiKey']),
default => null default => null
}; };