init: Initial commit
This commit is contained in:
@@ -2,14 +2,18 @@ from sqlalchemy import Column, String, DateTime, UUID, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from uuid import uuid4
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from models.base import Base
|
||||
|
||||
class Webhook(Base):
|
||||
__tablename__ = "webhooks"
|
||||
id = Column(UUID, primary_key=True, default=uuid4)
|
||||
url = Column(String)
|
||||
secret = Column(String)
|
||||
team_id = Column(UUID, ForeignKey("teams.id"), nullable=False)
|
||||
created_at = Column(DateTime)
|
||||
updated_at = Column(DateTime)
|
||||
team = relationship("Team", back_populates="webhooks")
|
||||
secret = Column(String, nullable=False, unique=True)
|
||||
service_id = Column(UUID, ForeignKey("services.id"), nullable=False)
|
||||
channel_id = Column(UUID, ForeignKey("channels.id"), nullable=False)
|
||||
created_at = Column(DateTime, default=datetime.now)
|
||||
updated_at = Column(DateTime, default=datetime.now)
|
||||
|
||||
channel = relationship("Channel", back_populates="webhooks")
|
||||
service = relationship("Service", back_populates="webhooks")
|
||||
Reference in New Issue
Block a user