Skip to content
Back

activity

  • 0
  • Users
  • Functions
  • Self Hosted
Rassvet
19 Sep, 2023, 19:17

Hello! I am trying to determine users who are currently active. Not just logged in, but active and my thought process involves create a server side function that loops through the activity log of the last 30 minutes of each users. and I have created a collection that will update their status as active or inactive depending on the activity logs length.

Can you please guide me on the Query I need to make? I have the current time and thiry minutes prev time in milliseconds const response = users.listLogs(userId, [Query(...)])

Thank you so much

TL;DR
The user is seeking guidance on querying for active users based on activity logs. They have a server-side function that loops through the logs of the last 30 minutes and updates users' status as active or inactive. They need help constructing the query. The solution is to use a datetime attribute in UTC timezone and pass it as an ISO formatted string in the query. For example: const response = users.listLogs(userId, [Query(datetimeAttribute >= "ISO-formatted-string")]).
Drake
19 Sep, 2023, 19:59

If you're querying against a datetime attribute, you'll need to pass a iso formatted string in UTC timezone

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more