def post(self): tenant = request.args.get("tenant") data = request.get_json() user_id = data['userId'] report_name = data['reportName'] report_body = data['reportBody'] report_model = ReportTemplateModel(tenant) count = report_model.find({"report_type": "default"}).count() if count > 0: return create_response("A default template already exist", success=False), Status.HTTP_400_BAD_REQUEST report_model.insert({ "user_id": user_id, "report_date": datetime.now(), "report_type": "default", "report_name": report_name, "report_body": report_body }) return create_response("Default Report Template Saved Successfully" ), Status.HTTP_201_CREATED
def post(self): tenant = request.args.get("tenant") data = request.get_json() user_id = data['userId'] report_name = data['reportName'] report_body = data['reportBody'] report_model = ReportTemplateModel(tenant) report_model.insert({ "user_id": user_id, "report_date": datetime.now(), "report_name": report_name, "report_body": report_body }) return create_response( "Monthly Report Saved Successfully"), Status.HTTP_201_CREATED