Esempio n. 1
0
    def get(self, category_id=None, user_id=None):
        """Retrieve all action categories or a specific one

        :param category_id: uuid of the action category
        :param user_id: user ID who do the request
        :return: {
            "action_category_id": {
                "name": "name of the category",
                "description": "description of the category (optional)"
            }
        }
        :internal_api: get_action_categories
        """

        data = ModelManager.get_action_categories(user_id=user_id,
                                                  category_id=category_id)

        return {"action_categories": data}
Esempio n. 2
0
    def get(self, category_id=None, user_id=None):
        """Retrieve all action categories or a specific one

        :param category_id: uuid of the action category
        :param user_id: user ID who do the request
        :return: {
            "action_category_id": {
                "name": "name of the category",
                "description": "description of the category"
            }
        }
        :internal_api: get_action_categories
        """
        try:
            data = ModelManager.get_action_categories(user_id=user_id,
                                                      category_id=category_id)
        except Exception as e:
            logger.error(e, exc_info=True)
            return {"result": False, "error": str(e)}, 500
        return {"action_categories": data}
Esempio n. 3
0
def get_action_category(cat_id=None):
    from python_moondb.core import ModelManager
    category = ModelManager.get_action_categories(user_id=None,
                                                  category_id=cat_id)
    return category