Fix parameters
This commit is contained in:
parent
b78b71b260
commit
21dd2935dd
1 changed files with 9 additions and 12 deletions
|
@ -387,14 +387,14 @@ class Builder
|
||||||
|
|
||||||
$attributes['read'] = [
|
$attributes['read'] = [
|
||||||
'type' => Type::listOf(Type::string()),
|
'type' => Type::listOf(Type::string()),
|
||||||
'defaultValue' => ["user:$userId"],
|
'defaultValue' => ["role:member"],
|
||||||
'resolve' => function ($object, $args, $context, $info) use ($collectionId) {
|
'resolve' => function ($object, $args, $context, $info) use ($collectionId) {
|
||||||
return $object->getAttribute('$read');
|
return $object->getAttribute('$read');
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
$attributes['write'] = [
|
$attributes['write'] = [
|
||||||
'type' => Type::listOf(Type::string()),
|
'type' => Type::listOf(Type::string()),
|
||||||
'defaultValue' => ["user:$userId"],
|
'defaultValue' => ["role:member"],
|
||||||
'resolve' => function ($object, $args, $context, $info) use ($collectionId) {
|
'resolve' => function ($object, $args, $context, $info) use ($collectionId) {
|
||||||
return $object->getAttribute('$write');
|
return $object->getAttribute('$write');
|
||||||
}
|
}
|
||||||
|
@ -408,22 +408,22 @@ class Builder
|
||||||
$queryFields[$collectionId . 'List'] = [
|
$queryFields[$collectionId . 'List'] = [
|
||||||
'type' => $objectType,
|
'type' => $objectType,
|
||||||
'args' => $listArgs,
|
'args' => $listArgs,
|
||||||
'resolve' => self::queryList($collectionId, $dbForProject)
|
'resolve' => self::queryList($utopia, $request, $response, $dbForProject, $collectionId)
|
||||||
];
|
];
|
||||||
$mutationFields[$collectionId . 'Create'] = [
|
$mutationFields[$collectionId . 'Create'] = [
|
||||||
'type' => $objectType,
|
'type' => $objectType,
|
||||||
'args' => $attributes,
|
'args' => $attributes,
|
||||||
'resolve' => self::mutateCreate($collectionId, $dbForProject)
|
'resolve' => self::mutateCreate($utopia, $request, $response, $dbForProject, $collectionId)
|
||||||
];
|
];
|
||||||
$mutationFields[$collectionId . 'Update'] = [
|
$mutationFields[$collectionId . 'Update'] = [
|
||||||
'type' => $objectType,
|
'type' => $objectType,
|
||||||
'args' => $attributes,
|
'args' => $attributes,
|
||||||
'resolve' => self::mutateUpdate($collectionId, $dbForProject)
|
'resolve' => self::mutateUpdate($utopia, $request, $response, $dbForProject, $collectionId)
|
||||||
];
|
];
|
||||||
$mutationFields[$collectionId . 'Delete'] = [
|
$mutationFields[$collectionId . 'Delete'] = [
|
||||||
'type' => $objectType,
|
'type' => $objectType,
|
||||||
'args' => $idArgs,
|
'args' => $idArgs,
|
||||||
'resolve' => self::mutateDelete($collectionId, $dbForProject)
|
'resolve' => self::mutateDelete($utopia, $request, $response, $dbForProject, $collectionId)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$wg->done();
|
$wg->done();
|
||||||
|
@ -554,12 +554,9 @@ class Builder
|
||||||
function (callable $resolve, callable $reject) use ($utopia, $request, $response, $dbForProject, $collectionId, $type, $args) {
|
function (callable $resolve, callable $reject) use ($utopia, $request, $response, $dbForProject, $collectionId, $type, $args) {
|
||||||
$swooleRq = $request->getSwoole();
|
$swooleRq = $request->getSwoole();
|
||||||
|
|
||||||
$id = $args['id'] ?? 'unique()';
|
$id = $args['id'] ?? 'unique()'; unset($args['id']);
|
||||||
unset($args['id']);
|
$read = $args['read']; unset($args['read']);
|
||||||
$read = $args['read'];
|
$write = $args['write']; unset($args['write']);
|
||||||
unset($args['read']);
|
|
||||||
$write = $args['write'];
|
|
||||||
unset($args['write']);
|
|
||||||
|
|
||||||
$swooleRq->post = [
|
$swooleRq->post = [
|
||||||
'collectionId' => $collectionId,
|
'collectionId' => $collectionId,
|
||||||
|
|
Loading…
Reference in a new issue