prisma chobo
07/07/2021, 7:24 PMprisma.transaction.findMany({
skip,
take,
where: {
audience,
AND: [
{
accounts: {
some: {
id: accountId,
},
},
},
{
balance: {
some: {
accountId,
},
},
},
],
},
orderBy,
include: {
balance: true,
transfer: true,
payout: true,
fees: true,
fund: true,
},
});
}
gives me
{
"data": {
"transactions": [
{
"id": "ckqtnygnv0032z5vhbb04b2kh",
"type": "TRANSFER",
"description": "test transfer",
"transfer": {
"id": "ckqtnygnv0035z5vhthw2z65e",
"payee": {
"username": "justin",
"id": "ckqtn3kv70003ccvh1ufbyoxv"
},
"payor": {
"id": "ckqtne3lm0128ccvhmpiz9c26",
"username": "dustin"
}
},
"fund": null,
"balance": [
{
"id": "ckqtnygnv0033z5vhdlen44um",
"amount": 5000,
"account": {
"id": "ckqtn3kv70003ccvh1ufbyoxv",
"username": "justin"
}
},
{
"id": "ckqtnygnv0034z5vhvwwbr0z2",
"amount": -5000,
"account": {
"id": "ckqtne3lm0128ccvhmpiz9c26",
"username": "dustin"
}
}
]
}
]
}
}
But for balance entity, I only want to query balance.account.id == “ckqtn3kv70003ccvh1ufbyoxv”
If i change this part to
{
balance: {
some: {
accountId,
},
},
}
to this (some to every):
{
balance: {
every: {
accountId,
},
},
}
I get empty array… is there anything similar like
balance: {
accountId = "account id I want to query "
}Ryan
07/08/2021, 6:00 AMprisma.transaction.findMany({
skip,
take,
where: {
audience,
AND: [
{
accounts: {
some: {
id: accountId,
},
},
},
{
balance: {
some: {
accountId,
},
},
},
],
},
orderBy,
include: {
balance: { where: { accountId = "some-id" } },
transfer: true,
payout: true,
fees: true,
fund: true,
},
});prisma chobo
07/08/2021, 4:41 PM