style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+5 -6
View File
@@ -2,7 +2,7 @@
* Model Chat - Representa uma conversa entre comprador e vendedor
*/
import mongoose, { Schema, model, models } from "mongoose";
import { model, models, Schema } from "mongoose";
export interface IChat {
chat_id: string; // ID único: `${listing_id}_${buyer_id}_${seller_id}`
@@ -16,7 +16,7 @@ export interface IChat {
buyer_unread_count: number;
seller_unread_count: number;
is_active: boolean; // Chat ativo (anúncio ainda disponível)
// Dados cached do anúncio (para performance)
listing_cache: {
item_name: string;
@@ -27,14 +27,14 @@ export interface IChat {
server_name: string;
listing_status: string;
};
// Dados cached dos usuários
buyer_cache: {
user_id: number;
username: string;
character_name?: string;
};
seller_cache: {
user_id: number;
username: string;
@@ -120,7 +120,7 @@ const ChatSchema = new Schema<IChat>(
{
timestamps: false, // Usamos campos manuais
collection: "chats",
}
},
);
// Índices compostos para queries eficientes
@@ -135,4 +135,3 @@ ChatSchema.pre("save", function (next) {
});
export const Chat = models.Chat || model<IChat>("Chat", ChatSchema);
+5 -5
View File
@@ -2,7 +2,7 @@
* Model Message - Representa uma mensagem em um chat
*/
import mongoose, { Schema, model, models } from "mongoose";
import { model, models, Schema } from "mongoose";
export interface IMessage {
chat_id: string; // Referência ao chat
@@ -12,7 +12,7 @@ export interface IMessage {
read_at: Date | null; // Quando foi lida
edited_at: Date | null; // Se foi editada
deleted_at: Date | null; // Soft delete
// Metadados
message_type: "text" | "system"; // System para mensagens automáticas
metadata?: {
@@ -69,7 +69,7 @@ const MessageSchema = new Schema<IMessage>(
{
timestamps: false, // Usamos campos manuais
collection: "messages",
}
},
);
// Índices compostos para queries eficientes
@@ -77,5 +77,5 @@ MessageSchema.index({ chat_id: 1, created_at: -1 }); // Para buscar mensagens de
MessageSchema.index({ chat_id: 1, sender_id: 1, created_at: -1 });
MessageSchema.index({ sender_id: 1, created_at: -1 });
export const Message = models.Message || model<IMessage>("Message", MessageSchema);
export const Message =
models.Message || model<IMessage>("Message", MessageSchema);