Nathan Froese
10/25/2022, 10:30 PMDavid Hancu
10/25/2022, 10:45 PMDuckyDev
10/26/2022, 6:45 AMprisma introspect
, however, whoever made the database is not consistent with table and column names, sometimes a space
is used to separate words, another time _
is used, and all columns are ALL CAPITAL LETTERS.
Is there a way to let Prisma map
this to something sane to work with overtime automatically so I don’t have to do that myself?Akbar
10/26/2022, 10:24 AMTS: 4.8.4
Prisma: 4.4.0
Node: v16.15.0
Thanks a bunch!SKhan
10/26/2022, 12:06 PMenum Type {
ONEOFF
FREQUENT
}
model A {
type Type? @default(ONEOFF)
b B[]
...
}
model B {
a A? @relation(fields: [aId], references: [id], onDelete: Cascade)
aId String?
endDate Date?
...
}
How would I create a query to get:
• all data from model A
where type === "FREQUENT"
AND
• only get data from model B
where type === "ONEOFF"
& endDate === null
?
Will I have to create 2 queries for each scenario & then concat them?Dan Calise
10/26/2022, 2:27 PMapp
folder with Prisma? I’m not sure it will work as getServerSideProps
and getStaticProps
are no longer used. Seems like we’re forced to use fetch
Lukas Vogel
10/26/2022, 4:04 PMLukas Vogel
10/26/2022, 4:06 PMLukas Vogel
10/26/2022, 4:07 PMmodel product {
id Int @id @default(autoincrement())
stripeId String
artikelNr String
name String
active String
description String?
image String?
hersteller String?
category String?
subcategory String?
stripePriceId String
price Int
currency String
}
Gezim
10/26/2022, 4:24 PMGezim
10/26/2022, 4:24 PMKay Khan
10/26/2022, 6:03 PMJordan
10/26/2022, 6:11 PM夏の雪Official
10/26/2022, 6:58 PMMarcus
10/26/2022, 7:16 PMSebastian M.D.
10/26/2022, 9:30 PMJohn Bradens
10/27/2022, 1:08 AM{
me {
id
name
}
}
;
and when I do const { data } = useQuery(ME_QUERY);
console.log(data);
I get undefined. Please let me know if you'd like me to share any more infoJohn Bradens
10/27/2022, 1:09 AMJohn Bradens
10/27/2022, 1:10 AMfunction me(parent, args, context) {
const id = getUserId(context);
return context.prisma.user({ id });
}
John Bradens
10/27/2022, 1:16 AMquery {
me {
id
name
}
}
, I get errors. How do I get it to show me the username that is logged in?John Bradens
10/27/2022, 1:16 AMJohn Bradens
10/27/2022, 2:58 AMJohn Bradens
10/27/2022, 2:59 AMfunction getUserId(context) {
const Authorization = context.request.get("Authorization");
console.log("hello");
console.log(context.request);
if (Authorization) {
const token = Authorization.replace("Bearer ", "");
const { userId } = jwt.verify(token, process.env.APP_SECRET);
return userId;
}
throw new AuthError();
}
class AuthError extends Error {
constructor() {
super("Not authorized");
}
}
// function getUserId(req, authToken) {
// if (req) {
// const authHeader = req.headers.authorization;
// if (authHeader) {
// const token = authHeader.replace("Bearer ", "");
// if (!token) {
// throw new Error("No token found");
// }
// const { userId } = getTokenPayload(token);
// return userId;
// }
// } else if (authToken) {
// const { userId } = getTokenPayload(authToken);
// return userId;
// }
// throw new Error("Not authenticated");
// }
Cường Vũ
10/27/2022, 3:29 AMdb push
without losing data ?Nik
10/27/2022, 4:13 AMNik
10/27/2022, 4:13 AMNik
10/27/2022, 4:45 AMNik
10/27/2022, 4:46 AMDivya Jain
10/27/2022, 7:17 AMoriginalError": {
"is_panic": false,
"message": "Transaction API error: Transaction already closed: Transaction is no longer valid. Last state: 'Expired'.",
"meta": {
"error": "Transaction already closed: Transaction is no longer valid. Last state: 'Expired'."
},
"error_code": "P2028",
"clientVersion": "3.15.2"
},
I have been facing this issue when there are multiple queries in a transaction.
I tried to increased the timeout for some its working but for some its not
I referred to this thread https://github.com/prisma/prisma/issues/13713.
Then I even updated the Prisma version to 4.1.1 that also not helping that also referred from another thread
If anyone has any insights on how to resolve it. Please do share.Mark
10/27/2022, 7:41 AMfindMany
with a Prisma.ModelName.
But I get the following error: Each member of the union type has signatures
const modelName = 'todoItem';
return client[modelName].findMany(undefined);
I have a playground here