Patrik
Patrik
Explore posts from servers
DTDrizzle Team
Created by dayo on 1/12/2025 in #help
Need help inferring types of nested model
Have you specified relations?
11 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
have you checked it works or no?
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
perhaps its just TS error?
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
how ur func getTableColumns looks like
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
but it should work
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
if that wont work try to set columns without function getTableColumns
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
like that
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
.select({
...getTableColumns(reviews),
performance: {
time: performances.time,
artist: {
...getTableColumns(artists),
},
venue: {
...getTableColumns(venues),
},
},
reviewer: {
firstName: users.firstName,
lastName: users.lastName,
},
commentsCount: ctx.db
.$count(reviewComments, eq(reviewComments.reviewId, reviews.id))
.as('commentsCount'),
})
})
.select({
...getTableColumns(reviews),
performance: {
time: performances.time,
artist: {
...getTableColumns(artists),
},
venue: {
...getTableColumns(venues),
},
},
reviewer: {
firstName: users.firstName,
lastName: users.lastName,
},
commentsCount: ctx.db
.$count(reviewComments, eq(reviewComments.reviewId, reviews.id))
.as('commentsCount'),
})
})
23 replies
DTDrizzle Team
Created by ayyjohn on 12/30/2024 in #help
how to nest select statement to achieve aliased result
im not sure i understood you right but db.select its plain object you can manipulate it how you want
23 replies
DTDrizzle Team
Created by brynthrax on 12/21/2024 in #help
Nested relation filtering
thx
9 replies
DTDrizzle Team
Created by brynthrax on 12/21/2024 in #help
Nested relation filtering
so instead of this
await db.query.portfolioFavouritesTable.findMany({
columns: {},
with: {
portfolioCase: {
columns: {
id: true,
slug: true,
color: true,
status: true
},
},
},
where: eq(portfolioFavouritesTable.userUid, userID),
orderBy: (favs, { desc }) => [desc(favs.createdAt)]
})
await db.query.portfolioFavouritesTable.findMany({
columns: {},
with: {
portfolioCase: {
columns: {
id: true,
slug: true,
color: true,
status: true
},
},
},
where: eq(portfolioFavouritesTable.userUid, userID),
orderBy: (favs, { desc }) => [desc(favs.createdAt)]
})
we need to use this?
await db
.select({
id: portfolioTable.id,
slug: portfolioTable.slug,
color: portfolioTable.color,
status: portfolioTable.status,
})
.from(portfolioTable)
.innerJoin(portfolioFavouritesTable, eq(portfolioFavouritesTable.portfolioId, portfolioTable.id))
.where(
and(
eq(portfolioFavouritesTable.userUid, userID),
eq(portfolioTable.status, 'published')
)
)
.orderBy(desc(portfolioFavouritesTable.createdAt))
await db
.select({
id: portfolioTable.id,
slug: portfolioTable.slug,
color: portfolioTable.color,
status: portfolioTable.status,
})
.from(portfolioTable)
.innerJoin(portfolioFavouritesTable, eq(portfolioFavouritesTable.portfolioId, portfolioTable.id))
.where(
and(
eq(portfolioFavouritesTable.userUid, userID),
eq(portfolioTable.status, 'published')
)
)
.orderBy(desc(portfolioFavouritesTable.createdAt))
9 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
both
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
yea
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
It's still there?
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
You can also call that composable inside a dashboard header component
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
Don't need to check it just call the method
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
Yes
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
I've send you the docs
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
But without get current user
75 replies
NNuxt
Created by o.m on 12/17/2024 in #❓・help
Why is it when I refresh the page I get api calls error?
And use user object here
75 replies