mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
console route change
This commit is contained in:
@@ -2929,10 +2929,11 @@ App::get('/v1/databases/:databaseId/slow-queries/:documentId')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_OK)
|
||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||
->label('sdk.response.model', Response::MODEL_DOCUMENT)
|
||||
->param('databaseId', '', new UID(), 'Database ID.')
|
||||
->param('documentId', '', new UID(), 'Document ID.')
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->action(function (string $documentId, Response $response, Database $dbForProject) {
|
||||
->action(function (string $databaseId, string $documentId, Response $response, Database $dbForProject) {
|
||||
$document = $dbForProject->getDocument('slowQueries', $documentId);
|
||||
if ($document->isEmpty()) {
|
||||
throw new Exception(Exception::DOCUMENT_NOT_FOUND);
|
||||
@@ -2941,7 +2942,7 @@ App::get('/v1/databases/:databaseId/slow-queries/:documentId')
|
||||
$response->dynamic($document, Response::MODEL_DOCUMENT);
|
||||
});
|
||||
|
||||
App::get('/v1/databases/:databaseId/slow-queries/:documentId')
|
||||
App::delete('/v1/databases/:databaseId/slow-queries/:documentId')
|
||||
->desc('Delete Slow query Document')
|
||||
->desc('List Documents')
|
||||
->groups(['api', 'database'])
|
||||
@@ -2955,10 +2956,11 @@ App::get('/v1/databases/:databaseId/slow-queries/:documentId')
|
||||
->label('sdk.description', '/docs/references/databases/delete-slow-query-document.md')
|
||||
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
|
||||
->label('sdk.response.model', Response::MODEL_NONE)
|
||||
->param('databaseId', '', new UID(), 'Database ID.')
|
||||
->param('documentId', '', new UID(), 'Document ID.')
|
||||
->inject('response')
|
||||
->inject('dbForProject')
|
||||
->action(function (string $documentId, Response $response, Database $dbForProject) {
|
||||
->action(function (string $databaseId, string $documentId, Response $response, Database $dbForProject) {
|
||||
$document = $dbForProject->getDocument('slowQueries', $documentId);
|
||||
if ($document->isEmpty()) {
|
||||
throw new Exception(Exception::DOCUMENT_NOT_FOUND);
|
||||
|
||||
@@ -306,23 +306,23 @@ class DatabasesConsoleClientTest extends Scope
|
||||
$this->assertEquals(true, $documents['body']['documents'][0]['blocked']);
|
||||
$this->assertEquals(2, $documents['body']['documents'][0]['count']);
|
||||
|
||||
$document = $this->client->call(Client::METHOD_GET, '/databases/slow-queries/' . $documents['body']['documents'][0]['$id'], array_merge([
|
||||
$doc = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/slow-queries/' . $documents['body']['documents'][0]['$id'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), []);
|
||||
$this->assertEquals(200, $documents['headers']['status-code']);
|
||||
$this->assertEquals($document['body']['queries'][0], 'notEqual("longtext", "appwrite")');
|
||||
$this->assertEquals(200, $doc['headers']['status-code']);
|
||||
$this->assertEquals($doc['body']['queries'][0], 'notEqual("longtext", "appwrite")');
|
||||
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/databases/slow-queries/' . $documents['body']['documents'][0]['$id'], array_merge([
|
||||
$response = $this->client->call(Client::METHOD_DELETE, '/databases/' . $data['databaseId'] . '/slow-queries/' . $documents['body']['documents'][0]['$id'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), []);
|
||||
$this->assertEquals(204, $response['headers']['status-code']);
|
||||
|
||||
$document = $this->client->call(Client::METHOD_GET, '/databases/slow-queries/' . $documents['body']['documents'][0]['$id'], array_merge([
|
||||
$doc = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/slow-queries/' . $documents['body']['documents'][0]['$id'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), []);
|
||||
$this->assertEquals(404, $document['headers']['status-code']);
|
||||
$this->assertEquals(404, $doc['headers']['status-code']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user