mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
lint fix
This commit is contained in:
@@ -1040,12 +1040,12 @@ App::post('/v1/messaging/topics')
|
||||
$topic->setAttribute('description', $description);
|
||||
}
|
||||
|
||||
try{
|
||||
try {
|
||||
$topic = $dbForProject->createDocument('topics', $topic);
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic($topic, Response::MODEL_TOPIC);
|
||||
} catch(DuplicateException) {
|
||||
} catch (DuplicateException) {
|
||||
throw new Exception(Exception::TOPIC_ALREADY_EXISTS);
|
||||
}
|
||||
});
|
||||
@@ -1140,13 +1140,13 @@ App::get('/v1/messaging/topics/:topicId/subscribers')
|
||||
$subscribers = $dbForProject->find('subscribers', [
|
||||
Query::equal('topicInternalId', [$topic->getInternalId()])
|
||||
]);
|
||||
|
||||
|
||||
$response
|
||||
->dynamic(new Document([
|
||||
'subscribers' => $subscribers,
|
||||
'total' => \count($subscribers),
|
||||
]), Response::MODEL_SUBSCRIBER_LIST);
|
||||
});
|
||||
});
|
||||
|
||||
App::get('/v1/messaging/topics/:topicId/subscriber/:subscriberId')
|
||||
->desc('Get a topic\'s subscriber.')
|
||||
@@ -1169,10 +1169,10 @@ App::get('/v1/messaging/topics/:topicId/subscriber/:subscriberId')
|
||||
if ($topic->isEmpty()) {
|
||||
throw new Exception(Exception::TOPIC_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
||||
$subscriber = $dbForProject->getDocument('subscribers', $subscriberId);
|
||||
|
||||
if ($subscriber->isEmpty() || $subscriber->getAttribute('topicId')!==$topicId) {
|
||||
if ($subscriber->isEmpty() || $subscriber->getAttribute('topicId') !== $topicId) {
|
||||
throw new Exception(Exception::SUBSCRIBER_NOT_FOUND);
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ App::post('/v1/messaging/topics/:topicId/subscribers')
|
||||
->inject('response')
|
||||
->action(function (string $subscriberId, string $topicId, string $targetId, Database $dbForProject, Response $response) {
|
||||
$subscriberId = $subscriberId == 'unique()' ? ID::unique() : $subscriberId;
|
||||
|
||||
|
||||
$topic = Authorization::skip(fn () => $dbForProject->getDocument('topics', $topicId));
|
||||
|
||||
if ($topic->isEmpty()) {
|
||||
@@ -1231,7 +1231,7 @@ App::post('/v1/messaging/topics/:topicId/subscribers')
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic($subscriber, Response::MODEL_SUBSCRIBER);
|
||||
} catch(DuplicateException) {
|
||||
} catch (DuplicateException) {
|
||||
throw new Exception(Exception::SUBSCRIBER_ALREADY_EXISTS);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -268,7 +268,8 @@ trait MessagingBase
|
||||
/**
|
||||
* @depends testCreateTopic
|
||||
*/
|
||||
public function testCreateSubscriber (array $topic) {
|
||||
public function testCreateSubscriber(array $topic)
|
||||
{
|
||||
$userId = $this->getUser()['$id'];
|
||||
$target = $this->client->call(Client::METHOD_POST, '/users/' . $userId . '/targets', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
@@ -290,8 +291,8 @@ trait MessagingBase
|
||||
]);
|
||||
$this->assertEquals(201, $response['headers']['status-code']);
|
||||
return [
|
||||
'topicId' => $topic['$id'],
|
||||
'targetId' => $target['body']['$id'],
|
||||
'topicId' => $topic['$id'],
|
||||
'targetId' => $target['body']['$id'],
|
||||
'subscriberId' => $response['body']['$id']
|
||||
];
|
||||
}
|
||||
@@ -299,7 +300,8 @@ trait MessagingBase
|
||||
/**
|
||||
* @depends testCreateSubscriber
|
||||
*/
|
||||
public function testGetSubscriber(array $data) {
|
||||
public function testGetSubscriber(array $data)
|
||||
{
|
||||
$response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $data['topicId'] . '/subscriber/' . $data['subscriberId'], \array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
@@ -312,7 +314,8 @@ trait MessagingBase
|
||||
/**
|
||||
* @depends testCreateSubscriber
|
||||
*/
|
||||
public function testListSubscribers(array $data) {
|
||||
public function testListSubscribers(array $data)
|
||||
{
|
||||
$response = $this->client->call(Client::METHOD_GET, '/messaging/topics/' . $data['topicId'] . '/subscribers', \array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
@@ -327,7 +330,7 @@ trait MessagingBase
|
||||
*/
|
||||
public function testDeleteSubscriber(array $data)
|
||||
{
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/messaging/topics/' . $data['topicId'] .'/subscriber/' .$data['subscriberId'], \array_merge([
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/messaging/topics/' . $data['topicId'] . '/subscriber/' . $data['subscriberId'], \array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
Reference in New Issue
Block a user