first commit
This commit is contained in:
34
app/modules/interactions/models.py
Normal file
34
app/modules/interactions/models.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from sqlalchemy import Column, Integer, String, Date, DateTime, Float, Boolean, Text, ForeignKey, Enum as SQLEnum
|
||||
from sqlalchemy.sql import func
|
||||
from sqlalchemy.orm import relationship
|
||||
from database import Base
|
||||
|
||||
import enum
|
||||
|
||||
class Interaccion(str, enum.Enum):
|
||||
LIKE = "like"
|
||||
DONT_LIKE = "dont_like"
|
||||
APPROVED = "approved"
|
||||
DISAPRROVE = "disapproved"
|
||||
NONE = "none"
|
||||
|
||||
|
||||
class Interacction(Base):
|
||||
__tablename__="interacctions"
|
||||
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
feed_id = Column(Integer, ForeignKey("feed.id"), nullable=False)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
||||
type_iteractions = Column(SQLEnum(Interaccion, name="type_interactios", create_type=False), default=Interaccion.NONE, nullable=False)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now(), nullable=True)
|
||||
|
||||
#relationships
|
||||
user = relationship("Users", back_populates="interactions")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user