Hi all i need some help. below is my schema file....
# orm-help
n
Hi all i need some help. below is my schema file.
Copy code
model User {
  id       Int     @default(autoincrement()) @id
  email    String? @unique
  fullName String?
  password String?
  userRole String?
  advertise Advertiser
}

model Advertiser {
  id                   Int      @default(autoincrement()) @id
  companyContactNumber String?
  companyName          String?
  location             String?
  registeredNumber     Int?
  verified             Boolean?
  userId               Int
  createdBy            User @relation(fields: [userId], references: [id])
  campaigns   Campaign[]
}
not sure why this create query doesn't work
Copy code
const advertiser = await prisma.advertiser.create({
      data: {
        companyName,
        registeredNumber,
        location,
        companyContactNumber,
        createdBy: {
          connect: {
            userId: 1,
          },
        },
      },
    });
The error i get is
Copy code
[  Error: Invalid `prisma.advertiser.create()` invocation:
  {
    data: {
      companyName: 'nischal Company2',
      registeredNumber: 12232,
      location: 'kathmandu, Nepal 1231',
      companyContactNumber: '980113405222',
      createdBy: {
        connect: {
          userId: 1
          ~~~~~~
        }
      }
    }
  }
  Unknown arg `userId` in data.createdBy.connect.userId for type UserWhereUniqueInput. Did you mean `id`? Available args  :