1
0
Fork 0
mirror of synced 2024-06-14 16:54:52 +12:00

Remove Synchronous execution model

This commit is contained in:
Bradley Schofield 2022-02-24 12:58:10 +00:00
parent 256e9cebe3
commit 06448bbdc5
3 changed files with 11 additions and 56 deletions

View file

@ -967,11 +967,20 @@ App::post('/v1/functions/:functionId/executions')
}
Authorization::skip(fn() => $dbForProject->updateDocument('executions', $executionId, $execution));
$executionResponse['response'] = ($executionResponse['status'] !== 'completed') ? $executionResponse['stderr'] : $executionResponse['stdout'];
$executionResponse['$id'] = $executionId;
$executionResponse['$read'] = $execution->getAttribute('$read', []);
$executionResponse['$write'] = $execution->getAttribute('$write', []);
$executionResponse['functionId'] = $function->getId();
$executionResponse['dateCreated'] = $execution->getAttribute('dateCreated');
$executionResponse['trigger'] = $execution->getAttribute('trigger');
$executionResponse['status'] = $execution->getAttribute('status');
$executionResponse['statusCode'] = $execution->getAttribute('statusCode');
$executionResponse['time'] = $execution->getAttribute('time');
$response
->setStatusCode(Response::STATUS_CODE_CREATED)
->dynamic(new Document($executionResponse), Response::MODEL_SYNC_EXECUTION);
->dynamic(new Document($executionResponse), Response::MODEL_EXECUTION);
});
App::get('/v1/functions/:functionId/executions')

View file

@ -156,7 +156,6 @@ class Response extends SwooleResponse
const MODEL_DEPLOYMENT = 'deployment';
const MODEL_DEPLOYMENT_LIST = 'deploymentList';
const MODEL_EXECUTION = 'execution';
const MODEL_SYNC_EXECUTION = 'syncExecution';
const MODEL_EXECUTION_LIST = 'executionList';
const MODEL_BUILD = 'build';
const MODEL_BUILD_LIST = 'buildList';

View file

@ -1,53 +0,0 @@
<?php
namespace Appwrite\Utopia\Response\Model;
use Appwrite\Utopia\Response;
use Appwrite\Utopia\Response\Model;
class SyncExecution extends Model
{
public function __construct()
{
$this
->addRule('status', [
'type' => self::TYPE_STRING,
'description' => 'Execution Status.',
'default' => '',
'example' => 'completed',
])
->addRule('response', [
'type' => self::TYPE_STRING,
'description' => 'Execution Response.',
'default' => '',
'example' => 'Hello World!',
])
->addRule('time', [
'type' => self::TYPE_INTEGER,
'description' => 'Execution Time.',
'default' => 0,
'example' => 100,
])
;
}
/**
* Get Name
*
* @return string
*/
public function getName():string
{
return 'Syncronous Execution';
}
/**
* Get Collection
*
* @return string
*/
public function getType():string
{
return Response::MODEL_SYNC_EXECUTION;
}
}