mirror of
https://github.com/Rarebuffalo/securelens-backend.git
synced 2026-06-19 07:00:30 +00:00
22 lines
707 B
Python
22 lines
707 B
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Webhook(Base):
|
|
__tablename__ = "webhooks"
|
|
|
|
id = Column(String, primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=False)
|
|
target_url = Column(String, nullable=False)
|
|
secret_key = Column(String, nullable=True) # Used for HMAC signing
|
|
is_active = Column(Boolean, default=True)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
|
|
# Relationship
|
|
user = relationship("User", back_populates="webhooks")
|