mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 17:08:45 +00:00
Added documents list model
This commit is contained in:
parent
3c8ff92e14
commit
f38f83ab77
2 changed files with 14 additions and 15 deletions
|
|
@ -7,9 +7,6 @@ use Utopia\Validator\WhiteList;
|
|||
use Utopia\Validator\Text;
|
||||
use Utopia\Validator\ArrayList;
|
||||
use Utopia\Validator\JSON;
|
||||
// use Utopia\Locale\Locale;
|
||||
// use Utopia\Audit\Audit;
|
||||
// use Utopia\Audit\Adapters\MySQL as AuditAdapter;
|
||||
use Appwrite\Database\Database;
|
||||
use Appwrite\Database\Document;
|
||||
use Appwrite\Database\Validator\UID;
|
||||
|
|
@ -403,24 +400,24 @@ App::get('/v1/database/collections/:collectionId/documents')
|
|||
]),
|
||||
]);
|
||||
|
||||
if (App::isDevelopment()) {
|
||||
$collection
|
||||
->setAttribute('debug', $projectDB->getDebug())
|
||||
->setAttribute('limit', $limit)
|
||||
->setAttribute('offset', $offset)
|
||||
->setAttribute('orderField', $orderField)
|
||||
->setAttribute('orderType', $orderType)
|
||||
->setAttribute('orderCast', $orderCast)
|
||||
->setAttribute('filters', $filters)
|
||||
;
|
||||
}
|
||||
// if (App::isDevelopment()) {
|
||||
// $collection
|
||||
// ->setAttribute('debug', $projectDB->getDebug())
|
||||
// ->setAttribute('limit', $limit)
|
||||
// ->setAttribute('offset', $offset)
|
||||
// ->setAttribute('orderField', $orderField)
|
||||
// ->setAttribute('orderType', $orderType)
|
||||
// ->setAttribute('orderCast', $orderCast)
|
||||
// ->setAttribute('filters', $filters)
|
||||
// ;
|
||||
// }
|
||||
|
||||
$collection
|
||||
->setAttribute('sum', $projectDB->getSum())
|
||||
->setAttribute('documents', $list)
|
||||
;
|
||||
|
||||
$response->json($collection->getArrayCopy(/*['$id', '$collection', 'name', 'documents']*/[], ['rules']));
|
||||
$response->dynamic($collection, Response::MODEL_DOCUMENT_LIST);
|
||||
}, ['response', 'projectDB']);
|
||||
|
||||
App::get('/v1/database/collections/:collectionId/documents/:documentId')
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ class Response extends SwooleResponse
|
|||
const MODEL_COLLECTION = 'collection';
|
||||
const MODEL_COLLECTION_LIST = 'collectionList';
|
||||
const MODEL_RULE = 'rule';
|
||||
const MODEL_DOCUMENT_LIST = 'documentList';
|
||||
|
||||
// Users
|
||||
const MODEL_USER = 'user';
|
||||
|
|
@ -120,6 +121,7 @@ class Response extends SwooleResponse
|
|||
->setModel(new ErrorDev())
|
||||
// Lists
|
||||
->setModel(new BaseList('Collections List', self::MODEL_COLLECTION_LIST, 'collections', self::MODEL_COLLECTION))
|
||||
->setModel(new BaseList('Documents List', self::MODEL_DOCUMENT_LIST, 'documents', self::MODEL_ANY))
|
||||
->setModel(new BaseList('Users List', self::MODEL_USER_LIST, 'users', self::MODEL_USER))
|
||||
->setModel(new BaseList('Sessions List', self::MODEL_SESSION_LIST, 'sessions', self::MODEL_SESSION))
|
||||
->setModel(new BaseList('Logs List', self::MODEL_LOG_LIST, 'logs', self::MODEL_LOG, false))
|
||||
|
|
|
|||
Loading…
Reference in a new issue