0
Follow
0
View

Missing field in available args

donkey18 注册会员
2023-01-26 01:32

You are trying to use nest createMany which isn't supported. This is from the documentation:

As an alternative I would suggest to create users inside the loop while you are creating data.

async function generateUsers() {
  const users = [];

  for (let i = 0; i < randomUsersCount; i++) {
      users[i] = {
          first_name: faker.name.firstName(),
          last_name: faker.name.lastName(),
          email: faker.internet.email(),
          password: await hashPassword('testtest'),
          phone: faker.phone.phoneNumber('###-###-###'),
          role: 'USER',
          is_blocked: false,
          user_settings : {
              create: {
                  language: 'PL',
                  color: faker.internet.color(),
              }
          }
      };

      await prisma.user.create({
        data: users[i],
    });
  }

}

About the Author

Question Info

Publish Time
2023-01-26 01:32
Update Time
2023-01-26 01:32