init: new structure + fix lint errors
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import ForeignKey, String
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from cpv3.db.base import Base, BaseModelMixin
|
||||
|
||||
|
||||
class Webhook(Base, BaseModelMixin):
|
||||
__tablename__ = "webhooks"
|
||||
|
||||
project_id: Mapped[uuid.UUID | None] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("projects.id", ondelete="RESTRICT"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
user_id: Mapped[uuid.UUID | None] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("users.id", ondelete="RESTRICT"), nullable=True, index=True
|
||||
)
|
||||
|
||||
event: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
url: Mapped[str] = mapped_column(String(1024))
|
||||
secret: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
Reference in New Issue
Block a user