19 lines
747 B
Python
19 lines
747 B
Python
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)
|
|
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") |