Skip to content

Commit 12d2c04

Browse files
molde de datos necesarios para chats cache
movido a frotnend para evitar pedirlo a ipc
1 parent 725d19e commit 12d2c04

4 files changed

Lines changed: 10 additions & 19 deletions

File tree

backend/STORAGE/modelo_datos_necesarios_chat.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

backend/ipc/chat_ipc.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
} from '../repositories/MessageRepository.js';
2828
import { Revisar_Buzon_Usuario } from '../repositories/BuzonRepository.js';
2929
import { crearCacheChatActivo, obtenerCacheChatActivo } from '../STORAGE/CACHE/_cache_chat_activo.js';
30-
import { modelo_datos_necesarios_chat } from '../STORAGE/modelo_datos_necesarios_chat.js';
3130
import { iniciarBuzon } from '../services/buzonAPI.js';
3231
import { comprobar_mensaje, comprobar_nombre_archivo } from '../services/validadores.js';
3332
const authorizedPaths = new Set();
@@ -150,8 +149,4 @@ export function registerChatHandlers(mainWindow, socket) {
150149
ipcMain.handle("obtener-cache-chat-activo", async (_, id, bloque) => {
151150
return obtenerCacheChatActivo(id, bloque)
152151
})
153-
154-
ipcMain.handle("obtener-modelo-datos-necesarios-chat", async () => {
155-
return modelo_datos_necesarios_chat
156-
})
157152
}

frontend/home/ui/gestor_chats.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ import {
1818
manejar_solicitud_chat
1919
} from './mensajes_eventos.js';
2020

21+
const MODELO_DATOS_NECESARIOS_CHAT = {
22+
nombre: null,
23+
usuarios: null,
24+
admins: null,
25+
fecha_creacion: null,
26+
nmensajes: null
27+
};
28+
2129
export function cerrar_paneles_al_abrir_chat() {
2230
const infoSeccion = document.querySelector("#info-chat-seccion")
2331
if (infoSeccion && infoSeccion.classList.contains("abierto")) {
@@ -56,16 +64,14 @@ const batchRequestCache = {
5664

5765
export async function Get_datos_chat_abrir(id_chat) {
5866
const resultados = await Promise.allSettled([
59-
window.chats.OBTENER_MODELO_DATOS_NECESARIOS_CHAT(),
6067
window.cache_persistente.getChatCache(id_chat),
6168
window.chats.OBTENER_CACHE_CHAT_ACTIVO(id_chat)
6269
]);
6370

6471
const res = resultados.map(r => r.status === 'fulfilled' ? r.value : null);
65-
const [template, cachePer, cacheAct] = res;
72+
const [cachePer, cacheAct] = res;
6673

67-
if (!template) return null;
68-
let datos_necesarios = { ...template };
74+
let datos_necesarios = { ...MODELO_DATOS_NECESARIOS_CHAT };
6975

7076
let ids_usuarios = cachePer?.usuarios || cacheAct?.participantes || null;
7177
let campos_chat_faltantes = [];

preload/chat.cjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,5 @@ module.exports = {
5151
},
5252
OBTENER_CACHE_CHAT_ACTIVO: (id, bloque) => {
5353
return ipcRenderer.invoke("obtener-cache-chat-activo", id, bloque)
54-
},
55-
OBTENER_MODELO_DATOS_NECESARIOS_CHAT: () => {
56-
return ipcRenderer.invoke("obtener-modelo-datos-necesarios-chat")
5754
}
5855
};

0 commit comments

Comments
 (0)