Remove Synchronous execution model
This commit is contained in:
parent
256e9cebe3
commit
06448bbdc5
|
@ -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')
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue