Robin Genz
Robin Genz
Explore posts from servers
CDCloudflare Developers
Created by Robin Genz on 10/3/2024 in #general-help
Unable to access the “Billable usage” page
No description
5 replies
DTDrizzle Team
Created by Robin Genz on 8/22/2024 in #help
Filter included relations
I am currently using the following query to retrieve all undeleted appBundles from my database:
const selectedAppBundles = await db.query.appBundles.findMany({
where: (appBundles, { isNull }) => isNull(appBundles.deletedAt),
orderBy: (appBundles, { desc }) => desc(appBundles.createdAt),
offset,
limit,
with: {
appChannel: true,
},
});
const selectedAppBundles = await db.query.appBundles.findMany({
where: (appBundles, { isNull }) => isNull(appBundles.deletedAt),
orderBy: (appBundles, { desc }) => desc(appBundles.createdAt),
offset,
limit,
with: {
appChannel: true,
},
});
Each appBundle can be assigned to an appChannel. Currently, all undeleted appBundles are returned, regardless of whether the associated appChannel has been deleted or not. In the future, I only want to query appBundles whose appChannel is not deleted, if one is assigned. Unfortunately, the following does not work:
const selectedAppBundles = await db.query.appBundles.findMany({
where: (appBundles, { and, isNull }) => and(isNull(appBundles.deletedAt), isNull(appChannels.deletedAt)),
orderBy: (appBundles, { desc }) => desc(appBundles.createdAt),
offset,
limit,
with: {
appChannel: true,
},
});
const selectedAppBundles = await db.query.appBundles.findMany({
where: (appBundles, { and, isNull }) => and(isNull(appBundles.deletedAt), isNull(appChannels.deletedAt)),
orderBy: (appBundles, { desc }) => desc(appBundles.createdAt),
offset,
limit,
with: {
appChannel: true,
},
});
What is the best way to implement this?
1 replies