Skip to content

Commit b2a02e3

Browse files
authored
Merge pull request #11909 from appwrite/fix-protocol-exception
Fix: protocol & service exception
2 parents db84c79 + e7f78b3 commit b2a02e3

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

  • src/Appwrite/Platform/Modules/Project/Http/Project

src/Appwrite/Platform/Modules/Project/Http/Project/Protocols/Status/Update.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Appwrite\Platform\Modules\Project\Http\Project\Protocols\Status;
44

5+
use Appwrite\Event\Event;
56
use Appwrite\Platform\Action;
67
use Appwrite\SDK\AuthType;
78
use Appwrite\SDK\Method;
@@ -33,8 +34,8 @@ public function __construct()
3334
->desc('Update project protocol status')
3435
->groups(['api', 'project'])
3536
->label('scope', 'project.write')
36-
->label('event', 'protocols.[protocol].update')
37-
->label('audits.event', 'project.protocols.[protocol].update')
37+
->label('event', 'protocols.[protocolId].update')
38+
->label('audits.event', 'project.protocols.[protocolId].update')
3839
->label('audits.resource', 'project.protocols/{response.$id}')
3940
->label('sdk', new Method(
4041
namespace: 'project',
@@ -57,6 +58,7 @@ public function __construct()
5758
->inject('dbForPlatform')
5859
->inject('project')
5960
->inject('authorization')
61+
->inject('queueForEvents')
6062
->callback($this->action(...));
6163
}
6264

@@ -66,7 +68,8 @@ public function action(
6668
Response $response,
6769
Database $dbForPlatform,
6870
Document $project,
69-
Authorization $authorization
71+
Authorization $authorization,
72+
Event $queueForEvents,
7073
): void {
7174
$protocols = $project->getAttribute('apis', []);
7275
$protocols[$protocolId] = $enabled;
@@ -75,6 +78,8 @@ public function action(
7578
'apis' => $protocols,
7679
])));
7780

81+
$queueForEvents->setParam('protocolId', $protocolId);
82+
7883
$response->dynamic($project, Response::MODEL_PROJECT);
7984
}
8085
}

src/Appwrite/Platform/Modules/Project/Http/Project/Services/Status/Update.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Appwrite\Platform\Modules\Project\Http\Project\Services\Status;
44

5+
use Appwrite\Event\Event;
56
use Appwrite\Platform\Action;
67
use Appwrite\SDK\AuthType;
78
use Appwrite\SDK\Method;
@@ -33,8 +34,8 @@ public function __construct()
3334
->desc('Update project service status')
3435
->groups(['api', 'project'])
3536
->label('scope', 'project.write')
36-
->label('event', 'services.[service].update')
37-
->label('audits.event', 'project.services.[service].update')
37+
->label('event', 'services.[serviceId].update')
38+
->label('audits.event', 'project.services.[serviceId].update')
3839
->label('audits.resource', 'project.services/{response.$id}')
3940
->label('sdk', new Method(
4041
namespace: 'project',
@@ -57,6 +58,7 @@ public function __construct()
5758
->inject('dbForPlatform')
5859
->inject('project')
5960
->inject('authorization')
61+
->inject('queueForEvents')
6062
->callback($this->action(...));
6163
}
6264

@@ -66,7 +68,8 @@ public function action(
6668
Response $response,
6769
Database $dbForPlatform,
6870
Document $project,
69-
Authorization $authorization
71+
Authorization $authorization,
72+
Event $queueForEvents
7073
): void {
7174
$services = $project->getAttribute('services', []);
7275
$services[$serviceId] = $enabled;
@@ -75,6 +78,8 @@ public function action(
7578
'services' => $services,
7679
])));
7780

81+
$queueForEvents->setParam('serviceId', $serviceId);
82+
7883
$response->dynamic($project, Response::MODEL_PROJECT);
7984
}
8085
}

0 commit comments

Comments
 (0)