sessions static method

Future<Response> sessions(
  1. Request request
)

GET /auth/sessions: every live session of the signed-in person on this tenant, newest sign-in first, with this one marked current.

Implementation

static Future<Response> sessions(Request request) => _guard(() async {
      final DVSessionPrincipal? principal = DVSessionPrincipal.current;
      if (principal == null) return _unauthenticated();
      return _json(200, <String, Object?>{
        'sessions': <Object?>[
          for (final DVSession s in await _own(principal))
            <String, Object?>{
              ...s.toJson(),
              'isCurrent': s.id == principal.session.id,
            },
        ],
      });
    });