Пример #1
0
    def post(self, *args, **kwargs):
        action_list = self.get_angular_argument('action_list')

        if not action_list:
            return

        ActionType.update_position(action_list)
Пример #2
0
    def post(self, *args, **kwargs):
        """新建"""
        action_name = self.get_angular_argument('name')

        if not action_name:
            self.on_error(**ErrorCodeMessage.action_name_illegal)
            return

        action = ActionType.add(action_name)

        if not action:
            self.on_error(**ErrorCodeMessage.database_error)
            return

        self.on_success(action.to_dict())
Пример #3
0
    def delete(self, action_id, *args, **kwargs):
        """删除"""
        if not action_id:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        action = ActionType.init_from_action_id(action_id)

        if not action:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        if action.delete():
            self.on_success()
        else:
            self.on_error(**ErrorCodeMessage.database_error)
Пример #4
0
    def post(self, *args, **kwargs):
        action_id = self.get_angular_argument('id')

        if not action_id:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        action = ActionType.init_from_action_id(action_id)

        if not action:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        if action.recover():
            self.on_success()
            return
        else:
            self.on_error(**ErrorCodeMessage.database_error)
Пример #5
0
    def put(self, *args, **kwargs):
        """改名"""
        action_name = self.get_angular_argument('name')
        action_id = self.get_angular_argument('id')

        if not action_id:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        action = ActionType.init_from_action_id(action_id)

        if not action:
            self.on_error(**ErrorCodeMessage.action_not_exists)
            return

        if not action_name:
            self.on_error(**ErrorCodeMessage.action_name_illegal)
            return

        if action.edit_name(action_name):
            self.on_success()
        else:
            self.on_error(**ErrorCodeMessage.database_error)
Пример #6
0
 def get(self, *args, **kwargs):
     action_instance_list = ActionType.get_all_action()
     self.on_success([i.to_dict() for i in action_instance_list])