Tenantid optional

This commit is contained in:
Adria Navarro 2023-09-19 12:08:59 +02:00
parent 6f1d027126
commit 7b4585ce68
1 changed files with 2 additions and 1 deletions

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