Replace getCollectionFirst with getDocument
Should be faster due to redis caching
This commit is contained in:
parent
cdb8fb8286
commit
320cc97ad8
|
@ -993,15 +993,9 @@ App::get('/v1/account/sessions/:sessionId')
|
||||||
? Auth::sessionVerify($user->getAttribute('sessions'), Auth::$secret)
|
? Auth::sessionVerify($user->getAttribute('sessions'), Auth::$secret)
|
||||||
: $sessionId;
|
: $sessionId;
|
||||||
|
|
||||||
$session = $projectDB->getCollectionFirst([ // Get user by sessionId
|
$session = $projectDB->getDocument($sessionId); // get user by session ID
|
||||||
'limit' => 1,
|
|
||||||
'filters' => [
|
|
||||||
'$collection='.Database::SYSTEM_COLLECTION_SESSIONS,
|
|
||||||
'$id='.$sessionId,
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($session == false) {
|
if (empty($session->getId()) || Database::SYSTEM_COLLECTION_SESSIONS != $session->getCollection()) {
|
||||||
throw new Exception('Session not found', 404);
|
throw new Exception('Session not found', 404);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue