from onegov.core.orm import Base
from onegov.core.orm.mixins import TimestampMixin
from onegov.core.orm.types import UUID
from sqlalchemy import Column
from uuid import uuid4
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import uuid
[docs]
class UploadToken(Base, TimestampMixin):
""" Stores tokens for uploading using the REST interface. """
[docs]
__tablename__ = 'upload_tokens'
#: Identifies the token
[docs]
id: 'Column[uuid.UUID]' = Column(
UUID, # type:ignore[arg-type]
primary_key=True,
default=uuid4
)
#: The token
[docs]
token: 'Column[uuid.UUID]' = Column(
UUID, # type:ignore[arg-type]
unique=True,
default=uuid4,
nullable=False
)