admin管理员组

文章数量:1123509

My nestjs prisma orm error does not inline with my code. An error in my console is different from what I have in my code. I have deleted my nodemodules, yarnlock file and reinstall, same error every time. I checked prisma docs and I implimented the same thing they have but I still got same error. What could go wrong?

I got this error:

const [total, courses] = await this.databaseService.$transaction([
→ 190   this.databaseService.courses.count({
          select: {
            _count: {
              select: {
                _all: true
              }
            }
          },
        + take: Int
        })

Argument `take` is missing.

But my code does not use the select clause. I have deleted my nodemodules and reinstall, same isuue.

my code:

  async findAllCourses(page: number = 1, limit: number = 10, filters?: any) {
    const skip = (page - 1) * limit;
    const take = limit;

    const where: Prisma.coursesWhereInput = { deleted: false };

    if (filters.college_id) {
      where.college_id = filters.college_id;
    }

    if (filters.title) {
      where.title = {
        contains: filters.title,
        mode: 'insensitive',
      };
    }

    if (filters.level) {
      where.level = filters.level;
    }

    const [total, courses] = await this.databaseService.$transaction([
      this.databaseService.courses.count(),
      this.databaseService.courses.findMany({
        where,
        include: {
          college: true,
          course_modules: {
            include: {
              assignment: {
                include: {
                  questions: true,
                },
              },
              test: {
                include: {
                  questions: true,
                },
              },
              exam: {
                include: {
                  questions: true,
                },
              },
              live_class: true,
            },
          },
        },
        skip,
        take,
      }),
    ]);

    return {
      total,
      page,
      limit,
      data: courses,
    };
  }

本文标签: