Prince
Prince
CCConvex Community
Created by Prince on 6/1/2024 in #support-community
Dashboard crashing, webhooks not receiving requests, and logs not showing on new project
No description
5 replies
CCConvex Community
Created by Prince on 5/22/2024 in #support-community
.paginate() result type returning a single document, not an array of documents
No description
7 replies
CCConvex Community
Created by Prince on 5/22/2024 in #support-community
Query type definition does not include all possible return scenarios
My query function is not returning all the possible values as a type definition (i.e. fullReportWithUser below), is this something I need to manually add with manual types or am I doing something wrong?
export const getReport = query({
args: { reportId: v.id("reports") },
handler: async (ctx, { reportId }) => {
const user = await currentUser(ctx, {})
const fullReport = await ctx.db.get(reportId)
if (!fullReport) return null
const { cost, recordingUrl, ...report } = fullReport
if (user?.admin) {
if (fullReport.userId) {
const reportUser = await ctx.db.get(fullReport.userId)
const fullReportWithUser = { ...fullReport, reportUser }
return fullReportWithUser
} else {
return fullReport
}
} else {
return report
}
},
})
export const getReport = query({
args: { reportId: v.id("reports") },
handler: async (ctx, { reportId }) => {
const user = await currentUser(ctx, {})
const fullReport = await ctx.db.get(reportId)
if (!fullReport) return null
const { cost, recordingUrl, ...report } = fullReport
if (user?.admin) {
if (fullReport.userId) {
const reportUser = await ctx.db.get(fullReport.userId)
const fullReportWithUser = { ...fullReport, reportUser }
return fullReportWithUser
} else {
return fullReport
}
} else {
return report
}
},
})
Thanks
44 replies