Nested orderBy

Here's my function. I have an edge table, CompanyAdmins, which bridges the Company table and Users table.
function getCompanyAdminsByCompanyIdList(idList) {
return db.company.findMany({
relationLoadStrategy: 'join',
where: { id: { in: idList } },
include: {
CompanyAdmins: {
include: {
User: {
orderBy: [
{ firstName: 'asc' },
{ lastName: 'asc' },
]
}
},
},
},
orderBy: {
name: 'asc',
}
});
function getCompanyAdminsByCompanyIdList(idList) {
return db.company.findMany({
relationLoadStrategy: 'join',
where: { id: { in: idList } },
include: {
CompanyAdmins: {
include: {
User: {
orderBy: [
{ firstName: 'asc' },
{ lastName: 'asc' },
]
}
},
},
},
orderBy: {
name: 'asc',
}
});
Type assist kinda confirms it's not possible, but I need it sorted by company.name and then by user.FirstName and user.lastName which in theory this should accomplish, but well I'm here... so it doesn't hah console output
62 function getCompanyAdminsByCompanyIdList(idList) {
→ 63 return db.company.findMany({
relationLoadStrategy: "join",
where: {
id: {
in: [
"03829f3f-d5bd-44ab-b412-51f2e0a59728"
]
}
},
include: {
CompanyAdmins: {
include: {
User: {
orderBy: [
~~~~~~~
{
firstName: "asc"
},
{
lastName: "asc"
}
]
}
}
}
},
orderBy: {
name: "asc"
}
})

Unknown argument `orderBy`.
62 function getCompanyAdminsByCompanyIdList(idList) {
→ 63 return db.company.findMany({
relationLoadStrategy: "join",
where: {
id: {
in: [
"03829f3f-d5bd-44ab-b412-51f2e0a59728"
]
}
},
include: {
CompanyAdmins: {
include: {
User: {
orderBy: [
~~~~~~~
{
firstName: "asc"
},
{
lastName: "asc"
}
]
}
}
}
},
orderBy: {
name: "asc"
}
})

Unknown argument `orderBy`.
1 Reply
Yetzederixx
YetzederixxOP2mo ago
Gotta pick up granddaughter from school. afk a bit
Want results from more Discord servers?
Add your server