findAllRolesByUser()
This function is designed to retrieve all the roles assigned to a specific user within a system. This function is useful for querying and obtaining information about the roles associated with a particular user.
Here is an Example:
import { createBackendFunction, utils } from "@magicjs.dev/backend"
export default createBackendFunction(
async function (userId) {
const roles = await utils.findAllRolesByUser(String(userId))
return { message: "Roles fetched", roles }
},
)
Last updated