1
0
Fork 0
mirror of synced 2024-06-18 18:54:55 +12:00

Replace getCollectionFirst with getDocument

Should be faster due to redis caching
This commit is contained in:
Bradley Schofield 2021-06-16 12:48:33 +01:00
parent cdb8fb8286
commit 320cc97ad8

View file

@ -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);
}; };