1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00

drop tags custom id support

This commit is contained in:
Damodar Lohani 2021-08-06 15:33:18 +05:45
parent 8c72349a3e
commit e0e5e3a818
5 changed files with 2 additions and 21 deletions

View file

@ -418,7 +418,6 @@ App::post('/v1/functions/:functionId/tags')
->label('sdk.response.code', Response::STATUS_CODE_CREATED) ->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_TAG) ->label('sdk.response.model', Response::MODEL_TAG)
->param('tagId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.')
->param('functionId', '', new UID(), 'Function unique ID.') ->param('functionId', '', new UID(), 'Function unique ID.')
->param('command', '', new Text('1028'), 'Code execution command.') ->param('command', '', new Text('1028'), 'Code execution command.')
->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false) ->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false)
@ -426,7 +425,7 @@ App::post('/v1/functions/:functionId/tags')
->inject('response') ->inject('response')
->inject('dbForInternal') ->inject('dbForInternal')
->inject('usage') ->inject('usage')
->action(function ($tagId, $functionId, $command, $file, $request, $response, $dbForInternal, $usage) { ->action(function ($functionId, $command, $file, $request, $response, $dbForInternal, $usage) {
/** @var Utopia\Swoole\Request $request */ /** @var Utopia\Swoole\Request $request */
/** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForInternal */ /** @var Utopia\Database\Database $dbForInternal */
@ -474,7 +473,7 @@ App::post('/v1/functions/:functionId/tags')
} }
$tag = $dbForInternal->createDocument('tags', new Document([ $tag = $dbForInternal->createDocument('tags', new Document([
'$id' => $tagId == 'unique()' ? $dbForInternal->getId() : $tagId, '$id' => $dbForInternal->getId(),
'$read' => [], '$read' => [],
'$write' => [], '$write' => [],
'functionId' => $function->getId(), 'functionId' => $function->getId(),

View file

@ -634,18 +634,6 @@ $usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
<input type="hidden" name="functionId" data-ls-bind="{{router.params.id}}" /> <input type="hidden" name="functionId" data-ls-bind="{{router.params.id}}" />
<label for="tagId">Tag Id</label>
<input
type="hidden"
data-custom-id
data-id-type="custom"
data-validator="functions.getTag"
required
maxlength="36"
id="tagId"
name="tagId"
placeholder="node main.js" />
<label for="tag-command">Command</label> <label for="tag-command">Command</label>
<input type="text" id="tag-command" name="command" required autocomplete="off" class="margin-bottom" placeholder="node main.js" /> <input type="text" id="tag-command" name="command" required autocomplete="off" class="margin-bottom" placeholder="node main.js" />

View file

@ -77,7 +77,6 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'], 'x-appwrite-key' => $this->getProject()['apiKey'],
], [ ], [
'tagId' => 'unique()',
'command' => 'php index.php', 'command' => 'php index.php',
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'), 'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
]); ]);
@ -160,7 +159,6 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId, 'x-appwrite-project' => $projectId,
'x-appwrite-key' => $apikey, 'x-appwrite-key' => $apikey,
], [ ], [
'tagId' => 'unique()',
'command' => 'php index.php', 'command' => 'php index.php',
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php-fn.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'), //different tarball names intentional 'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php-fn.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'), //different tarball names intentional
]); ]);

View file

@ -183,7 +183,6 @@ class FunctionsCustomServerTest extends Scope
'content-type' => 'multipart/form-data', 'content-type' => 'multipart/form-data',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'tagId' => 'unique()',
'command' => 'php index.php', 'command' => 'php index.php',
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'), 'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/php.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
]); ]);
@ -480,7 +479,6 @@ class FunctionsCustomServerTest extends Scope
'content-type' => 'multipart/form-data', 'content-type' => 'multipart/form-data',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'tagId' => 'unique()',
'command' => $command, 'command' => $command,
'code' => new CURLFile($code, 'application/x-gzip', basename($code)), 'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
]); ]);
@ -560,7 +558,6 @@ class FunctionsCustomServerTest extends Scope
'content-type' => 'multipart/form-data', 'content-type' => 'multipart/form-data',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'tagId' => 'unique()',
'command' => $command, 'command' => $command,
'code' => new CURLFile($code, 'application/x-gzip', basename($code)), 'code' => new CURLFile($code, 'application/x-gzip', basename($code)),
]); ]);

View file

@ -404,7 +404,6 @@ class WebhooksCustomServerTest extends Scope
'content-type' => 'multipart/form-data', 'content-type' => 'multipart/form-data',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'tagId' => 'unique()',
'command' => 'php index.php', 'command' => 'php index.php',
'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/timeout.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'), 'code' => new CURLFile(realpath(__DIR__ . '/../../../resources/functions/timeout.tar.gz'), 'application/x-gzip', 'php-fx.tar.gz'),
]); ]);