mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
update: return keys.
This commit is contained in:
parent
7a53680786
commit
cabf32559a
7 changed files with 18 additions and 18 deletions
|
|
@ -118,7 +118,7 @@ class XList extends Action
|
|||
}
|
||||
|
||||
$response->dynamic(new Document([
|
||||
'attributes' => $columns,
|
||||
'columns' => $columns,
|
||||
'total' => $total,
|
||||
]), UtopiaResponse::MODEL_COLUMN_LIST);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,13 +123,13 @@ class Get extends Action
|
|||
|
||||
$response->dynamic(new Document([
|
||||
'range' => $range,
|
||||
'collectionsTotal' => $usage[$metrics[0]]['total'],
|
||||
'documentsTotal' => $usage[$metrics[1]]['total'],
|
||||
'tablesTotal' => $usage[$metrics[0]]['total'],
|
||||
'rowsTotal' => $usage[$metrics[1]]['total'],
|
||||
'storageTotal' => $usage[$metrics[2]]['total'],
|
||||
'databaseReadsTotal' => $usage[$metrics[3]]['total'],
|
||||
'databaseWritesTotal' => $usage[$metrics[4]]['total'],
|
||||
'collections' => $usage[$metrics[0]]['data'],
|
||||
'documents' => $usage[$metrics[1]]['data'],
|
||||
'tables' => $usage[$metrics[0]]['data'],
|
||||
'rows' => $usage[$metrics[1]]['data'],
|
||||
'storage' => $usage[$metrics[2]]['data'],
|
||||
'databaseReads' => $usage[$metrics[3]]['data'],
|
||||
'databaseWrites' => $usage[$metrics[4]]['data'],
|
||||
|
|
|
|||
|
|
@ -116,14 +116,14 @@ class XList extends Action
|
|||
$response->dynamic(new Document([
|
||||
'range' => $range,
|
||||
'databasesTotal' => $usage[$metrics[0]]['total'],
|
||||
'collectionsTotal' => $usage[$metrics[1]]['total'],
|
||||
'documentsTotal' => $usage[$metrics[2]]['total'],
|
||||
'tablesTotal' => $usage[$metrics[1]]['total'],
|
||||
'rowsTotal' => $usage[$metrics[2]]['total'],
|
||||
'storageTotal' => $usage[$metrics[3]]['total'],
|
||||
'databasesReadsTotal' => $usage[$metrics[4]]['total'],
|
||||
'databasesWritesTotal' => $usage[$metrics[5]]['total'],
|
||||
'databases' => $usage[$metrics[0]]['data'],
|
||||
'collections' => $usage[$metrics[1]]['data'],
|
||||
'documents' => $usage[$metrics[2]]['data'],
|
||||
'tables' => $usage[$metrics[1]]['data'],
|
||||
'rows' => $usage[$metrics[2]]['data'],
|
||||
'storage' => $usage[$metrics[3]]['data'],
|
||||
'databasesReads' => $usage[$metrics[4]]['data'],
|
||||
'databasesWrites' => $usage[$metrics[5]]['data'],
|
||||
|
|
|
|||
|
|
@ -150,17 +150,17 @@ class Update extends Action
|
|||
|
||||
$operations = 0;
|
||||
|
||||
$setTable = (function (Document $collection, Document $document) use (&$setTable, $dbForProject, $database, &$operations) {
|
||||
$setTable = (function (Document $table, Document $row) use (&$setTable, $dbForProject, $database, &$operations) {
|
||||
|
||||
$operations++;
|
||||
|
||||
$relationships = \array_filter(
|
||||
$collection->getAttribute('attributes', []),
|
||||
$table->getAttribute('attributes', []),
|
||||
fn ($attribute) => $attribute->getAttribute('type') === Database::VAR_RELATIONSHIP
|
||||
);
|
||||
|
||||
foreach ($relationships as $relationship) {
|
||||
$related = $document->getAttribute($relationship->getAttribute('key'));
|
||||
$related = $row->getAttribute($relationship->getAttribute('key'));
|
||||
|
||||
if (empty($related)) {
|
||||
continue;
|
||||
|
|
@ -212,9 +212,9 @@ class Update extends Action
|
|||
}
|
||||
|
||||
if ($isList) {
|
||||
$document->setAttribute($relationship->getAttribute('key'), \array_values($relations));
|
||||
$row->setAttribute($relationship->getAttribute('key'), \array_values($relations));
|
||||
} else {
|
||||
$document->setAttribute($relationship->getAttribute('key'), \reset($relations));
|
||||
$row->setAttribute($relationship->getAttribute('key'), \reset($relations));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ class XList extends Action
|
|||
|
||||
$response->dynamic(new Document([
|
||||
'total' => $total,
|
||||
'documents' => $rows,
|
||||
'rows' => $rows,
|
||||
]), UtopiaResponse::MODEL_ROW_LIST);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,8 +124,8 @@ class Get extends Action
|
|||
|
||||
$response->dynamic(new Document([
|
||||
'range' => $range,
|
||||
'documentsTotal' => $usage[$metrics[0]]['total'],
|
||||
'documents' => $usage[$metrics[0]]['data'],
|
||||
'rows' => $usage[$metrics[0]]['data'],
|
||||
'rowsTotal' => $usage[$metrics[0]]['total'],
|
||||
]), UtopiaResponse::MODEL_USAGE_COLLECTION);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class XList extends Action
|
|||
}
|
||||
|
||||
$response->dynamic(new Document([
|
||||
'collections' => $tables,
|
||||
'tables' => $tables,
|
||||
'total' => $total,
|
||||
]), UtopiaResponse::MODEL_TABLE_LIST);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue