feat: service token introduction
This commit is contained in:
@@ -2,6 +2,7 @@ from .addons import Addon
|
||||
from .invoice import Invoice
|
||||
from .orders import Order, OrderAddon
|
||||
from .pricing import PricingConfig
|
||||
from .service_signatures import ServiceSignature
|
||||
from .sessions import Session
|
||||
from .subscription_addons import SubscriptionAddon
|
||||
from .subscriptions import Subscription
|
||||
@@ -15,6 +16,7 @@ __all__ = [
|
||||
"Order",
|
||||
"OrderAddon",
|
||||
"PricingConfig",
|
||||
"ServiceSignature",
|
||||
"Session",
|
||||
"Subscription",
|
||||
"SubscriptionAddon",
|
||||
|
||||
26
db/models/service_signatures.py
Normal file
26
db/models/service_signatures.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from sqlalchemy import TEXT, DateTime, Enum
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from db.base import Base
|
||||
from schemas.enums import ServiceSignatureStatus
|
||||
|
||||
|
||||
class ServiceSignature(Base):
|
||||
__tablename__ = "service_signatures"
|
||||
|
||||
kid: Mapped[str] = mapped_column(TEXT, unique=True, nullable=False, primary_key=True)
|
||||
public_key: Mapped[str] = mapped_column(TEXT, nullable=False)
|
||||
service_name: Mapped[str] = mapped_column(TEXT, nullable=True)
|
||||
status: Mapped[ServiceSignatureStatus] = mapped_column(
|
||||
Enum(ServiceSignatureStatus, name="servicesignaturestatus"),
|
||||
nullable=False,
|
||||
default=ServiceSignatureStatus.INACTIVE,
|
||||
)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=False,
|
||||
default=lambda: datetime.now(UTC),
|
||||
)
|
||||
revoked_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
Reference in New Issue
Block a user