M ZeeshanM
Convex Community17mo ago
2 replies
M Zeeshan

Cannot find module dataModel

error:
utils/convex.ts:11:27 - error TS2307: Cannot find module '@/convex/_generated/dataModel' or its corresponding type declarations.

11 import { DataModel } from '@/convex/_generated/dataModel';


import { DataModel } from '@/convex/_generated/dataModel';
import { GenericQueryCtx } from 'convex/server';

const getUser = async (ctx: GenericQueryCtx<DataModel>) => {
  const user = await ctx.auth.getUserIdentity();

  if (!user)
    throw customConvexError({
      type: 'unauthenticated',
      message: 'unauthenticaed request',
    });

  return user;
};

export const secureZodQuery = zCustomQuery(query, {
  args: {},
  input: async (ctx) => {
    const user = await getUser(ctx);

    return { ctx: { ...ctx, user }, args: {} };
  },
});
Was this page helpful?