feat: got locale_getContinents working
This commit is contained in:
parent
f378bcf48a
commit
f11e431341
|
@ -159,8 +159,6 @@ function getArgType(Validator $validator, bool $required) {
|
|||
function getArgs(array $params) {
|
||||
$args = [];
|
||||
foreach ($params as $key => $value) {
|
||||
var_dump("Key : ${key}");
|
||||
var_dump($value);
|
||||
$args[$key] = [
|
||||
'type' => getArgType($value['validator'],!$value['optional']),
|
||||
'description' => $value['description'],
|
||||
|
@ -183,22 +181,33 @@ function buildSchema($utopia, $response) {
|
|||
$methodName = $namespace.'_'.$route->getLabel('sdk.method', '');
|
||||
$responseModelName = $route->getLabel('sdk.response.model', Response::MODEL_NONE);
|
||||
|
||||
var_dump("******************************************");
|
||||
var_dump("Model Name : ${responseModelName}");
|
||||
// var_dump("******************************************");
|
||||
// var_dump("Model Name : ${responseModelName}");
|
||||
|
||||
if ( $responseModelName !== Response::MODEL_NONE && $responseModelName !== Response::MODEL_ANY ) {
|
||||
$responseModel = $response->getModel($responseModelName);
|
||||
createTypeMapping($responseModel, $response);
|
||||
|
||||
$args = getArgs($route->getParams());
|
||||
$fields[$methodName] = [
|
||||
'type' => $typeMapping[$responseModel->getType()],
|
||||
'description' => $route->getDesc(),
|
||||
'args' => getArgs($route->getParams()),
|
||||
'args' => $args,
|
||||
'resolve' => function ($args) use (&$utopia, $route, $response) {
|
||||
var_dump("************* REACHED RESOLVE *****************");
|
||||
var_dump($route);
|
||||
$utopia->execute($route, $args);
|
||||
var_dump("********************** ARGS *******************");
|
||||
var_dump($args);
|
||||
var_dump("**************** OUTPUT ************");
|
||||
var_dump($response->getPayload());
|
||||
return $response->getPayload();
|
||||
}
|
||||
];
|
||||
|
||||
// print_r($fields[$methodName]);
|
||||
var_dump("Processed route : {$route->getURL()}");
|
||||
// var_dump("Processed route : {$route->getURL()}");
|
||||
} else {
|
||||
var_dump("Skipping route : {$route->getURL()}");
|
||||
// var_dump("Skipping route : {$route->getURL()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,8 +241,7 @@ App::post('/v1/graphql')
|
|||
->inject('request')
|
||||
->inject('response')
|
||||
->inject('utopia')
|
||||
->inject('schema')
|
||||
->action(function ($request, $response, $utopia, $schema) {
|
||||
->action(function ($request, $response, $utopia) {
|
||||
// Generate the Schema of the server on startup.
|
||||
// Use the routes from utopia and get the params then construct the queries and mutations.
|
||||
|
||||
|
@ -246,6 +254,8 @@ App::post('/v1/graphql')
|
|||
$rootValue = [];
|
||||
$result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variables);
|
||||
$output = $result->toArray();
|
||||
var_dump("********** OUTPUT *********");
|
||||
var_dump($output);
|
||||
} catch (\Exception $error) {
|
||||
$output = [
|
||||
'errors' => [
|
||||
|
|
|
@ -190,6 +190,8 @@ App::get('/v1/locale/continents')
|
|||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Locale\Locale $locale */
|
||||
|
||||
var_dump("*************** IN LOCALE ************* ");
|
||||
|
||||
$list = $locale->getText('continents'); /* @var $list array */
|
||||
|
||||
\asort($list);
|
||||
|
|
|
@ -47,9 +47,12 @@ App::init(function ($utopia, $request, $response, $project, $user, $register, $e
|
|||
|
||||
//TODO make sure we get array here
|
||||
|
||||
foreach ($request->getParams() as $key => $value) { // Set request params as potential abuse keys
|
||||
$timeLimit->setParam('{param-'.$key.'}', (\is_array($value)) ? \json_encode($value) : $value);
|
||||
}
|
||||
|
||||
var_dump($request->getParams());
|
||||
|
||||
// foreach ($request->getParams() as $key => $value) { // Set request params as potential abuse keys
|
||||
// $timeLimit->setParam('{param-'.$key.'}', (\is_array($value)) ? \json_encode($value) : $value);
|
||||
// }
|
||||
|
||||
$abuse = new Abuse($timeLimit);
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ services:
|
|||
graphiql:
|
||||
container_name: graphiql
|
||||
ports:
|
||||
- '9505:4000'
|
||||
- '9506:4000'
|
||||
environment:
|
||||
- API_URL=http://localhost/v1/graphql
|
||||
image: npalm/graphiql
|
||||
|
|
|
@ -260,7 +260,7 @@ class Response extends SwooleResponse
|
|||
$output = self::getFilter()->parse($output, $model);
|
||||
}
|
||||
|
||||
$this->json(!empty($output) ? $output : new stdClass());
|
||||
// $this->json(!empty($output) ? $output : new stdClass());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue