refactor: improve import order and code formatting
- Reordered and grouped imports consistently in backend and frontend files for better readability. - Applied indentation and formatting fixes across frontend components, services, and backend modules. - Adjusted multiline method calls and type definitions for improved clarity.
This commit is contained in:
@@ -31,10 +31,7 @@ export class MessagesController {
|
||||
}
|
||||
|
||||
@Post()
|
||||
sendMessage(
|
||||
@Req() req: AuthenticatedRequest,
|
||||
@Body() dto: CreateMessageDto,
|
||||
) {
|
||||
sendMessage(@Req() req: AuthenticatedRequest, @Body() dto: CreateMessageDto) {
|
||||
return this.messagesService.sendMessage(req.user.sub, dto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
import {
|
||||
ForbiddenException,
|
||||
Injectable,
|
||||
NotFoundException,
|
||||
} from "@nestjs/common";
|
||||
import { ForbiddenException, Injectable } from "@nestjs/common";
|
||||
import { EventsGateway } from "../realtime/events.gateway";
|
||||
import type { CreateMessageDto } from "./dto/create-message.dto";
|
||||
import { MessagesRepository } from "./repositories/messages.repository";
|
||||
|
||||
@@ -20,9 +20,7 @@ export class MessagesRepository {
|
||||
conversationParticipants,
|
||||
eq(conversations.id, conversationParticipants.conversationId),
|
||||
)
|
||||
.where(
|
||||
inArray(conversationParticipants.userId, [userId1, userId2])
|
||||
)
|
||||
.where(inArray(conversationParticipants.userId, [userId1, userId2]))
|
||||
.groupBy(conversations.id)
|
||||
.having(sql`count(${conversations.id}) = 2`);
|
||||
|
||||
@@ -90,16 +88,13 @@ export class MessagesRepository {
|
||||
eq(conversations.id, conversationParticipants.conversationId),
|
||||
)
|
||||
.innerJoin(users, eq(conversationParticipants.userId, users.uuid))
|
||||
.leftJoin(
|
||||
messages,
|
||||
eq(conversations.id, messages.conversationId)
|
||||
)
|
||||
.leftJoin(messages, eq(conversations.id, messages.conversationId))
|
||||
.where(
|
||||
and(
|
||||
inArray(conversations.id, userConvs),
|
||||
eq(conversationParticipants.userId, users.uuid),
|
||||
sql`${users.uuid} != ${userId}`
|
||||
)
|
||||
sql`${users.uuid} != ${userId}`,
|
||||
),
|
||||
)
|
||||
.orderBy(desc(conversations.updatedAt));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user