relationships / joins
export const getDiagrams = query({
args: {},
handler: async (ctx) => {
const identity = await ctx.auth.getUserIdentity();
if (!identity) {
throw new Error("Unauthorized");
}
const userId = identity.subject;
const dashboard = await ctx.db
.query("diagrams")
.withIndex("by_user", (q) => q.eq("userId", userId))
.filter((q) => q.eq(q.field("isArchived"), false))
.collect();
return dashboard;
},
});
i have a relationship in the entities, linked to the diagramId. Is there any way to retreive them all at once ?
