1
0
Fork 0
mirror of synced 2024-06-13 16:24:47 +12:00

Allow teamId queries on listProjects

This commit is contained in:
Matej Bačo 2022-10-03 07:16:49 +00:00
parent fbbb150e86
commit a883d3728f
4 changed files with 27 additions and 7 deletions

View file

@ -748,6 +748,13 @@ $collections = [
'lengths' => [128],
'orders' => [Database::ORDER_ASC],
],
[
'$id' => ID::custom('_key_team'),
'type' => Database::INDEX_KEY,
'attributes' => ['teamId'],
'lengths' => [Database::LENGTH_KEY],
'orders' => [Database::ORDER_ASC],
],
],
],

12
composer.lock generated
View file

@ -5283,16 +5283,16 @@
},
{
"name": "twig/twig",
"version": "v3.4.2",
"version": "v3.4.3",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077"
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
"shasum": ""
},
"require": {
@ -5343,7 +5343,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.4.2"
"source": "https://github.com/twigphp/Twig/tree/v3.4.3"
},
"funding": [
{
@ -5355,7 +5355,7 @@
"type": "tidelift"
}
],
"time": "2022-08-12T06:47:24+00:00"
"time": "2022-09-28T08:42:51+00:00"
}
],
"aliases": [],

View file

@ -7,7 +7,8 @@ use Appwrite\Utopia\Database\Validator\Queries\Base;
class Projects extends Base
{
public const ALLOWED_ATTRIBUTES = [
'name'
'name',
'teamId'
];
/**

View file

@ -167,6 +167,18 @@ class ProjectsConsoleClientTest extends Scope
$this->assertArrayHasKey('webhooks', $response['body']);
$this->assertArrayHasKey('keys', $response['body']);
$response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
'queries' => [ 'equal("teamId", "' . $team['body']['$id'] . '")' ],
]);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertNotEmpty($response['body']);
$this->assertCount(1, $response['body']['projects']);
$this->assertEquals($team['body']['$id'], $response['body']['projects'][0]['$id']);
$response = $this->client->call(Client::METHOD_GET, '/projects', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],