diff --git a/bank_integration/banks/banking_app/app/database/models.py b/bank_integration/banks/banking_app/app/database/models.py new file mode 100644 index 000000000..04198cfe5 --- /dev/null +++ b/bank_integration/banks/banking_app/app/database/models.py @@ -0,0 +1,23 @@ +from sqlalchemy import Column, Integer, String, DateTime +from sqlalchemy.ext.declarative import declarative_base + +BaseModel = declarative_base() + +class User(BaseModel): + __tablename__ = "users" + id = Column(Integer, primary_key=True) + username = Column(String(50), unique=True, nullable=False) + email = Column(String(120), unique=True, nullable=False) + password = Column(String(128), nullable=False) + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow) + +class Post(BaseModel): + __tablename__ = "posts" + id = Column(Integer, primary_key=True) + title = Column(String(100), nullable=False) + content = Column(String, nullable=False) + user_id = Column(Integer, ForeignKey("users.id")) + user = relationship("User", backref="posts") + created_at = Column(DateTime, default=datetime.utcnow) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)