'Perform DB operations'

@api.validate(input_schema)
@api.response(200, model=base_message_schema)
def post(self, session=None):

    data = request.json
    operation = data[u'operation']
    if (operation == u'cleanup'):
        self.manager.db_cleanup(force=True)
        msg = u'DB    Cleanup    finished'
    elif (operation == u'vacuum'):
        session.execute(u'VACUUM')
        session.commit()
        msg = u'DB    VACUUM    finished'
    elif (operation == u'plugin_reset'):
        plugin_name = data.get(u'plugin_name')
        if (not plugin_name):
            raise BadRequest(u"'plugin_name'    attribute    must    be    used    when    trying    to    reset    plugin")
        try:
            reset_schema(plugin_name)
            msg = u'Plugin    {}    DB    reset    was    successful'.format(plugin_name)
        except ValueError:
            raise BadRequest(u'The    plugin    {}    has    no    stored    schema    to    reset'.format(plugin_name))
    return success_response(msg)
