mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Fix empty projects
Some checks failed
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Runs E2E API Tests / build (22.6) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.6) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Publish Docs / run (push) Has been cancelled
Some checks failed
Runs E2E API Tests / build (20.x) (push) Has been cancelled
Runs E2E API Tests / build (22.6) (push) Has been cancelled
Lint & build / lint_and_build (20.x) (push) Has been cancelled
Lint & build / lint_and_build (22.6) (push) Has been cancelled
TOC Generator / TOC Generator (push) Has been cancelled
Mirror main branch to main-mirror-for-wdb / lint_and_build (push) Has been cancelled
Publish Docs / run (push) Has been cancelled
This commit is contained in:
parent
49724b4823
commit
703e6ea01d
@ -122,6 +122,11 @@ export const getUserLastActiveAtMillis = async (userId: string, fallbackTo: numb
|
||||
|
||||
// same as userIds.map(userId => getUserLastActiveAtMillis(userId, fallbackTo)), but uses a single query
|
||||
export const getUsersLastActiveAtMillis = async (userIds: string[], fallbackTo: (number | Date)[]): Promise<number[]> => {
|
||||
if (userIds.length === 0) {
|
||||
// Prisma.join throws an error if the array is empty, so we need to handle that case
|
||||
return [];
|
||||
}
|
||||
|
||||
const events = await prismaClient.$queryRaw<Array<{ userId: string, lastActiveAt: Date }>>`
|
||||
SELECT data->>'userId' as "userId", MAX("createdAt") as "lastActiveAt"
|
||||
FROM "Event"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user