mirror of
https://github.com/appwrite/appwrite
synced 2026-05-22 00:18:25 +00:00
Defer mutate update to mutate create
This commit is contained in:
parent
87333e2eb0
commit
71a0cb59b5
1 changed files with 8 additions and 10 deletions
|
|
@ -596,17 +596,15 @@ class Builder
|
|||
);
|
||||
}
|
||||
|
||||
private static function mutateUpdate(string $collectionId, Database $dbForProject): callable
|
||||
private static function mutateUpdate(
|
||||
App $utopia,
|
||||
Request $request,
|
||||
Response $response,
|
||||
Database $dbForProject,
|
||||
string $collectionId
|
||||
): callable
|
||||
{
|
||||
return fn($type, $args, $context, $info) => new CoroutinePromise(
|
||||
function (callable $resolve, callable $reject) use ($collectionId, $type, $args, $dbForProject) {
|
||||
try {
|
||||
$resolve($dbForProject->updateDocument($collectionId, $args['id'], new Document($args)));
|
||||
} catch (\Throwable $e) {
|
||||
$reject($e);
|
||||
}
|
||||
}
|
||||
);
|
||||
return self::mutateCreate($utopia, $request, $response, $dbForProject, $collectionId);
|
||||
}
|
||||
|
||||
private static function mutateDelete(string $collectionId, Database $dbForProject): callable
|
||||
|
|
|
|||
Loading…
Reference in a new issue