def get(self, committee_id=None, committee_type=None, **kwargs): query, reports_class, reports_schema = self.build_query( committee_id=committee_id, committee_type=committee_type, **kwargs) if kwargs['sort']: validator = args.IndicesValidator(reports_class) validator(kwargs['sort']) page = utils.fetch_page(query, kwargs, model=reports_class, multi=True) return reports_schema().dump(page).data
def args(self): #Place the sort argument in a list, as the api will return a 422 status code if it's not in a list #list is needed because multisort is used default_sort = ['-receipt_date'] return utils.extend( args.paging, args.filings, args.make_multi_sort_args(default=default_sort, validator=args.IndicesValidator( self.model)), )