import { api } from '../betterAuth/_generated/api'
/**
* Get user info by userId (internal query)
*/
export const _internalGetUserInfo = internalQuery({
args: {
userId: v.string(),
},
returns: v.union(
v.object({
email: v.string(),
name: v.string(),
}),
v.null(),
),
handler: async (ctx, args) => {
try {
// Use the adapter's findOne to query the better-auth user table
// This works without authentication since we're querying directly
const user = await ctx.runQuery(api.adapter.findOne, {
model: 'user',
where: [
{
field: 'id',
operator: 'eq',
value: args.userId,
},
],
})
import { api } from '../betterAuth/_generated/api'
/**
* Get user info by userId (internal query)
*/
export const _internalGetUserInfo = internalQuery({
args: {
userId: v.string(),
},
returns: v.union(
v.object({
email: v.string(),
name: v.string(),
}),
v.null(),
),
handler: async (ctx, args) => {
try {
// Use the adapter's findOne to query the better-auth user table
// This works without authentication since we're querying directly
const user = await ctx.runQuery(api.adapter.findOne, {
model: 'user',
where: [
{
field: 'id',
operator: 'eq',
value: args.userId,
},
],
})