-
-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to query all sessions of a user? #510
Comments
Mature frameworks like |
Hi @OrkhanAlikhanov, Thank you for submitting this issue.
Indeed it is currently not possible. This is definitely a feature that is missing in the framework and that will be added in the future. In a next release, we will be able to retrieve (and even limit) the session(s) of a given user. The solution will be compatible with any session store (including cache database such as redis). I'll take a deeper a look at Laravel to get inspired 😉 |
Amazing! Here is the table that Laravel uses for DB store. From docs Schema::create('sessions', function ($table) {
$table->string('id')->unique();
$table->unsignedInteger('user_id')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity');
}); I believe |
Resolved in v2 |
Let's say I've used
TypeORMStore
for sessions, how can I query all sessions of a user? TheuserId
seems to be stored in a json string insessionContent
column.foal/packages/typeorm/src/typeorm-store.service.ts
Lines 30 to 37 in 647ea2d
There seems no reliable and easy way to query a user's sessions. It would be great if could store
userId
in a different columns so that we could doselect * from foal_session where userId = 1
The text was updated successfully, but these errors were encountered: