import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger


class ClassifyListView(APIView):

    def get(self, request):
        offset, count = get_offset_count(request)
        cn_name = request.GET.get('cn_name')

        data = self.rpc['neptune/commodity/classify/list'](
            offset=offset, count=count, cn_name=cn_name).unwrap()
        
        for obj in data:
            obj.pop('create_time')
            obj.pop('update_time')
            obj.pop('is_deleted')
            
        return data