Exemplo n.º 1
0
            abort_bad_path_param("version", full_ns)

        args = full_recommended_track_parser.parse_args()
        limit = format_limit(args, default_limit=DEFAULT_RECOMMENDED_LIMIT)
        args["limit"] = max(TRENDING_LIMIT, limit)
        strategy = trending_strategy_factory.get_strategy(
            TrendingType.TRACKS, version_list[0])
        full_recommended_tracks = get_full_recommended_tracks(
            request, args, strategy)
        return success_response(full_recommended_tracks[:limit])


trending_ids_route_parser = trending_parser.copy()
trending_ids_route_parser.remove_argument("time")

track_id = full_ns.model("track_id", {"id": fields.String(required=True)})
trending_times_ids = full_ns.model(
    "trending_times_ids",
    {
        "week": fields.List(fields.Nested(track_id)),
        "month": fields.List(fields.Nested(track_id)),
        "year": fields.List(fields.Nested(track_id)),
    },
)
trending_ids_response = make_response("trending_ids_response", full_ns,
                                      fields.Nested(trending_times_ids))


@full_ns.route(
    "/trending/ids",
    defaults={"version": DEFAULT_TRENDING_VERSIONS[TrendingType.TRACKS].name},
Exemplo n.º 2
0
""" Module for Swagger category models """

from flask_restx import fields

from ..collections import property_namespace

booking_model = property_namespace.model(
    'Booking', {
        'checkin_date':
        fields.String(required=True, description='Booking checkin date'),
        'checkout_date':
        fields.String(required=True, description='Booking checkout date'),
    })
from werkzeug.exceptions import BadRequest

from solutions import create_api, create_app, mainTitle, course4_field_names

app = create_app()  # pylint: disable=invalid-name
api = create_api(app, mainTitle, 'Example Employee API')  # pylint: disable=invalid-name

CSV_FILE_NAME = '/../example.csv'

API_MODEL = api.model(
    'Employee', {
        'employee_id':
        fields.Integer(required=True, description='Id of the employee'),
        'name':
        fields.String(required=True,
                      min_length=1,
                      max_length=200,
                      description='Name of the employee')
    })

logger.getLogger().setLevel(logger.INFO)


@api.route('/employee/<string:employee_id>')
class Csv(Resource):
    """Class for the employee API"""
    @staticmethod
    def get(employee_id):
        """GET endpoint for retrieving employee info with the given employee_id"""
        try:
            return jsonify(retrieve_employee_with_id(employee_id))
        except KeyError:
Exemplo n.º 4
0
__license__ = "LGPLv3+"

from marshmallow import Schema, fields as ma_fields
from flask_restx import fields as f_fields
from marshmallow_jsonschema import JSONSchema

from app.extensions.api import api_v1 as api

dict_schema = {
    'autoProcProgramId':
    f_fields.Integer(required=True,
                     description='Primary key (auto-incremented)'),
    'processingCommandLine':
    f_fields.String(
        required=False,
        description='Command line for running the automatic processing'),
    'processingPrograms':
    f_fields.String(required=False,
                    description='Processing programs (comma separated)'),
    'processingStatus':
    f_fields.Integer(required=False, description='success (1) / fail (0)'),
    'processingMessage':
    f_fields.String(required=False, description='warning, error,...'),
    'processingStartTime':
    f_fields.DateTime(required=False, description='Processing start time'),
    'processingEndTime':
    f_fields.DateTime(required=False, description='Processing end time'),
    'processingEnvironment':
    f_fields.String(required=False, description='Cpus, Nodes,...'),
    'recordTimeStamp':
Exemplo n.º 5
0
class cb1:
    rap = Namespace('/', description='CB1')
    res = rap.model('result',
                    {'ResultFlag': fields.String(description="ResultFlag")})
class Order_Crwaler(Resource):
    signin_fields_account = order.model(
        "order_crwaler", {
            "token":
            fields.String(
                description="Access Token", required=True, example="token"),
            "jobName":
            fields.String(
                description="Login Account", required=True, example="JobName"),
            "param":
            fields.String(
                description="json to String", required=True, example="JobName")
        })

    def post(self):
        """ User sign in API """
        rv, code = {}, 201
        try:
            req = request.json
            hasKey = ["token", "jobName", "param"]
            isKey = Utils.isDicHasKey(req, hasKey)
            if not isKey:
                return ReqCode.notKey.value, 400
            isNullKey = Utils.isDicKeyValueNull(req, hasKey)
            if not isNullKey:
                return ReqCode.keyValNull.value, 400
            hasKey = ["email", "password"]
            isKey = Utils.isDicHasKey(req["account"], hasKey)
            if not isKey:
                return ReqCode.notKey.value, 400
            isNullKey = Utils.isDicKeyValueNull(req["account"], hasKey)
            if not isNullKey:
                return ReqCode.keyValNull.value, 400

            # Import user information from MariaDB
            account = req["account"]
            userInfo = MariaUserSql().getAccountInfo(account)
            if not userInfo['result']:
                rv = CommonCode.UnknownError.value
                rv = userInfo['msg']
                return rv, 400

            if userInfo['data'] is None:
                return SignCode.SignFail.value, 400

            # if userInfo[''] is null:
            pwdChk = Encryption().checkBcrypt(userInfo["data"]["password"],
                                              account["password"])

            # Create session if passwords match
            if pwdChk:
                session = RedisSession().createSession(
                    userInfo["data"]["email"])
                rv = copy.deepcopy(CommonCode.Success.value)
                rv["data"] = {"session": session}
            else:
                rv, code = SignCode.SignFail.value, 400
        except Exception as ex:
            rv = copy.deepcopy(CommonCode.UnknownError.value)
            rv["msg"] = str(ex)
            code = 400
        return rv, code  # ,header{"hi": "hello"}
Exemplo n.º 7
0
#

from maxfw.core import MAX_API, PredictAPI
from core.model import ModelWrapper

from flask import abort
from flask_restx import fields
from werkzeug.datastructures import FileStorage


# Set up parser for image input data
image_parser = MAX_API.parser()
image_parser.add_argument('image', type=FileStorage, location='files', required=True, help="An image file")

label_prediction = MAX_API.model('LabelPrediction', {
    'index': fields.String(required=False, description='Labels ranked by highest probability'),
    'caption': fields.String(required=True, description='Caption generated by image'),
    'probability': fields.Float(required=True, description="Probability of the caption")
})

predict_response = MAX_API.model('ModelPredictResponse', {
    'status': fields.String(required=True, description='Response status message'),
    'predictions': fields.List(fields.Nested(label_prediction), description='Predicted captions and probabilities')
})


class ModelPredictAPI(PredictAPI):

    model_wrapper = ModelWrapper()

    @MAX_API.doc('predict')
"""__init__ module for the solutions package"""

from flask import Flask
from flask_restx import Api, Resource, fields
from werkzeug.middleware.proxy_fix import ProxyFix

from texts import mainTitle, descriptiveTextCourse1

MY_NAME = 'Wietse'
QUESTION1_TEMPLATE = 'My name is {0}!'
API_MODEL_COURSE3 = 'AwesomeDictionary', {
    'Original request':
    fields.String(required=True,
                  min_length=1,
                  max_length=200,
                  description='Original request')
}
awesome_dictionary_to_return = {
    "Most awesome programming language.": "Python",
    "Reason": "You dont need a reason.",
    "Why": "Just try to do these labs in another language.",
    "Original request": ""
}

course4_field_names = ['employee_id', 'name']


def create_app():
    """Function creating the Flask app"""
    app = Flask(__name__)
    app.wsgi_app = ProxyFix(app.wsgi_app)
Exemplo n.º 9
0
import source.backend.db as db
from bson.objectid import ObjectId

import logging
import datetime

logger = logging.getLogger(__name__)
mongo = db.mongo

api = Namespace("posts", description="Posts related routes", path="/api/posts")

post = api.model(
    "Post",
    {
        "_id": fields.String(description="Post ID"),
        "user": fields.String(description="Belong to user"),
        "username": fields.String(),
        "title": fields.String(),
        "content": fields.String(),
        "createtime": fields.DateTime(),
        "updatetime": fields.DateTime(),
        "tags": fields.List(fields.String()),
    },
)

tag = api.model(
    "SearchingTag",
    {"tag": fields.String(required=True, description="searching tag")},
)
Exemplo n.º 10
0
from flask_restx import Resource, fields
from flask import request

from sample_project.user import ns

user = ns.model(
    'User', {
        'id': fields.Integer,
        'name': fields.String(required=True, min_length=1),
        'email': fields.String(required=True, min_length=5),
    })


@ns.route('/users', methods=['POST'])
class User(Resource):
    @ns.expect(user, validate=True)
    @ns.marshal_with(user, envelope='user')
    def post(self):
        data = request.json
        data['id'] = 1
        return data, 201


@ns.route('/users/<string:user_id>', methods=['GET'])
class UserDetail(Resource):
    @ns.marshal_with(user, envelope='user')
    def get(self, user_id):
        if user_id == '1':
            return {
                'id': 1,
                'name': 'John Doe',
Exemplo n.º 11
0
from flask_restx import Resource, fields, Namespace

from script_runner.server import app

api = Namespace('server-health',
                description="Service health checks.",
                path='/')

health_output = api.model('HealthOutput', {
    'version': fields.String(),
    'server': fields.Boolean(),
})


@api.route('/health')
class HealthResource(Resource):
    @api.doc(model=health_output)
    def get(self):
        return {
            'version': app.config['SERVER_VERSION'],
            'server': True,
        }
Exemplo n.º 12
0
    "id": fields.String,
    "name": fields.String,
    "amount": fields.Integer
}
flavor_fields = {
    "id": fields.String,
    "name": fields.String,
    "icon": fields.String,
    "color": fields.String
}

product_serializer = api.model(
    "Product",
    {
        "id":
        fields.String(),
        "name":
        fields.String(required=True, description="Product name"),
        "short_description_nl":
        fields.String(description="NL Description as shown in the price list"),
        "description_nl":
        fields.String(
            description="EN Description as shown in the detail view"),
        "short_description_en":
        fields.String(description="NL Description as shown in the price list"),
        "description_en":
        fields.String(
            description="EN Description as shown in the detail view"),
        "approved":
        fields.Boolean(description="Approved?"),
    },
Exemplo n.º 13
0
Specifying no numbers at all will retrieve all accounts available, while specifying any number of account numbers will retrieve those that match any accounts.

#### Privileges
- economy
- accounts
"""

post_model = api.model(
    "post_transaction", {
        "amount":
        fields.Float(example=39.9, required=True, min=0),
        "date_trans":
        fields.Integer(example=round(datetime.now().timestamp()),
                       required=False),
        "desc":
        fields.String(example="Transaction for stuff", required=True),
        "from_account":
        fields.Integer(example=101, required=True),
        "to_account":
        fields.Integer(example=401, required=True)
    })


@api.route("")
class TransactionByDateResource(Resource):
    @api.response(200, "Successfully retrieved transactions")
    @api.doc(description=get_doc)
    @api.expect(between_dates, validate=True)
    @privilege_required("transactions")
    @privilege_required("economy")
    def get(self):
Exemplo n.º 14
0
class NullableString(fields.String):
    __schema_type__ = ['string', 'null']
    __schema_example__ = 'nullable string'


api = Namespace('Api', description='')

contacts_ns = 'contacts'
messages_ns = 'messages'
rooms_ns = 'rooms'

contact_model = api.model(
    'Contact', {
        'id': fields.Integer(readonly=True),
        'address': fields.String(required=True),
        'name': NullableString(),
        'nickname': fields.String(required=True),
        'online': fields.Boolean(readonly=True),
    })

room_model = api.model(
    'Room', {
        'id': fields.Integer(readonly=True),
        'hash': fields.String(readonly=True),
        'name': fields.String(),
        'admin_address': fields.String(),
        'members': fields.List(fields.Nested(contact_model, readonly=True)),
        'private': fields.Boolean(readonly=True),
    })
Exemplo n.º 15
0
get_doc = """
### Retrieval of economy accounts

Using this endpoint, you can retrieve information about the different accounts tied to your user. 

Specifying no numbers at all will retrieve all accounts available, while specifying any number of account numbers will retrieve those that match any accounts.

#### Privileges
- economy
- accounts
"""

post_model = api.model("accounts_post", {
    "number": fields.Integer(example=401, required=True),
    "name": fields.String(example="Example account", required=True),
    "desc": fields.String(example="Example account for example transactions", required=True)
})

post_doc = """
### Creation of economy accounts

Using this endpoint, you can create new economy accounts for your user.

#### Privileges
- economy
- accounts
"""

@api.route("")
class AccountsResource(Resource):
Exemplo n.º 16
0
from flask_restx import Namespace, Resource, fields
from flask import abort
from app.models import Tweet
from app import db

api = Namespace('tweets')

json_tweet = api.model('Tweet', {
    'id': fields.Integer,
    'text': fields.String,
    'created_at': fields.DateTime
})

json_new_tweet = api.model('New tweet', {'text': fields.String(required=True)})


@api.route('/<int:id>')
@api.response(404, 'Tweet not found')
@api.param('id', 'The tweet unique identifier')
class TweetResource(Resource):
    @api.marshal_with(json_tweet)
    def get(self, id):
        tweet = db.session.query(Tweet).get(id)
        if tweet is None:
            api.abort(404, "Tweet {} doesn't exist".format(id))
        else:
            return tweet

    @api.marshal_with(json_tweet, code=200)
    @api.expect(json_new_tweet, validate=True)
    def patch(self, id):
Exemplo n.º 17
0
from flask_restx import fields

facts_model = {
    'name': fields.String('Fact name'),
    'value': fields.String('Fact title')
}

message_model_definition = {
    'message': fields.String('Body of the message to send', required=True),
    'from': fields.String('User that sends the message', required=True)
}

message_card_model = {
    'title': fields.String('Card title'),
    'activity_title': fields.String('Activity title'),
    'activity_subtitle': fields.String('Activity subtitle'),
    'activity_image': fields.String('Activity image url'),
    'activity_text': fields.String('Activity text'),
    'facts': fields.List(fields.Nested(facts_model)),
    'section_text': fields.String('Section image description text'),
    'section_image': fields.String('Section image url'),
    'section_image_title': fields.String('Section image url')
}
Exemplo n.º 18
0
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Zorglub42 {contact(at)zorglub42.fr}.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
"""FFBC8 weatherstation data model."""
from flask_restx import fields
from api.restx import API

# Model desecription for methods parameters
SYSTEM_COMMAND_PAYLOAD = API.model("systemCommand", {
    "command": fields.String(
        requied=True,
        description="Command to execute",
        enum=["shutdown", "reboot"]
    )
})
SYSTEM_TIME = API.model("dateTime", {
    "dateTime": fields.String(
        requied=True,
        description="Date is ISO format",
        example="2020-02-21T20:36:28Z"
    )
})

SENSOR_VALUE = API.model("sensorValue", {
    'name': fields.String(
        required=True,
        description='Sensor name',
Exemplo n.º 19
0
from flask_restx import Namespace, Resource, fields
from dao.careProviderDao import *
from dao.employeeDao import *
from uuid import uuid4
from services.updateService import *

api = Namespace('careProvider',
                description='Care Providers related operations')
careProviderDao = CareProviderDao()
employeeDao = EmployeeDao()
updateService = UpdateService()

newCareProvider = api.model(
    'NewCareProvider', {
        'first_name':
        fields.String(required=True, description='CareProvider first name'),
        'last_name':
        fields.String(required=True, description='CareProvider last name'),
        'dob':
        fields.String(required=True, description='CareProvider date of birth'),
        'email':
        fields.String(required=True, description='CareProvider email id')
    })

careProvider = api.inherit(
    'CareProvider', newCareProvider, {
        'id':
        fields.String(required=True, description='unique careProvider id'),
        'per_visit_charges':
        fields.String(required=True,
                      description='careProvider per_visit_charges'),
Exemplo n.º 20
0
          description='Simulator Agent API')


@app.errorhandler(InvalidUsage)
def handle_invalid_usage(error):
    response = jsonify(error.to_dict())
    response.status_code = error.status_code
    return response


# Register Fabric wide operations api
ns_fabric = api.namespace('fabric', description='Fabric wide Apis')
fabric_put_schema = {
    'address_pool':
    fields.String(
        required=True,
        description='List of address pools - eg: [("10.1.1.10", "10.1.1.20"),'
        ' ("10.1.1.30", "10.1.1.40")]'),
    'n_leafs':
    fields.Integer(required=True, description='No of leafs in the fabric'),
    'n_spines':
    fields.Integer(required=True, description='No of spines in the fabric'),
    'n_border_leafs':
    fields.Integer(description='No of border leafs in the fabric'),
    'n_super_spines':
    fields.Integer(description='No of super spines in the fabric'),
    'n_pifs':
    fields.Integer(
        description='No of physical interfaces in each Leaf - eg: 48'),
    'collector':
    fields.String(
        description='Address of the sflow collector if action is start')
Exemplo n.º 21
0
from ..model import Study

api = Namespace("Studies", description="Study related operations")

# Model definition
# ----------------------------------------------------------------------------------------------------------------------

entry_model = api.model(
    "Entry", {"property": fields.Nested(property_model_id), "value": fields.Raw()}
)

entry_model_prop_id = api.model(
    "Entry (property collapsed)",
    {
        "property": fields.String(
            attribute="property.id", example="Property Object Id"
        ),
        "value": fields.Raw(),
    },
)

entry_model_form_format = api.model(
    "Entry (form format)",
    {
        "property_name_1": fields.Raw(example="Some value"),
        "property_name_2": fields.Raw(example="Some value"),
    },
)

change_log = api.model(
    "Change Log",
Exemplo n.º 22
0
"""

__license__ = "LGPLv3+"

from marshmallow import Schema, fields as ma_fields
from flask_restx import fields as f_fields
from marshmallow_jsonschema import JSONSchema

from app.extensions.api import api_v1 as api

dict_schema = {
    'detectorId':
    f_fields.Integer(required=True,
                     description='Primary key (auto-incremented)'),
    'detectorType':
    f_fields.String(required=False, description=''),
    'detectorManufacturer':
    f_fields.String(required=False, description=''),
    'detectorModel':
    f_fields.String(required=False, description=''),
    'detectorPixelSizeHorizontal':
    f_fields.Float(required=False, description=''),
    'detectorPixelSizeVertical':
    f_fields.Float(required=False, description=''),
    'DETECTORMAXRESOLUTION':
    f_fields.Float(required=False, description=''),
    'DETECTORMINRESOLUTION':
    f_fields.Float(required=False, description=''),
    'detectorSerialNumber':
    f_fields.String(required=False, description=''),
    'detectorDistanceMin':
Exemplo n.º 23
0
''' 업체명 조회 '''
search_company_api = Namespace('wanted search_company', path='/search_company', description='업체명으로 업체를 조회한다.')
search_company_parser = reqparse.RequestParser()
search_company_parser.add_argument('search_word', type=str, default='원티드', help='검색 조건')
api.add_namespace(search_company_api)

''' 태그 조회 '''
search_tag_api = Namespace('wanted search_tag', path='/search_tag', description='태그명으로 업체를 조회한다.')
search_tag_parser = reqparse.RequestParser()
search_tag_parser.add_argument('search_word', type=str, default='tag', help='검색 조건')
api.add_namespace(search_tag_api)

''' 태그 수정 '''
update_tag_api = Namespace('wanted update_tag', path='/update_tag', description='업체의 태그명을 변경한다.')
update_tag_model = update_tag_api.model('update_tag',{
    'update_tag_lang': fields.String(description='ko|en|ja', required=True, example="ko"),
    'update_tag': fields.String(description='수정할 태그명', required=True, example="TAG_A")
})
api.add_namespace(update_tag_api)

''' 태그 삭제 '''
delete_tag_api = Namespace('wanted delete_tag', path='/delete_tag', description='업체의 태그명을 삭제한다.(언어단위)')
delete_tag_model = delete_tag_api.model('delete_tag',{
    'delete_tag_lang': fields.String(description='삭제할 태그 lang(ko|en|ja)', required=True, example="ko")
})
api.add_namespace(delete_tag_api)

''' 요청 결과 모델 '''
result_model = api.model('result',{
    'company_id': fields.String(description='ID', required=True, example="1"),
    'company_ko': fields.String(description='회사명(한국어)', required=True, example="원티드"),
Exemplo n.º 24
0
from marshmallow import Schema, fields as ma_fields
from flask_restx import fields as f_fields
from marshmallow_jsonschema import JSONSchema

from pyispyb.app.extensions.api import api_v1 as api

dict_schema = {
    'personId':
    f_fields.Integer(required=True, description=''),
    'laboratoryId':
    f_fields.Integer(required=False, description=''),
    'siteId':
    f_fields.Integer(required=False, description=''),
    'personUUID':
    f_fields.String(required=False, description=''),
    'familyName':
    f_fields.String(required=False, description=''),
    'givenName':
    f_fields.String(required=False, description=''),
    'title':
    f_fields.String(required=False, description=''),
    'emailAddress':
    f_fields.String(required=False, description=''),
    'phoneNumber':
    f_fields.String(required=False, description=''),
    'login':
    f_fields.String(required=False, description=''),
    'faxNumber':
    f_fields.String(required=False, description=''),
    'recordTimeStamp':
Exemplo n.º 25
0
from flask_restx import fields
from esdlvalidator.api import app

schema_summary = app.api.model(
    'SchemaSummary', {
        "id":
        fields.String(required=False, description="ID of the schema"),
        "name":
        fields.String(required=False, description="Name of the schema"),
        "description":
        fields.String(required=False, description="Description of the schema")
    })

schema_validation_select = app.api.model(
    "select", {
        "function":
        fields.String(required=True,
                      description="Name of the function to use",
                      example="get"),
        "alias":
        fields.String(required=True,
                      description="Alias for the dataset",
                      example="areas"),
        "args":
        fields.Raw(required=True,
                   description="Arguments passed to the select function",
                   example={"type": "Area"}),
    })

schema_validation_check = app.api.model(
    "check", {
Exemplo n.º 26
0
from collections import defaultdict

app = Flask(__name__)
api = Api(
    app,
    version='1.0',
    title='TraceMVC API',
    description='A simple TraceMVC API',
)

ns = api.namespace('traces', description='Trace operations')

trace = api.model(
    'Trace', {
        'plus_codes':
        fields.String(required=True, description='pluscod.es'),
        'unix_timestamp':
        fields.String(required=True,
                      description='String representing Unix timestamp'),
        'domain':
        fields.String(required=True, description='Domain name'),
        'key':
        fields.String(required=True, description='String of map key'),
        'value':
        fields.String(required=True, description='String containing value'),
    })


class TraceDAO(object):
    def __init__(self):
        self.counter = 0
Exemplo n.º 27
0
from mycodo.mycodo_flask.api import api
from mycodo.mycodo_flask.api import default_responses
from mycodo.mycodo_flask.api.sql_schema_fields import output_channel_fields
from mycodo.mycodo_flask.api.sql_schema_fields import output_fields
from mycodo.mycodo_flask.api.utils import get_from_db
from mycodo.mycodo_flask.api.utils import return_list_of_dictionaries
from mycodo.mycodo_flask.utils import utils_general
from mycodo.mycodo_flask.utils.utils_output import get_all_output_states

logger = logging.getLogger(__name__)

ns_output = api.namespace('outputs', description='Output operations')

MODEL_STATES_STATE = ns_output.model('states', {
    '*':
    fields.Wildcard(fields.String(description='on, off, or a duty cycle'), )
})
MODEL_STATES_CHAN = ns_output.model(
    'channels', {
        '*':
        fields.Wildcard(
            fields.Nested(
                MODEL_STATES_STATE,
                description=
                'Dictionary with channel as key and state data as value.'))
    })
output_list_fields = ns_output.model(
    'Output Fields List', {
        'output devices':
        fields.List(fields.Nested(output_fields)),
        'output channels':
Exemplo n.º 28
0
api = Api(
    app,
    version='1.0',
    title='My API',
    description='A simple TodoMVC API',
)

ns = api.namespace('todos', description='TODO operations')

todo = api.model(
    'Todo', {
        'id':
        fields.Integer(readonly=True,
                       description='The task unique identifier'),
        'task':
        fields.String(required=True, description='The task details')
    })

DAO = TodoDAO()


@ns.route('/')
class TodoList(Resource):
    '''Shows a list of all todos, and lets you POST to add new tasks'''
    @ns.doc('list_todos')
    @ns.marshal_list_with(todo)
    def get(self):
        '''List all tasks'''
        return DAO.todos

    @ns.doc('create_todo')
Exemplo n.º 29
0
import logging

logger = logging.getLogger(__name__)
mongo = db.mongo


api = Namespace(
    "profiles", description="Profile related routes",
    path="/api/profiles"
)

profile = api.model(
    "Profile",
    {
        "_id": fields.String(description="Profile ID"),
        "user": fields.String(required=True, description="Belong to user"),
        "firstname": fields.String(),
        "lastname": fields.String(),
        "age": fields.Integer(),
        "email": fields.String(),
        "discipline": fields.String(),
    },
)

PROFILES = []


@api.route("/profile/user/<userid>", endpoint="profile")
class Profile(Resource):
    @jwt_required
Exemplo n.º 30
0
from datetime import datetime
from dao.patientDao import *
from dao.billDao import *
from services.updateService import *
from dao.patientCareDao import *

api = Namespace('patient', description='Patients related operations')
patientDao = PatientDao()
billDao = BillDao()
updateService = UpdateService()
patientCareDao = PatientCareDao()

newPatient = api.model(
    'NewPatient', {
        'firstName':
        fields.String(required=True, description='patient first name'),
        'lastName':
        fields.String(required=True, description='patient last name'),
        'email':
        fields.String(required=True, description='patient email address'),
        'contactNumber':
        fields.Integer(required=True, description='patient contact Number'),
        'consentToShare':
        fields.Boolean(required=True,
                       description='patient consent to share information'),
        'dob':
        fields.String(required=True, description='patient date of birth'),
        'age':
        fields.Integer(required=True, description='patient age')
    })