1
0
Fork 0
mirror of synced 2024-09-29 08:51:28 +13:00

All collection create params should be required

This commit is contained in:
eldadfux 2019-10-13 23:19:32 +03:00
parent 4ce95242fc
commit c1d908e2be

View file

@ -95,9 +95,9 @@ $utopia->post('/v1/database')
->label('sdk.method', 'createCollection') ->label('sdk.method', 'createCollection')
->label('sdk.description', '/docs/references/database/create-collection.md') ->label('sdk.description', '/docs/references/database/create-collection.md')
->param('name', '', function () { return new Text(256); }, 'Collection name.') ->param('name', '', function () { return new Text(256); }, 'Collection name.')
->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).', true) ->param('read', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with read permissions. [Learn more about permissions and roles](/docs/permissions).')
->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. [Learn more about permissions and roles](/docs/permissions).', true) ->param('write', [], function () { return new ArrayList(new Text(64)); }, 'An array of strings with write permissions. [Learn more about permissions and roles](/docs/permissions).')
->param('rules', [], function () use ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation', true) ->param('rules', [], function () use ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation')
->action( ->action(
function ($name, $read, $write, $rules) use ($response, $projectDB, $webhook, $audit) { function ($name, $read, $write, $rules) use ($response, $projectDB, $webhook, $audit) {
$parsedRules = []; $parsedRules = [];