Uncle
PPrisma
•Created by Uncle on 9/2/2024 in #help-and-questions
Validator questions
I'm trying to operate partial type of my User model as I omit the passwordHash field at instantiation. When I follow the docs I end up with the
select
included in the type, this is from my sveltekit app:
Property 'givenName' does not exist on type '{ select: { email: true; givenName: true; }; }'.ts(2339)
13 replies
PPrisma
•Created by Uncle on 8/17/2024 in #help-and-questions
Module '"prisma/prisma-client"' has no exported member 'PrismaClient'.
I'm suddenly getting this error from typescript and I don't know what's changed. I'm also no longer getting autocomplete in VSCode. I've restarted my computer and regenerated the client a few times. I'm at a loss on how to troubleshoot this. Studio works fine. My seed file works fine.
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient({
omit:{
user: {
passwordHash: true
}
}
})
export default prisma
4 replies
PPrisma
•Created by Uncle on 7/21/2024 in #help-and-questions
Help with findFirst and none relations
I'm working on seeding my database for a self storage and I'm trying to randomly select a customer with no leases and assign them a lease. This is my code and it's alway returning the same customer:
const customer = await prisma.user.findFirst({
where: {
customerLeases: {
none: {}
}
},
select: {
id: true,
contactInfo: true,
},
});
When I seed the database one customer ends up with all the leases. I assume from the docs that this is how I should be searching for a customer with no leases so I don't understand what I'm doing wrong. Any help would be greatly appreciated17 replies