From 77759f620dcaa4f0581773b770cae9e71585d2ed Mon Sep 17 00:00:00 2001 From: knst-kotov Date: Mon, 24 Jan 2022 17:08:30 +0300 Subject: [PATCH] remove message table --- orm/__init__.py | 3 +-- orm/message.py | 21 --------------------- resolvers/inbox.py | 2 +- 3 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 orm/message.py diff --git a/orm/__init__.py b/orm/__init__.py index 076972ec..0cafbcb4 100644 --- a/orm/__init__.py +++ b/orm/__init__.py @@ -1,7 +1,6 @@ from orm.rbac import Operation, Resource, Permission, Role, RoleStorage from orm.community import Community from orm.user import User, UserRating, UserRole, UserStorage -from orm.message import Message from orm.topic import Topic, TopicSubscription, TopicStorage from orm.notification import Notification from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutRating, ShoutViewByDay,\ @@ -9,7 +8,7 @@ from orm.shout import Shout, ShoutAuthor, ShoutTopic, ShoutRating, ShoutViewByDa from orm.base import Base, engine, local_session from orm.comment import Comment, CommentRating -__all__ = ["User", "Role", "Community", "Operation", "Permission", "Message", "Shout", "Topic", "TopicSubscription", "Notification", "ShoutRating", "Comment", "CommentRating", "UserRating"] +__all__ = ["User", "Role", "Community", "Operation", "Permission", "Shout", "Topic", "TopicSubscription", "Notification", "ShoutRating", "Comment", "CommentRating", "UserRating"] Base.metadata.create_all(engine) Operation.init_table() diff --git a/orm/message.py b/orm/message.py deleted file mode 100644 index 50737e2e..00000000 --- a/orm/message.py +++ /dev/null @@ -1,21 +0,0 @@ -from typing import List -from datetime import datetime - -from sqlalchemy import Column, Integer, String, ForeignKey, DateTime - -from orm import Permission -from orm.base import Base - - -class Message(Base): - __tablename__ = 'message' - - fromUser: int = Column(ForeignKey("user.id"), nullable=False, comment="Sender") - chatRoom: int = Column(Integer, nullable=False, comment="Chatroom") - body: str = Column(String, nullable=False, comment="Body") - createdAt = Column(DateTime, nullable=False, default = datetime.now, comment="Created at") - updatedAt = Column(DateTime, nullable=True, comment="Updated at") - replyTo: int = Column(ForeignKey("message.id"), nullable=True, comment="Reply to") - - - # TODO: work in progress, udpate this code diff --git a/resolvers/inbox.py b/resolvers/inbox.py index 87b19f1a..1f836a44 100644 --- a/resolvers/inbox.py +++ b/resolvers/inbox.py @@ -1,4 +1,4 @@ -from orm import Message, User +from orm import User from orm.base import local_session from resolvers.base import mutation, query, subscription