Source code for luna_handlers.app.handlers.verifiers_count_handler
""" Verifier count handler. """
from sanic.response import HTTPResponse
from app.handlers.base_handler import BaseHandler
from classes.query_schemas.verifiers import VerifiersCountQueries
[docs]class VerifierCountHandler(BaseHandler):
"""
Handler for getting verifier count
Resource: "/{api_version}/verifiers/count"
"""
[docs] async def get(self) -> HTTPResponse:
"""
Count verifiers that satisfy the filters. See `spec_count_verifiers`_.
.. _spec_count_verifiers:
_static/api.html#operation/countVerifiers
Returns:
Response with verifier count
"""
queries: VerifiersCountQueries = self.loadDataFromQuery(VerifiersCountQueries)
verifierCount = await self.dbContext.getVerifierCount(
accountId=queries.accountId, description=queries.description
)
return self.success(200, outputJson={"verifiers_count": verifierCount})