This commit is contained in:
2026-03-05 19:14:23 +03:00
parent 0cf6865b0d
commit b7bbef47eb
7 changed files with 29 additions and 23 deletions

View File

@@ -147,7 +147,6 @@ class GrpcClient {
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition)
const messageProto = protoDescriptor.message as any
this.messageClient = new messageProto.MessageService('localhost:8070', grpc.credentials.createInsecure())
// console.log(this.messageClient)
}
// User

View File

@@ -23,25 +23,13 @@ export async function login(req: Request) {
const accessToken = await createAccessToken(user.id, user.email)
const expires = new Date(Date.now() + config.cookieExpiry * 1000)
// const sessionCookie = new Bun.Cookie('token', accessToken.token, {
// path: '/',
// expires: expires,
// maxAge: config.cookieExpiry,
// httpOnly: true,
// secure: true,
// sameSite: 'strict',
// })
return Response.json(
{
accessToken: accessToken.token,
tokenType: 'Bearer',
expires: expires,
},
{
status: HttpStatusCodes.CREATED,
// headers: { 'Set-Cookie': sessionCookie.toString() }
},
{ status: HttpStatusCodes.CREATED },
)
} catch (error) {
console.log({ error })

View File

@@ -23,7 +23,7 @@ const server = Bun.serve({
async open(ws) {
try {
const ipAddr = ws.remoteAddress
// console.log('ipAddr', ipAddr)
console.log('ipAddr', ipAddr)
const user = ws.data
@@ -69,8 +69,8 @@ const server = Bun.serve({
}
if (o.type === 'GET_MESSAGES') {
const messages = await client.listMessage({ user_id: ws.data.userId, chat_id: o.data.chat_id, page: 1 })
server.publish(o.data.chat_id, JSON.stringify({ type: 'MESSAGES', ...messages }))
const messages = await client.listMessage({ user_id: ws.data.userId, chat_id: o.data.chatId, page: 1 })
server.publish(o.data.chatId, JSON.stringify({ type: 'MESSAGES', ...messages }))
}
if (o.type === 'GET_USERS') {

View File

@@ -21,7 +21,7 @@ export type LoginDto = { email: string }
interface ListMessages {
type: 'GET_MESSAGES'
data: {
chat_id: string
chatId: string
}
}