deleteSessions method
Future<List<DeletedSession> >
deleteSessions(
- Session session, {
- UuidValue? authUserId,
- UuidValue? serverSideSessionId,
- String? method,
- Transaction? transaction,
Deletes the sessions matching the given filters.
If authUserId is provided, only sessions for that user will be deleted.
If method is provided, only sessions created with that method will be deleted.
If serverSideSessionId is provided, only the session with that ID will be deleted.
Returns a list with DeletedSessions.
Implementation
Future<List<DeletedSession>> deleteSessions(
final Session session, {
final UuidValue? authUserId,
final UuidValue? serverSideSessionId,
final String? method,
final Transaction? transaction,
}) async {
final serverSideSessions = await ServerSideSession.db.deleteWhere(
session,
where: (final row) {
Expression<dynamic> expression = Constant.bool(true);
if (authUserId != null) {
expression &= row.authUserId.equals(authUserId);
}
if (serverSideSessionId != null) {
expression &= row.id.equals(serverSideSessionId);
}
if (method != null) {
expression &= row.method.equals(method);
}
return expression;
},
transaction: transaction,
);
return serverSideSessions
.map(
(final session) => (
authUserId: session.authUserId,
sessionId: session.id!,
),
)
.toList();
}