change to get
This commit is contained in:
parent
78e3c6d174
commit
cec5266655
|
@ -95,13 +95,13 @@ async def get_user_chat_history(request: Request, req: GetUserChatHistoryInput)
|
|||
return res
|
||||
|
||||
|
||||
@app.post("/api/v1/get_chat_status_today")
|
||||
async def get_chat_status_today(request: Request, req: GetChatStatusTodayInput) -> GetChatStatusTodayOutput:
|
||||
@app.get("/api/v1/get_chat_status_today")
|
||||
async def get_chat_status_today(request: Request, user_name: str) -> GetChatStatusTodayOutput:
|
||||
pvd = Providers(db=request.app.db)
|
||||
user = await pvd.user.get_user_by_name(req.user_name)
|
||||
user = await pvd.user.get_user_by_name(user_name)
|
||||
if not user:
|
||||
raise UserNotFoundError(req.user_name)
|
||||
raise UserNotFoundError(user_name)
|
||||
ctx = Context(user=user)
|
||||
svc = Services(ctx, pvd)
|
||||
res = await svc.chat.get_chat_status_today(req)
|
||||
res = await svc.chat.get_chat_status_today()
|
||||
return res
|
||||
|
|
|
@ -47,7 +47,7 @@ class ChatService:
|
|||
res.append(UserChatMessage(type=message.type.value, text=message.text))
|
||||
return res
|
||||
|
||||
async def get_chat_status_today(self, req: GetChatStatusTodayInput) -> GetChatStatusTodayOutput:
|
||||
async def get_chat_status_today(self) -> GetChatStatusTodayOutput:
|
||||
count = await self.pvd.chat.get_user_chat_messages_count_today(user_id=self.ctx.user.id)
|
||||
res = GetChatStatusTodayOutput(user_name=self.ctx.user.name, chat_cnt=count)
|
||||
return res
|
||||
|
|
Loading…
Reference in New Issue