def create_service(jwt): body = request.get_json() try: name = body.get('name', None) type = body.get('type', None) address = body.get('address', None) region_id = body.get('region_id', None) email = body.get('email', None) phone = body.get('phone', None) website = body.get('website', None) image = body.get('image', None) if (name is None) or (type is None) or (address is None) or ( region_id is None): abort(422) new_service = Service(name=name, type=type, address=address, region_id=region_id, email=email, phone=phone, website=website, image=image) new_service.insert() return jsonify({'success': True, 'created': new_service.id}), 200 except BaseException: print(sys.exc_info()) abort(422)