1
0
Fork 0
mirror of synced 2024-07-20 21:55:54 +12:00

Tenantid optional

This commit is contained in:
Adria Navarro 2023-09-19 12:08:59 +02:00
parent 6f1d027126
commit 7b4585ce68

View file

@ -110,7 +110,7 @@ export async function getUser(
* @param {*} tenantId the tenant of the users to get
* @returns
*/
export async function getUsers(userIds: string[], tenantId: string) {
export async function getUsers(userIds: string[], tenantId?: string) {
const client = await redis.getUserClient()
// try cache
let usersFromCache = await client.bulkGet(userIds)
@ -118,6 +118,7 @@ export async function getUsers(userIds: string[], tenantId: string) {
const users = Object.values(usersFromCache)
if (missingUsersFromCache.length) {
tenantId ??= context.getTenantId()
const usersFromDb = await populateUsersFromDB(
missingUsersFromCache,
tenantId