get session by userid
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user