Merge remote-tracking branch 'origin/1.5.x' into feat-smtp-test
This commit is contained in:
commit
f64989dd13
12 changed files with 14 additions and 34 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3243,7 +3243,6 @@ App::put('/v1/account/targets/:targetId/push')
|
|||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_TARGET)
|
||||
->label('docs', false)
|
||||
->param('targetId', '', new UID(), 'Target ID.')
|
||||
->param('identifier', '', new Text(Database::LENGTH_KEY), 'The target identifier (token, email, phone etc.)')
|
||||
->inject('queueForEvents')
|
||||
|
|
|
@ -671,12 +671,11 @@ App::post('/v1/messaging/providers/apns')
|
|||
->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true)
|
||||
->param('teamId', '', new Text(0), 'APNS team ID.', true)
|
||||
->param('bundleId', '', new Text(0), 'APNS bundle ID.', true)
|
||||
->param('endpoint', '', new Text(0), 'APNS endpoint.', true)
|
||||
->param('enabled', null, new Boolean(), 'Set as enabled.', true)
|
||||
->inject('queueForEvents')
|
||||
->inject('dbForProject')
|
||||
->inject('response')
|
||||
->action(function (string $providerId, string $name, string $authKey, string $authKeyId, string $teamId, string $bundleId, string $endpoint, ?bool $enabled, Event $queueForEvents, Database $dbForProject, Response $response) {
|
||||
->action(function (string $providerId, string $name, string $authKey, string $authKeyId, string $teamId, string $bundleId, ?bool $enabled, Event $queueForEvents, Database $dbForProject, Response $response) {
|
||||
$providerId = $providerId == 'unique()' ? ID::unique() : $providerId;
|
||||
|
||||
$credentials = [];
|
||||
|
@ -697,17 +696,12 @@ App::post('/v1/messaging/providers/apns')
|
|||
$credentials['bundleId'] = $bundleId;
|
||||
}
|
||||
|
||||
if (!empty($endpoint)) {
|
||||
$credentials['endpoint'] = $endpoint;
|
||||
}
|
||||
|
||||
if (
|
||||
$enabled === true
|
||||
&& \array_key_exists('authKey', $credentials)
|
||||
&& \array_key_exists('authKeyId', $credentials)
|
||||
&& \array_key_exists('teamId', $credentials)
|
||||
&& \array_key_exists('bundleId', $credentials)
|
||||
&& \array_key_exists('endpoint', $credentials)
|
||||
) {
|
||||
$enabled = true;
|
||||
} else {
|
||||
|
@ -1565,11 +1559,10 @@ App::patch('/v1/messaging/providers/apns/:providerId')
|
|||
->param('authKeyId', '', new Text(0), 'APNS authentication key ID.', true)
|
||||
->param('teamId', '', new Text(0), 'APNS team ID.', true)
|
||||
->param('bundleId', '', new Text(0), 'APNS bundle ID.', true)
|
||||
->param('endpoint', '', new Text(0), 'APNS endpoint.', true)
|
||||
->inject('queueForEvents')
|
||||
->inject('dbForProject')
|
||||
->inject('response')
|
||||
->action(function (string $providerId, string $name, ?bool $enabled, string $authKey, string $authKeyId, string $teamId, string $bundleId, string $endpoint, Event $queueForEvents, Database $dbForProject, Response $response) {
|
||||
->action(function (string $providerId, string $name, ?bool $enabled, string $authKey, string $authKeyId, string $teamId, string $bundleId, Event $queueForEvents, Database $dbForProject, Response $response) {
|
||||
$provider = $dbForProject->getDocument('providers', $providerId);
|
||||
|
||||
if ($provider->isEmpty()) {
|
||||
|
@ -1603,10 +1596,6 @@ App::patch('/v1/messaging/providers/apns/:providerId')
|
|||
$credentials['bundle'] = $bundleId;
|
||||
}
|
||||
|
||||
if (!empty($endpoint)) {
|
||||
$credentials['endpoint'] = $endpoint;
|
||||
}
|
||||
|
||||
$provider->setAttribute('credentials', $credentials);
|
||||
|
||||
if ($enabled === true || $enabled === false) {
|
||||
|
@ -1616,7 +1605,6 @@ App::patch('/v1/messaging/providers/apns/:providerId')
|
|||
&& \array_key_exists('authKeyId', $credentials)
|
||||
&& \array_key_exists('teamId', $credentials)
|
||||
&& \array_key_exists('bundleId', $credentials)
|
||||
&& \array_key_exists('endpoint', $credentials)
|
||||
) {
|
||||
$enabled = true;
|
||||
} else {
|
||||
|
@ -1696,12 +1684,9 @@ App::post('/v1/messaging/topics')
|
|||
$topic = new Document([
|
||||
'$id' => $topicId,
|
||||
'name' => $name,
|
||||
'description' => $description
|
||||
]);
|
||||
|
||||
if ($description) {
|
||||
$topic->setAttribute('description', $description);
|
||||
}
|
||||
|
||||
try {
|
||||
$topic = $dbForProject->createDocument('topics', $topic);
|
||||
} catch (DuplicateException) {
|
||||
|
|
|
@ -348,7 +348,6 @@ class Messaging extends Action
|
|||
$credentials['authKeyId'],
|
||||
$credentials['teamId'],
|
||||
$credentials['bundleId'],
|
||||
$credentials['endpoint']
|
||||
),
|
||||
'fcm' => new FCM($credentials['serviceAccountJSON']),
|
||||
default => null
|
||||
|
|
|
@ -1870,8 +1870,8 @@ trait Base
|
|||
}
|
||||
}';
|
||||
case self::$CREATE_APNS_PROVIDER:
|
||||
return 'mutation createApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!, $endpoint: String!) {
|
||||
messagingCreateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId, endpoint: $endpoint) {
|
||||
return 'mutation createApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!) {
|
||||
messagingCreateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId) {
|
||||
_id
|
||||
name
|
||||
provider
|
||||
|
@ -1984,8 +1984,8 @@ trait Base
|
|||
}
|
||||
}';
|
||||
case self::$UPDATE_APNS_PROVIDER:
|
||||
return 'mutation updateApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!, $endpoint: String!) {
|
||||
messagingUpdateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId, endpoint: $endpoint) {
|
||||
return 'mutation updateApnsProvider($providerId: String!, $name: String!, $authKey: String!, $authKeyId: String!, $teamId: String!, $bundleId: String!) {
|
||||
messagingUpdateApnsProvider(providerId: $providerId, name: $name, authKey: $authKey, authKeyId: $authKeyId, teamId: $teamId, bundleId: $bundleId) {
|
||||
_id
|
||||
name
|
||||
provider
|
||||
|
|
|
@ -87,7 +87,6 @@ class MessagingTest extends Scope
|
|||
'authKeyId' => 'my-authkeyid',
|
||||
'teamId' => 'my-teamid',
|
||||
'bundleId' => 'my-bundleid',
|
||||
'endpoint' => 'my-endpoint',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -177,7 +176,6 @@ class MessagingTest extends Scope
|
|||
'authKeyId' => 'my-authkeyid',
|
||||
'teamId' => 'my-teamid',
|
||||
'bundleId' => 'my-bundleid',
|
||||
'endpoint' => 'my-endpoint',
|
||||
],
|
||||
];
|
||||
foreach (\array_keys($providersParams) as $index => $key) {
|
||||
|
|
|
@ -80,7 +80,6 @@ trait MessagingBase
|
|||
'authKeyId' => 'my-authkeyid',
|
||||
'teamId' => 'my-teamid',
|
||||
'bundleId' => 'my-bundleid',
|
||||
'endpoint' => 'my-endpoint',
|
||||
],
|
||||
];
|
||||
$providers = [];
|
||||
|
@ -155,7 +154,6 @@ trait MessagingBase
|
|||
'authKeyId' => 'my-authkeyid',
|
||||
'teamId' => 'my-teamid',
|
||||
'bundleId' => 'my-bundleid',
|
||||
'endpoint' => 'my-endpoint',
|
||||
],
|
||||
];
|
||||
foreach (\array_keys($providersParams) as $index => $key) {
|
||||
|
@ -245,6 +243,7 @@ trait MessagingBase
|
|||
]);
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
$this->assertEquals('my-app', $response['body']['name']);
|
||||
$this->assertEquals('', $response['body']['description']);
|
||||
|
||||
return $response['body'];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue