feat: add api and mcp
This commit is contained in:
1 parent
6a5cde6ae4
commit
c40e720163
30 files changed
+2354
-31
No files matched your search
@@ -0,0 +1,37 @@
|
||||
from typing import Annotated
|
||||
|
||||
import asyncpg
|
||||
from dishka.integrations.fastapi import DishkaRoute, FromDishka
|
||||
from fastapi import APIRouter, Query
|
||||
|
||||
from utils.read import social
|
||||
from utils.read.models import CallbackView, LinkView, ReactionView
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/api/messages/{chat_id}/{message_id}",
|
||||
tags=["social"],
|
||||
route_class=DishkaRoute,
|
||||
)
|
||||
|
||||
AccountId = Annotated[int, Query()]
|
||||
|
||||
|
||||
@router.get("/callbacks")
|
||||
async def message_callbacks(
|
||||
pool: FromDishka[asyncpg.Pool], chat_id: int, message_id: int, account_id: AccountId
|
||||
) -> list[CallbackView]:
|
||||
return await social.get_callbacks(pool, account_id, chat_id, message_id)
|
||||
|
||||
|
||||
@router.get("/reactions")
|
||||
async def message_reactions(
|
||||
pool: FromDishka[asyncpg.Pool], chat_id: int, message_id: int, account_id: AccountId
|
||||
) -> list[ReactionView]:
|
||||
return await social.get_reactions(pool, account_id, chat_id, message_id)
|
||||
|
||||
|
||||
@router.get("/links")
|
||||
async def message_links(
|
||||
pool: FromDishka[asyncpg.Pool], chat_id: int, message_id: int, account_id: AccountId
|
||||
) -> list[LinkView]:
|
||||
return await social.get_links(pool, account_id, chat_id, message_id)
|
||||
Reference in new issue
Block a user