Moonchild Everlasting
04/04/2022, 1:26 PMMoonchild Everlasting
04/04/2022, 1:27 PMgenedy
04/04/2022, 3:42 PMMárcio Martins
04/04/2022, 3:43 PMTodor Majstorovic
04/04/2022, 4:54 PMTodor Majstorovic
04/04/2022, 4:54 PMHector Grecco
04/04/2022, 10:34 PMHector Grecco
04/04/2022, 10:34 PMKid Coder
04/05/2022, 5:44 AMFrankie Dox
04/05/2022, 5:46 AMAlihan aydın
04/05/2022, 10:04 AMproperty) email_?:_ string _|_
undefined
Type 'string | null | undefined' is not assignable to type 'string | undefined'.
Type 'null' is not assignable to type 'string | undefined'.ts(2322)
in this code _if_ (session) {
const result = await prisma.post.create({
data: {
title: title,
content: content,
author: { connect: { email: session?.user?.email } }
}
})
how can i fix this?
my schema prisma models: model
_Post_ {
id Int _@id_
_@default_(autoincrement())
title String
content String_?_
published Boolean _@default_(_false_)
author _User_
_@relation_(fields: [authorId], references: [id])
authorId Int
comments _Comment[]_
Tags _Tag[]_
_@relation_("TagToPost")
tagId Int_?_
}
model
_User_ {
id Int _@id_
_@default_(autoincrement())
name String_?_
email String _@unique_
_@default_("no email")
emailVerified DateTime_?_
_@map_("email_verified")
image String_?_
createdAt DateTime _@default_(now()) _@map_(name: "created_at")
updatedAt DateTime _@updatedAt_
_@map_(name: "updated_at")
posts _Post[]_
accounts _Account[]_
sessions _Session[]_
Comment _Comment[]_
_@@map_(name: "users")
}
user
04/05/2022, 2:00 PMSaaharjit Singh
04/05/2022, 4:24 PMMerlin G
04/05/2022, 4:33 PMInternal Server Error - Request ID: 01FZX93WCYBX4G5AY19NDJJ9BN
Glaucia Lemos
04/06/2022, 1:14 AMAlex Cavazos
04/06/2022, 3:09 AMwhere
clause that only returns rows where a specific column is null
?Slackbot
04/06/2022, 3:16 AMVignesh T.V.
04/06/2022, 7:01 AMfullTextSearch
Any idea why?haider shahid
04/06/2022, 12:45 PMuser
04/06/2022, 1:00 PMMoishi Netzer
04/06/2022, 1:49 PMMatias Vallone
04/06/2022, 2:52 PMinclude
field of a query and still retain the Typescript types?
eg:
export const findById = async (id: number, include: Prisma.ClaimInclude | undefined = undefined) => {
return dbClient.claim.findUnique({
where: {
id,
},
include,
})
}
and use it like this:
const claim = await findById(claimId , { assignedTo: true, })
currently I cannot access claim.assignedTo
Property 'assignedTo' does not exist on type 'Claim & {}'. Did you mean 'assignedToId'? ts(2551)thanks
trompx
04/06/2022, 3:07 PMAaron Waller
04/06/2022, 5:32 PMquery1: (parent, args) => {
return prisma.users.findMany({
where: {
age: {
gte: 20
},
profilepicture: true,
location: 'Germany'
}
})
}
and because the second user wants the same query but also wants to know if the person is active I have to create a complete new query for this case?
example2:
query2: (parent, args) => {
return prisma.users.findMany({
where: {
age: {
gte: 20
},
profilepicture: true,
location: 'Germany',
isActive: true
}
})
},
Kharann
04/06/2022, 5:53 PMapps/
and a packages/
folder. In apps/core-api
, I'm using packages/db
, which includes an index file that does export * from "@prisma/client@
. I'm however having trouble if important this re-export of prisma client. I get the requested module does not export a module named PrismaClient
or no default exports from @prisma/client
when trying to use default import. I'm running a monorepo with yarn workspace 3 and I do think that there might be a problem of finding the types? I'm not sure what to do. Would love an example. I'm also running full esm with nodemon --exec 'node --loader ts-node/esm --experimental-specifier-resolution=node src/index.ts'
as my run command.Arthur Cachero
04/06/2022, 9:03 PMHebilicious
04/07/2022, 2:40 AMJustin Ellingwood
04/07/2022, 10:04 AMMed
04/07/2022, 10:56 AM@unique
tag on that relation. I have removed the unique tag because we changed the structure of the DB however prisma migrate
does not see the change and says the schema is in sync with the DB but it is not as my db still has the unique foreign key constraint.
Anyway I can get the migrate
system to pick up this change to for the change of the constraint?Levi
04/07/2022, 1:25 PMerror - ../../packages/prisma/node_modules/@prisma/client/runtime/index.js:27652:0
Module not found: Can't resolve '_http_common'