© 2026 Hedgehog Software, LLC
export const exampleQuery = query({ args: { slug: v.string() }, handler: async (ctx, { slug }) => { const organizationId = await ctx.runQuery(components.betterAuth.organisations.getOrganisationIdBySlug, { slug }); if (!organizationId) { return { success: false }; } const { auth, headers } = await authComponent.getAuth(createAuth, ctx); const allowed = await auth.api.hasPermission({ headers, body: { organizationId, permissions: { organization: ["update"] } }, }); // do query and return results }, });
// do query...
const { auth, headers } = await authComponent.getAuth(createAuth, ctx);