init: Initial commit
This commit is contained in:
4
models/base.py
Normal file
4
models/base.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
14
models/team.py
Normal file
14
models/team.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from sqlalchemy import Column, String, DateTime, UUID
|
||||
from sqlalchemy.orm import relationship
|
||||
from uuid import uuid4
|
||||
|
||||
from models.base import Base
|
||||
|
||||
class Team(Base):
|
||||
__tablename__ = "teams"
|
||||
id = Column(UUID, primary_key=True, default=uuid4)
|
||||
name = Column(String)
|
||||
microsoft_team_id = Column(UUID)
|
||||
created_at = Column(DateTime)
|
||||
updated_at = Column(DateTime)
|
||||
webhooks = relationship("Webhook", back_populates="team", cascade="all, delete-orphan")
|
||||
15
models/webhook.py
Normal file
15
models/webhook.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy import Column, String, DateTime, UUID, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from uuid import uuid4
|
||||
|
||||
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")
|
||||
Reference in New Issue
Block a user