20 lines
686 B
Python
20 lines
686 B
Python
# app/api/v1/models/user.py
|
|
|
|
from sqlalchemy import Column, ForeignKey, Integer, String, Text
|
|
from sqlalchemy.orm import relationship
|
|
from app.api.db.database import Base
|
|
|
|
class User(Base):
|
|
__tablename__ = 'user'
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
username = Column(String, unique=True, nullable=False)
|
|
email = Column(String, unique=True, nullable=False)
|
|
password = Column(String, nullable=False)
|
|
bio = Column(Text, nullable=True)
|
|
|
|
# Define relationships here if needed
|
|
# posts = relationship("Post", back_populates="author")
|
|
|
|
def __repr__(self):
|
|
return f"User(id={self.id}, username='{self.username}', email='{self.email}')" |