FUTC
06/15/2022, 3:23 PMupdate
call, is it possible to do some sort of select: { all }
instead of manually selecting each field like this?
select: {
id: true,
name: true,
street: true,
zipCode: true,
city: true,
person: true,
email: true,
telNr: true,
faxNr: true,
},
Moin Akhter
06/15/2022, 3:26 PMMoaaz
06/15/2022, 6:55 PMUral Bayhan
06/15/2022, 8:03 PMKay Khan
06/15/2022, 8:11 PMbackend/
prisma/
schema.prisma
frontend/
I wanted to share types between the frontend and backend and because its a monorepo i can simply create shared
folder.
shared/
backend/
frontend/
if i want to reuse types that are generated by Prisma in the frontend whilst also using them in the backend, how might i do this?
Does this even make sense to do, "should" i move the prisma stuff over to the shared directory? Or should i really be creating a new seperate type for my api responses, even though in majority of the cases im simply returning a 1:1 of table columns and object fields.Gezim
06/15/2022, 10:50 PMdata
param?
For example:
const store = await this.prisma.store.create({
include: { accounts: true, shopifyOfflineSession: true },
data: {
...options,
}
}
I’ve not tested it thoroughly but it feels that types aren’t strictly checked like this.Junyu Yang
06/15/2022, 11:48 PMconst pendingRequest = await prisma.connection_request.findFirst({
where: {
initiator_id: targetUserProfileId,
requested_id: authUserProfileId,
}
})
But throw error
Type ‘{ initiator_id: any; requested_id: number; }’ is not assignable to type ‘connection_requestWhereUniqueInput’.
Object literal may only specify known properties, and ‘initiator_id’ does not exist in type ‘connection_requestWhereUniqueInput’.
when I do
await prisma.connection_request.update({
where: {
initiator_id: targetUserProfileId,
requested_id: authUserProfileId,
},
data: {
confirmed_at: new Date(),
},
})
How can I fix it?Junyu Yang
06/15/2022, 11:51 PMupdate
the record has to be unique…
The schema does have a that forced tho.
@@unique([initiator_id, requested_id], map: "connection_request_idx_initiator_id_requested_id")
Brook MG
06/16/2022, 5:56 AMuser
06/16/2022, 10:40 AMJijin P
06/16/2022, 4:58 PMAlbin Groen
06/17/2022, 6:49 AMAarav Shah
06/17/2022, 12:00 PMAaron Waller
06/17/2022, 6:16 PMreturn prisma.post.findMany({
where: {
author: {
followers: {
followerId: args.uid
}
}
},
include: {
author: {
include: {
followers: {
where: {
followerId: args.uid
},
}
}
}
}
})
But unfortunately it tells me `"Unknown arg followers
in where.author.followers for type UserRelationFilter. Available args:",`
More in threadDebaucus
06/17/2022, 9:20 PMDebaucus
06/17/2022, 9:21 PMBernardo Trindade Abreu
06/18/2022, 12:43 AMMoin Akhter
06/18/2022, 11:51 AMSlackbot
06/18/2022, 3:29 PMIvan Lukianchuk
06/18/2022, 6:20 PMError validating datasource `db`: the URL must start with the protocolorpostgresql://
postgres://
To use a URL with protocolBut as per the docs, I have added the line "PRISMA_GENERATE_DATAPROXY=true" into my .env.production, yet somehow it just seems ignored?the Data Proxy must be enabled viaprisma://
.prisma generate --data-proxy
Greg Renfro
06/18/2022, 8:29 PMPrisma User
06/18/2022, 9:45 PMAaron Waller
06/18/2022, 9:46 PMreturn prisma.post.findMany({
where: {
author: {
some: {
followers: {
followerId: {
equals: args.userId
}
}
}
}
},
include: {
author: {
include: {
followers: {
include: {
follower: true
}
}
}
}
}
})
But unfortunately it tells me "Unknown arg some
in where.author.some"
(Schema in thread)Berian Chaiwa
06/19/2022, 2:03 PMNditah Samweld
06/19/2022, 3:02 PMunique
input field phone
NULL
instead of "`undefined`" for missing input.
PostgreSQL guarantees uniqueness even for NULL
fields but not for undefined
values.
model User {
id String @id @default(cuid())
email String @unique
phone String? @unique
@@map(name: "user")
}
Dog
06/19/2022, 3:52 PMmodel Image {
id Int @id @default(autoincrement())
publicId String
width Int
height Int
url String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Moin Akhter
06/19/2022, 6:09 PMEric Fletcher
06/19/2022, 8:26 PMTri Nguyen
06/19/2022, 9:55 PMprisma.people.findMany({ where: { what here? }})