feat: new block plugin for blocky

This commit is contained in:
Iain Learmonth 2024-11-16 13:17:39 +00:00
parent acfa81e3ba
commit 779d5cb8d2
4 changed files with 100 additions and 8 deletions

View file

@ -58,11 +58,11 @@ class AbstractResource(db.Model): # type: ignore
__abstract__ = True
id: Mapped[int] = mapped_column(db.Integer, primary_key=True)
added: Mapped[datetime] = mapped_column(db.DateTime(), default=datetime.utcnow, nullable=False)
updated: Mapped[datetime] = mapped_column(db.DateTime(), default=datetime.utcnow, nullable=False)
deprecated: Mapped[Optional[datetime]] = mapped_column(db.DateTime())
deprecation_reason: Mapped[Optional[str]] = mapped_column(db.String())
destroyed: Mapped[Optional[datetime]] = mapped_column(db.DateTime())
added: Mapped[datetime] = mapped_column(db.DateTime(), default=datetime.utcnow)
updated: Mapped[datetime] = mapped_column(db.DateTime(), default=datetime.utcnow)
deprecated: Mapped[Optional[datetime]]
deprecation_reason: Mapped[Optional[str]]
destroyed: Mapped[Optional[datetime]]
def __init__(self, *,
id: Optional[int] = None,

View file

@ -35,7 +35,7 @@ class OriginDict(TypedDict):
class Origin(AbstractConfiguration):
group_id: Mapped[int] = mapped_column(db.Integer, db.ForeignKey("group.id"))
domain_name: Mapped[str] = mapped_column(db.String(255), unique=True)
domain_name: Mapped[str] = mapped_column(unique=True)
auto_rotation: Mapped[bool]
smart: Mapped[bool]
assets: Mapped[bool]
@ -129,8 +129,8 @@ class Country(AbstractConfiguration):
resource_id=self.country_code
)
country_code = mapped_column(db.String(2), nullable=False)
risk_level_override = mapped_column(db.Integer(), nullable=True)
country_code: Mapped[str]
risk_level_override: Mapped[Optional[int]]
origins = db.relationship("Origin", secondary=country_origin, back_populates='countries')