create shout in db and under git
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from orm.rbac import Operation, Permission, Role
|
||||
from orm.user import User
|
||||
from orm.message import Message
|
||||
from orm.shout import Shout
|
||||
from orm.base import Base, engine
|
||||
|
||||
__all__ = ["User", "Role", "Operation", "Permission", "Message"]
|
||||
__all__ = ["User", "Role", "Operation", "Permission", "Message", "Shout"]
|
||||
|
||||
Base.metadata.create_all(engine)
|
||||
|
14
orm/shout.py
14
orm/shout.py
@@ -1,17 +1,17 @@
|
||||
from typing import List
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, Datetime
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
|
||||
|
||||
from orm import Permission
|
||||
from orm.base import Base
|
||||
|
||||
|
||||
class Shout(Base):
|
||||
__tablename__ = 'shout'
|
||||
__tablename__ = 'shout'
|
||||
|
||||
author_id: str = Column(ForeignKey("user.id"), nullable=False, comment="Author")
|
||||
body: str = Column(String, nullable=False, comment="Body")
|
||||
createdAt: str = Column(datetime, nullable=False, comment="Created at")
|
||||
updatedAt: str = Column(datetime, nullable=False, comment="Updated at")
|
||||
author_id: str = Column(ForeignKey("user.id"), nullable=False, comment="Author")
|
||||
body: str = Column(String, nullable=False, comment="Body")
|
||||
createdAt: str = Column(DateTime, nullable=False, default = datetime.now, comment="Created at")
|
||||
updatedAt: str = Column(DateTime, nullable=True, comment="Updated at")
|
||||
|
||||
# TODO: add all the fields
|
||||
# TODO: add all the fields
|
||||
|
Reference in New Issue
Block a user