parent
8c53875992
commit
48d30d71d6
3 changed files with 18 additions and 17 deletions
|
@ -9,6 +9,7 @@ use Utopia\Validator\Range;
|
|||
use Utopia\Validator\WhiteList;
|
||||
use Utopia\Validator\Text;
|
||||
use Utopia\Validator\ArrayList;
|
||||
use Utopia\Validator\JSON;
|
||||
use Utopia\Locale\Locale;
|
||||
use Utopia\Audit\Audit;
|
||||
use Utopia\Audit\Adapters\MySQL as AuditAdapter;
|
||||
|
@ -351,7 +352,7 @@ $utopia->post('/v1/database/collections/:collectionId/documents')
|
|||
->label('sdk.method', 'createDocument')
|
||||
->label('sdk.description', '/docs/references/database/create-document.md')
|
||||
->param('collectionId', null, function () { return new UID(); }, 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/database?platform=server#createCollection).')
|
||||
->param('data', [], function () { return new \Utopia\Validator\Mock(); }, 'Document data as JSON object.')
|
||||
->param('data', [], function () { return new JSON(); }, 'Document data as JSON object.')
|
||||
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
|
||||
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.')
|
||||
->param('parentDocument', '', function () { return new UID(); }, 'Parent document unique ID. Use when you want your new document to be a child of a parent document.', true)
|
||||
|
@ -359,7 +360,7 @@ $utopia->post('/v1/database/collections/:collectionId/documents')
|
|||
->param('parentPropertyType', Document::SET_TYPE_ASSIGN, function () { return new WhiteList([Document::SET_TYPE_ASSIGN, Document::SET_TYPE_APPEND, Document::SET_TYPE_PREPEND]); }, 'Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document.', true)
|
||||
->action(
|
||||
function ($collectionId, $data, $read, $write, $parentDocument, $parentProperty, $parentPropertyType) use ($response, $projectDB, $webhook, $audit) {
|
||||
$data = (is_string($data) && $result = json_decode($data, true)) ? $result : $data; // Cast to JSON array
|
||||
$data = (is_string($data)) ? json_decode($data, true) : $data; // Cast to JSON array
|
||||
|
||||
if (empty($data)) {
|
||||
throw new Exception('Missing payload', 400);
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
|
||||
"appwrite/php-clamav": "1.0.*",
|
||||
|
||||
"utopia-php/framework": "0.2.*",
|
||||
"utopia-php/framework": "0.3.*",
|
||||
"utopia-php/abuse": "0.2.*",
|
||||
"utopia-php/audit": "0.3.*",
|
||||
"utopia-php/cache": "0.2.*",
|
||||
"utopia-php/cli": "0.5.*",
|
||||
"utopia-php/cli": "0.6.*",
|
||||
"utopia-php/config": "0.2.*",
|
||||
"utopia-php/locale": "0.2.*",
|
||||
"utopia-php/registry": "0.2.*",
|
||||
|
|
24
composer.lock
generated
24
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "e93c84ab77f0085004222c942dcba6f4",
|
||||
"content-hash": "001a9336198793f293f83f62df2b7567",
|
||||
"packages": [
|
||||
{
|
||||
"name": "appwrite/php-clamav",
|
||||
|
@ -1452,21 +1452,21 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/cli",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/cli.git",
|
||||
"reference": "c66255fed87f00c5a8f7cc0c482cdb082260cd32"
|
||||
"reference": "e636c61ac4d0cf7539be332adba9dd9889dc300e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/cli/zipball/c66255fed87f00c5a8f7cc0c482cdb082260cd32",
|
||||
"reference": "c66255fed87f00c5a8f7cc0c482cdb082260cd32",
|
||||
"url": "https://api.github.com/repos/utopia-php/cli/zipball/e636c61ac4d0cf7539be332adba9dd9889dc300e",
|
||||
"reference": "e636c61ac4d0cf7539be332adba9dd9889dc300e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"utopia-php/framework": "0.2.*"
|
||||
"utopia-php/framework": "0.3.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0"
|
||||
|
@ -1496,7 +1496,7 @@
|
|||
"upf",
|
||||
"utopia"
|
||||
],
|
||||
"time": "2020-05-05T09:02:10+00:00"
|
||||
"time": "2020-06-18T19:28:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/config",
|
||||
|
@ -1596,16 +1596,16 @@
|
|||
},
|
||||
{
|
||||
"name": "utopia-php/framework",
|
||||
"version": "0.2.0",
|
||||
"version": "0.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/framework.git",
|
||||
"reference": "e3d88b794badbd5ededcf62d708b31009111f860"
|
||||
"reference": "9c3bb4fb69ab85d3d5ba76f334d682845dc4815c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/framework/zipball/e3d88b794badbd5ededcf62d708b31009111f860",
|
||||
"reference": "e3d88b794badbd5ededcf62d708b31009111f860",
|
||||
"url": "https://api.github.com/repos/utopia-php/framework/zipball/9c3bb4fb69ab85d3d5ba76f334d682845dc4815c",
|
||||
"reference": "9c3bb4fb69ab85d3d5ba76f334d682845dc4815c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1636,7 +1636,7 @@
|
|||
"php",
|
||||
"upf"
|
||||
],
|
||||
"time": "2020-03-08T15:42:21+00:00"
|
||||
"time": "2020-06-18T19:23:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/locale",
|
||||
|
|
Loading…
Reference in a new issue