fix: made page a query

pull/21/head
db0 2023-09-12 01:26:25 +02:00
parent e827a3355e
commit 01f0af3e4f
2 changed files with 4 additions and 3 deletions

View File

@ -23,4 +23,4 @@ api.add_resource(guarantees.Guarantors, "/guarantors/<string:domain>")
api.add_resource(guarantees.Guarantees, "/guarantees/<string:domain>") api.add_resource(guarantees.Guarantees, "/guarantees/<string:domain>")
api.add_resource(badges.GuaranteeBadge, "/badges/guarantees/<string:domain>.svg") api.add_resource(badges.GuaranteeBadge, "/badges/guarantees/<string:domain>.svg")
api.add_resource(badges.EndorsementBadge, "/badges/endorsements/<string:domain>.svg") api.add_resource(badges.EndorsementBadge, "/badges/endorsements/<string:domain>.svg")
api.add_resource(report.Report, "/reports/<int:page>") api.add_resource(report.Report, "/reports")

View File

@ -9,11 +9,12 @@ class Report(Resource):
get_parser.add_argument("target_domains_csv", required=False, default=None, type=str, help="A csv of target domains for which to filter", location="args") get_parser.add_argument("target_domains_csv", required=False, default=None, type=str, help="A csv of target domains for which to filter", location="args")
get_parser.add_argument("report_type", required=False, default=None, type=str, help=f"The activity of report to filer {[e.name for e in enums.ReportType]}", location="args") get_parser.add_argument("report_type", required=False, default=None, type=str, help=f"The activity of report to filer {[e.name for e in enums.ReportType]}", location="args")
get_parser.add_argument("report_activity", required=False, default=None, type=str, help=f"The activity of report to filer {[e.name for e in enums.ReportActivity]}", location="args") get_parser.add_argument("report_activity", required=False, default=None, type=str, help=f"The activity of report to filer {[e.name for e in enums.ReportActivity]}", location="args")
get_parser.add_argument("page", required=False, default=1, type=int, help=f"The page of reports to display.", location="args")
@api.expect(get_parser) @api.expect(get_parser)
@api.marshal_with(models.response_model_reports, code=200, description='Report', as_list=True) @api.marshal_with(models.response_model_reports, code=200, description='Report', as_list=True)
@api.response(400, 'Validation Error', models.response_model_error) @api.response(400, 'Validation Error', models.response_model_error)
def get(self,page=1): def get(self):
'''Retrieve instance information via API Key at 10 results per page '''Retrieve instance information via API Key at 10 results per page
''' '''
self.args = self.get_parser.parse_args() self.args = self.get_parser.parse_args()
@ -40,7 +41,7 @@ class Report(Resource):
target_instances = target_domains, target_instances = target_domains,
report_type=report_type, report_type=report_type,
report_activity=report_activity, report_activity=report_activity,
page=page, page=self.args.page,
) )
report_response = [] report_response = []
for r in reports: for r in reports: