From 4530b2a1e9625ad190ef554fdeb9e39460cc6274 Mon Sep 17 00:00:00 2001 From: Untone Date: Fri, 17 Nov 2023 12:10:36 +0300 Subject: [PATCH] model-fix --- inbox.graphql | 4 ++-- resolvers/messages.py | 4 ++-- validators/message.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inbox.graphql b/inbox.graphql index 5aee52b..04e8b6e 100644 --- a/inbox.graphql +++ b/inbox.graphql @@ -57,7 +57,7 @@ type Mutation { } input MessagesBy { - author: String + created_by: String body: String chat: String order: String @@ -77,7 +77,7 @@ type Query { type Message { id: Int! - author: Int! + created_by: Int! created_at: Int! chat_id: String! body: String! diff --git a/resolvers/messages.py b/resolvers/messages.py index d6566eb..eed20f3 100644 --- a/resolvers/messages.py +++ b/resolvers/messages.py @@ -34,7 +34,7 @@ async def create_message(_, info, chat_id: str, body: str, reply_to=None): new_message: Message = { "chat_id": chat_id, "id": message_id, - "author": author_id, + "created_by": author_id, "body": body, "created_at": int(datetime.now(tz=timezone.utc).timestamp()), "updated_at": None, @@ -96,7 +96,7 @@ async def update_message(_, info, message): return {"error": "message not exist"} message = json.loads(message) - if message["author"] != author_id: + if message["created_by"] != author_id: return {"error": "access denied"} if body: diff --git a/validators/message.py b/validators/message.py index 0b3eace..2e44d42 100644 --- a/validators/message.py +++ b/validators/message.py @@ -4,7 +4,7 @@ from typing import TypedDict, Optional class Message(TypedDict): id: int chat_id: str - author: int + created_by: int body: str created_at: int reply_to: Optional[int]