This commit is contained in:
parent
f33241b84f
commit
4530b2a1e9
|
@ -57,7 +57,7 @@ type Mutation {
|
||||||
}
|
}
|
||||||
|
|
||||||
input MessagesBy {
|
input MessagesBy {
|
||||||
author: String
|
created_by: String
|
||||||
body: String
|
body: String
|
||||||
chat: String
|
chat: String
|
||||||
order: String
|
order: String
|
||||||
|
@ -77,7 +77,7 @@ type Query {
|
||||||
|
|
||||||
type Message {
|
type Message {
|
||||||
id: Int!
|
id: Int!
|
||||||
author: Int!
|
created_by: Int!
|
||||||
created_at: Int!
|
created_at: Int!
|
||||||
chat_id: String!
|
chat_id: String!
|
||||||
body: String!
|
body: String!
|
||||||
|
|
|
@ -34,7 +34,7 @@ async def create_message(_, info, chat_id: str, body: str, reply_to=None):
|
||||||
new_message: Message = {
|
new_message: Message = {
|
||||||
"chat_id": chat_id,
|
"chat_id": chat_id,
|
||||||
"id": message_id,
|
"id": message_id,
|
||||||
"author": author_id,
|
"created_by": author_id,
|
||||||
"body": body,
|
"body": body,
|
||||||
"created_at": int(datetime.now(tz=timezone.utc).timestamp()),
|
"created_at": int(datetime.now(tz=timezone.utc).timestamp()),
|
||||||
"updated_at": None,
|
"updated_at": None,
|
||||||
|
@ -96,7 +96,7 @@ async def update_message(_, info, message):
|
||||||
return {"error": "message not exist"}
|
return {"error": "message not exist"}
|
||||||
|
|
||||||
message = json.loads(message)
|
message = json.loads(message)
|
||||||
if message["author"] != author_id:
|
if message["created_by"] != author_id:
|
||||||
return {"error": "access denied"}
|
return {"error": "access denied"}
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from typing import TypedDict, Optional
|
||||||
class Message(TypedDict):
|
class Message(TypedDict):
|
||||||
id: int
|
id: int
|
||||||
chat_id: str
|
chat_id: str
|
||||||
author: int
|
created_by: int
|
||||||
body: str
|
body: str
|
||||||
created_at: int
|
created_at: int
|
||||||
reply_to: Optional[int]
|
reply_to: Optional[int]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user