1
0
Fork 0
mirror of synced 2024-06-29 11:40:45 +12:00

Added team models

This commit is contained in:
Eldad Fux 2020-06-24 08:14:26 +03:00
parent 33e9c486c8
commit 94db437d56
2 changed files with 34 additions and 40 deletions

View file

@ -3,7 +3,6 @@
global $utopia, $register, $request, $response, $projectDB, $project, $user, $audit, $mail, $mode, $clients;
use Utopia\Exception;
use Utopia\Response;
use Utopia\Config\Config;
use Utopia\Validator\Email;
use Utopia\Validator\Text;
@ -19,6 +18,7 @@ use Appwrite\Database\Validator\UID;
use Appwrite\Database\Validator\Authorization;
use Appwrite\Database\Exception\Duplicate;
use Appwrite\Template\Template;
use Appwrite\Utopia\Response;
include_once __DIR__ . '/../shared/api.php';
@ -78,10 +78,8 @@ $utopia->post('/v1/teams')
}
}
$response
->setStatusCode(Response::STATUS_CODE_CREATED)
->json($team->getArrayCopy())
;
$response->setStatusCode(Response::STATUS_CODE_CREATED);
$response->dynamic($team, Response::MODEL_TEAM);
}
);
@ -130,7 +128,7 @@ $utopia->get('/v1/teams/:teamId')
throw new Exception('Team not found', 404);
}
$response->json($team->getArrayCopy([]));
$response->dynamic($team, Response::MODEL_TEAM);
}
);
@ -159,7 +157,7 @@ $utopia->put('/v1/teams/:teamId')
throw new Exception('Failed saving team to DB', 500);
}
$response->json($team->getArrayCopy());
$response->dynamic($team, Response::MODEL_TEAM);
}
);

View file

@ -303,27 +303,27 @@ $utopia->get('/open-api-2.json')
'securityDefinitions' => $keys[$platform],
'paths' => [],
'definitions' => [
// 'Pet' => [
// 'required' => ['id', 'name'],
// 'properties' => [
// 'id' => [
// 'type' => 'integer',
// 'format' => 'int64',
// ],
// 'name' => [
// 'type' => 'string',
// ],
// 'tag' => [
// 'type' => 'string',
// ],
// ],
// ],
// 'Pets' => array(
// 'type' => 'array',
// 'items' => array(
// '$ref' => '#/definitions/Pet',
// ),
// ),
'Pet' => [
'required' => ['id', 'name'],
'properties' => [
'id' => [
'type' => 'integer',
'format' => 'int64',
],
'name' => [
'type' => 'string',
],
'tag' => [
'type' => 'string',
],
],
],
'Pets' => array(
'type' => 'array',
'items' => array(
'$ref' => '#/definitions/Pet',
),
),
'Error' => array(
'required' => array(
0 => 'code',
@ -396,14 +396,14 @@ $utopia->get('/open-api-2.json')
'tags' => [$route->getLabel('sdk.namespace', 'default')],
'description' => ($desc) ? \file_get_contents($desc) : '',
// 'responses' => [
// 200 => [
// 'description' => 'An paged array of pets',
// 'schema' => [
// '$ref' => '#/definitions/Pet',
// ],
// ],
// ],
'responses' => [
200 => [
'description' => 'An paged array of pets',
'schema' => [
'$ref' => '#/definitions/Pet',
],
],
],
];
if ($extensions) {
@ -546,10 +546,6 @@ $utopia->get('/open-api-2.json')
}
}
/*foreach ($consoleDB->getMocks() as $mock) {
var_dump($mock['name']);
}*/
\ksort($output['paths']);
$response