예제 #1
0
def api_debug():
    """Endpoint used/needed for testing, only works in DEBUG_MODE."""
    if not DEBUG_MODE:
        return flask_jsonify(message='DEBUG_MODE is off')

    if request.method == 'DELETE':
        _drop_db()
        return flask_jsonify(message='DB dropped')

    return flask_jsonify(
        inbox=DB.inbox.count(),
        outbox=DB.outbox.count(),
    )
예제 #2
0
def api_debug() -> _Response:
    """Endpoint used/needed for testing, only works in DEBUG_MODE."""
    if not DEBUG_MODE:
        return flask.jsonify(message="DEBUG_MODE is off")

    if request.method == "DELETE":
        _drop_db()
        return flask.jsonify(message="DB dropped")

    return flask.jsonify(
        inbox=DB.activities.count({"box": Box.INBOX.value}),
        outbox=DB.activities.count({"box": Box.OUTBOX.value}),
        outbox_data=without_id(DB.activities.find({"box": Box.OUTBOX.value})),
    )