remove old scom endpoints

This commit is contained in:
s.mostryukov 2024-10-15 13:39:49 +03:00
parent 88433c4c94
commit 40ce559f53
1 changed files with 0 additions and 40 deletions

View File

@ -11,46 +11,6 @@ from telegram import del_message
router = APIRouter() router = APIRouter()
@router.post("/send-to-dashboard")
async def send_message_to_dashboard(
message: scomNetworkMessage,
token: str = Depends(verify_token_scom),
):
if message.alert_resolution_state == "Closed":
msg_id = await pop_value(f"scom:net:{message.alert_source}")
if msg_id:
msg_id = int(msg_id.decode("utf-8"))
await del_message(message_id=msg_id, chat_id=conf.tg.chat_id)
return
result = await send_message(
text=f"‼️{message.alert_resolution_state} {message.alert_source} is not responding",
chat_id=conf.tg.chat_id,
message_thread_id=conf.tg.dashboard_tred_id,
)
if result and result["status"] == 200:
await set_value(f"scom:net:{message.alert_source}", result["msg_id"])
@router.post("/send-to-net-chat")
async def send_message_to_net_chat(
message: scomNetworkMessage,
token: str = Depends(verify_token_scom),
):
if message.alert_resolution_state == "New":
text = f"‼️{message.alert_resolution_state} {message.alert_source} is not responding"
else:
text = (
f"{message.alert_resolution_state} {message.alert_source} is responding"
)
await send_message(
text=text,
chat_id=conf.tg.chat_id,
message_thread_id=conf.tg.net_tred_id,
)
@router.post("/net") @router.post("/net")
async def net_send_message( async def net_send_message(
message: scomNetworkMessage, message: scomNetworkMessage,