nhost / hasura-backend-plus

🔑Auth and 📦Storage for Hasura. The quickest way to get Auth and Storage working for your next app based on Hasura.
https://nhost.github.io/hasura-backend-plus/
MIT License
1.17k stars 187 forks source link

See if user is online or not #521

Closed elitan closed 3 years ago

elitan commented 3 years ago

Users are logging in and refreshing tokens.

When this happens, we could update a new column auth.accounts.last_seen with now() and have a computed column auth.accounts.online that is something like: GENERATED ALWAYS AS (now() - 20 minutes < last_seen) STORED.

https://www.postgresql.org/docs/12/ddl-generated-columns.html

This way, it's easy to query who's online or show online status like:

query {
  users {
    id
    display_name
    account {
      id
      online
    }
  }
}
elitan commented 3 years ago

We’ve decided to only fix bugs and refactors on Hasura Backend Plus from now on because we’re working on a new auth + storage service for Hasura. Currently, these new repositories are private but will be open-sourced soon.


We’ll have your issue in mind when developing the new services. So thanks for filing this issue


This means I’ll close this issue for now.