"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.metadata=void 0;const Websocket_1=require("@b/handler/Websocket"),db_1=require("@b/db");exports.metadata={};exports.default=async(e,t)=>{"string"==typeof t&&(t=JSON.parse(t));const{user:a}=e;if(!(null==a?void 0:a.id))return;const{type:o,payload:r}=t,s=await db_1.models.notification.findAll({where:{userId:a.id},order:[["createdAt","DESC"]]});Websocket_1.messageBroker.sendToClientOnRoute("/api/user",a.id,{type:"notifications",method:"create",payload:s.map(e=>e.get({plain:!0}))});const d=await db_1.models.announcement.findAll({where:{status:!0},order:[["createdAt","DESC"]]});Websocket_1.messageBroker.sendToClientOnRoute("/api/user",a.id,{type:"announcements",method:"create",payload:d.map(e=>e.get({plain:!0}))})};