mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 08:58:35 +00:00
Merge pull request #3543 from appwrite/fix-functions-usage
Fix: function usage missing
This commit is contained in:
commit
c94871b5ef
1 changed files with 8 additions and 1 deletions
|
|
@ -806,7 +806,8 @@ App::post('/v1/functions/:functionId/executions')
|
|||
->inject('dbForProject')
|
||||
->inject('user')
|
||||
->inject('events')
|
||||
->action(function (string $functionId, string $data, bool $async, Response $response, Document $project, Database $dbForProject, Document $user, Event $events) {
|
||||
->inject('usage')
|
||||
->action(function (string $functionId, string $data, bool $async, Response $response, Document $project, Database $dbForProject, Document $user, Event $events, Stats $usage) {
|
||||
|
||||
$function = Authorization::skip(fn () => $dbForProject->getDocument('functions', $functionId));
|
||||
|
||||
|
|
@ -958,6 +959,12 @@ App::post('/v1/functions/:functionId/executions')
|
|||
|
||||
Authorization::skip(fn () => $dbForProject->updateDocument('executions', $executionId, $execution));
|
||||
|
||||
$usage
|
||||
->setParam('functionId', $function->getId())
|
||||
->setParam('functionExecution', 1)
|
||||
->setParam('functionStatus', $execution->getAttribute('status', ''))
|
||||
->setParam('functionExecutionTime', $execution->getAttribute('time') * 1000); // ms
|
||||
|
||||
$response
|
||||
->setStatusCode(Response::STATUS_CODE_CREATED)
|
||||
->dynamic($execution, Response::MODEL_EXECUTION);
|
||||
|
|
|
|||
Loading…
Reference in a new issue