migration fix, new html2text, export wip
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from orm.rbac import Operation, Resource, Permission, Role
|
||||
from orm.community import Community
|
||||
from orm.user import User
|
||||
from orm.user import User, UserRating
|
||||
from orm.message import Message
|
||||
from orm.topic import Topic
|
||||
from orm.notification import Notification
|
||||
@@ -9,7 +9,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", "Operation", "Permission", "Message", "Shout", "Topic", "Notification", "ShoutRating", "Comment", "CommentRating"]
|
||||
__all__ = ["User", "Role", "Operation", "Permission", "Message", "Shout", "Topic", "Notification", "ShoutRating", "Comment", "CommentRating", "UserRating"]
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
Operation.init_table()
|
||||
|
@@ -22,6 +22,7 @@ class Comment(Base):
|
||||
body: str = Column(String, nullable=False, comment="Comment Body")
|
||||
createdAt = Column(DateTime, nullable=False, default = datetime.now, comment="Created at")
|
||||
updatedAt = Column(DateTime, nullable=True, comment="Updated at")
|
||||
updatedBy = Column(ForeignKey("user.id"), nullable=True, comment="Last Editor")
|
||||
deletedAt = Column(DateTime, nullable=True, comment="Deleted at")
|
||||
deletedBy = Column(ForeignKey("user.id"), nullable=True, comment="Deleted by")
|
||||
shout: int = Column(ForeignKey("shout.id"), nullable=True, comment="Shout ID")
|
||||
|
@@ -17,8 +17,8 @@ class UserNotifications(Base):
|
||||
kind: str = Column(String, ForeignKey("notification.kind"))
|
||||
values: JSONType = Column(JSONType, nullable = True) # [ <var1>, .. ]
|
||||
|
||||
class UserRatings(Base):
|
||||
__tablename__ = "user_ratings"
|
||||
class UserRating(Base):
|
||||
__tablename__ = "user_rating"
|
||||
|
||||
id = None
|
||||
rater_id = Column(ForeignKey('user.id'), primary_key = True)
|
||||
@@ -55,7 +55,7 @@ class User(Base):
|
||||
links: JSONType = Column(JSONType, nullable=True, comment="Links")
|
||||
oauth: str = Column(String, nullable=True)
|
||||
notifications = relationship(lambda: UserNotifications)
|
||||
ratings = relationship(UserRatings, foreign_keys=UserRatings.user_id)
|
||||
ratings = relationship(UserRating, foreign_keys=UserRating.user_id)
|
||||
roles = relationship(lambda: Role, secondary=UserRoles)
|
||||
topics = relationship(lambda: Topic, secondary=UserTopics)
|
||||
old_id: str = Column(String, nullable = True)
|
||||
|
Reference in New Issue
Block a user