get session by userid

This commit is contained in:
2026-03-31 14:44:08 +02:00
parent 2b5c105abb
commit c5b3ee3875

View File

@@ -26,11 +26,8 @@ export const chatRouter = router({
throw new TRPCError({ message: "failed to create session", code: "INTERNAL_SERVER_ERROR" });
}
session = await db.query.chatSession.findFirst({
with: {
messages: true
},
where(fields, operators) {
return operators.eq(fields.id, newSession.id)
return operators.eq(fields.userId, userId)
},
})
if (session == undefined) {