export const authenticatedQuery = customQuery(
queryRaw, // The base function we're extending
{
args: {
// This type makes sure we can't just forget to pass the clerkOrgId
clerkOrgId: v.string(),
userTokenIdentifier: v.optional(v.string()),
},
input: async (ctx, args) => {
const { user, workspace } = await enhanceClientAuthContext(
ctx,
args.clerkOrgId,
args.userTokenIdentifier
);
// Authorization checks should be done on the specific query function based on the info added to the context
return { ctx: { user, workspace }, args: { ...args } };
},
}
);
export const authenticatedQuery = customQuery(
queryRaw, // The base function we're extending
{
args: {
// This type makes sure we can't just forget to pass the clerkOrgId
clerkOrgId: v.string(),
userTokenIdentifier: v.optional(v.string()),
},
input: async (ctx, args) => {
const { user, workspace } = await enhanceClientAuthContext(
ctx,
args.clerkOrgId,
args.userTokenIdentifier
);
// Authorization checks should be done on the specific query function based on the info added to the context
return { ctx: { user, workspace }, args: { ...args } };
},
}
);