Tenantid optional
This commit is contained in:
parent
6f1d027126
commit
7b4585ce68
|
@ -110,7 +110,7 @@ export async function getUser(
|
||||||
* @param {*} tenantId the tenant of the users to get
|
* @param {*} tenantId the tenant of the users to get
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export async function getUsers(userIds: string[], tenantId: string) {
|
export async function getUsers(userIds: string[], tenantId?: string) {
|
||||||
const client = await redis.getUserClient()
|
const client = await redis.getUserClient()
|
||||||
// try cache
|
// try cache
|
||||||
let usersFromCache = await client.bulkGet(userIds)
|
let usersFromCache = await client.bulkGet(userIds)
|
||||||
|
@ -118,6 +118,7 @@ export async function getUsers(userIds: string[], tenantId: string) {
|
||||||
const users = Object.values(usersFromCache)
|
const users = Object.values(usersFromCache)
|
||||||
|
|
||||||
if (missingUsersFromCache.length) {
|
if (missingUsersFromCache.length) {
|
||||||
|
tenantId ??= context.getTenantId()
|
||||||
const usersFromDb = await populateUsersFromDB(
|
const usersFromDb = await populateUsersFromDB(
|
||||||
missingUsersFromCache,
|
missingUsersFromCache,
|
||||||
tenantId
|
tenantId
|
||||||
|
|
Loading…
Reference in New Issue