Shmuel
12/29/2021, 2:17 PMPrismaClientValidationError: Unknown arg `follower` in data.followers.create.0.follower for type FollowsCreateWithoutFollowerInput. Did you mean `following`?
Argument following for data.followers.create.0.following is missing.
I posted this question with more details on stackoverflow https://stackoverflow.com/questions/70520589/prisma-many-to-many-self-relation-error-due-to-relation-and-generated-type-inpu
If anyone has any ideas I would greatly appreciate it.
Thanks in advance.Muhannad
12/29/2021, 2:48 PMconnectOrCreate ?Shmuel
12/29/2021, 2:53 PMMuhannad
12/29/2021, 2:55 PMShmuel
12/29/2021, 2:55 PMfollowers relationship on the Follows table generates a FollowsCreateWithoutFollowerInput and I don't believe that makes sense. It should create a FollowsCreateWithoutFollowingInput since when a Person has followers then they are the following (the one being followed) and we just don't know who the follower is, so the input should contain the value for the followerMuhannad
12/29/2021, 3:21 PMMuhannad
12/29/2021, 3:24 PMconst person = await prisma.person.create({
data: {
followers: {
create: {
followingId: 1,
},
},
},
});
return person;Muhannad
12/29/2021, 3:29 PMShmuel
12/29/2021, 3:35 PMi am just curios why do u need to create person then add followers to the same person !I want to add that person's followers, (the people that are following that person). If your question is why would I want that. I can switch the example around to something more intuitive. Where I create a person and add who they're
following . I would still get the same error.
could you please try this !That works, but I'm trying to add
followerId: 1 not followingId. When adding followers, the created person is the one being followed (followingId). So I don't need to input that id, I already know it.
could you please tell me what you are trying to do hereCreate a person and add followers to them.
Muhannad
12/29/2021, 4:27 PMShmuel
12/29/2021, 4:31 PMMuhannad
12/29/2021, 4:51 PMconst person1 = await prisma.person.create({
data: {
name: 'Jone Doe1',
following: {
create: {
followerId: 1,
},
},
},
});
OR
const person2 = await prisma.person.create({
data: {
name: 'Jone Doe2',
followers: {
create: {
followingId: 1,
},
},
},
});
return { person1, person2 };Muhannad
12/29/2021, 4:55 PMtest is following Jone Doe2
Jone Doe1 is following test
<--------------><--------------><--------------><--------->
test have one follower and following one person
<--------------><--------------><--------------><--------->Shmuel
12/29/2021, 4:56 PMfollowing why would I input the followerId, the current person is the follower. I want to input the followingId .
Is what I'm saying making sense?Shmuel
12/29/2021, 5:00 PMfollowerId should be the id of the follower (of Jone Doe1 not of test ). The follower is the one who is following the other person, so if Jone Doe1 is following test like you say, then the followerId should be 2 not 1.
I think this may be a bug in Prisma, do you agree with what I'm saying?Yaakov
12/29/2021, 8:32 PMYaakov
12/29/2021, 8:41 PMperson.following returns the followers and calling person.followers return the person's followees. I'd suggest you open an issue with Prisma.Shmuel
12/29/2021, 9:09 PM