Пример #1
0
class Cliente_DTO:
    ns_cliente = Namespace('cliente', validate=True)

    cliente_dto = ns_cliente.model('Cliente',{
        "id": Integer,
        "nome": String(required=True, description='nome do cliente'),
        "cpf":String(required=True),
        "celular":String,
        "email": String(required=True),
        "data_nascimento": DateTime
    })
Пример #2
0
class User_DTO:
    ns_user = Namespace('user', validate=True)

    login_dto = ns_user.model('User Login', {
        "username": String(required=True),
        "password": String(required=True),
    })

    user_dto = ns_user.model(
        'User Cadastro', {
            "id": Integer,
            "username": String(required=True),
            "email": String(required=True),
            "password": String(required=True),
        })

    recuperar_dto = ns_user.model('User Recuperar', {
        "email": String(required=True),
    })
Пример #3
0
from flask_restplus.fields import String

from app.extentions import api

user_model = api.model(
    'UserModel', {
        'id': String(attribute='public_id'),
        'email': String,
        'name': String,
        'surname': String,
        'club': String,
        'group': String,
    })
Пример #4
0
from flask_restplus.fields import String
from .. import api

fields = api.model('Application', {
    'galaxy_role': String(required=True),
    'name': String(required=True),
})
Пример #5
0
from flask_restplus.fields import String
from .. import api

patch_fields = api.model(
    'Patch provider',
    {
        'name': String(required=True),
    },
)
fields = api.clone(
    'Provider',
    patch_fields,
    {
        'type': String(required=True),
    },
)
Пример #6
0
from flask_restplus.fields import String, Nested, Integer, Boolean, DateTime
from .. import api
from .role import fields as role_fields


fields = api.model(
    'User', {
        'active': Boolean(),
        'admin': Boolean(),
        'confirmed_at': DateTime(),
        'email': String(
            description='The email',
            required=True,
            default='*****@*****.**'
        ),
        'id': Integer(),
        'username': String(
            description='Username',
            required=True,
            default='admin'
        ),
    }
)
Пример #7
0
from flask_restplus.fields import String, Nested
from .. import api
from .application import fields as application_fields
from .user import response_fields as user_fields

fields = api.model(
    'Service',
    {
        'name': String(required=True),
    },
)

get_fields = api.clone(
    'Get Services',
    fields,
    {
        'id': String(),
        'applications': Nested(application_fields),
        'user': Nested(user_fields),
    },
)
Пример #8
0
from flask_restplus.fields import Integer, String, Nested
from extensions import api

get_note_fields = api.model(
    'Notes results', {
        'Author': String(description='Note author'),
        'Contents': String(description='Note contents')
    })

post_note_response = api.model(
    'New note posted', {'note_id': String(description='Note unique id')})

get_notes_fields = Nested(get_note_fields)
Пример #9
0
from flask_restplus.fields import String, Nested
from .. import api
from .role import fields as role_fields

fields = api.model(
    'User', {
        'email':
        String(description='The email',
               required=True,
               default='*****@*****.**'),
        'username':
        String(description='Username', required=True, default='admin'),
        'first_name':
        String(),
        'last_name':
        String(),
    })

body_fields = api.clone(
    'User password',
    fields,
    {
        'password':
        String(
            description='Password',
            required=True,
            default='Sekrit',
        )
    },
)
Пример #10
0
from flask_restplus.fields import String
from .. import api

fields = api.model(
    'Auth', {
        'email':
        String(description='The email',
               required=True,
               default='*****@*****.**'),
        'password':
        String(description='The password', required=True, default='Sekrit'),
    })

token_response = api.model('Token', {
    'token': String(),
})
Пример #11
0
from flask_restplus.fields import String
from .. import api


fields = api.model(
    'Host',
    {
        'hostname': String(),
        'ip': String(),
    },
)
Пример #12
0
from flask_restplus.fields import String, DateTime, Float

from . import standards_api

create_standard_req = standards_api.model(
    'CreateStandardRequest', {
        'type': String(required=True, max_length=100),
        'date': DateTime(required=True),
        'value': Float(required=True, min=0),
    })

create_standard_res = standards_api.model('CreateStandardResponse', {
    'id': String(required=True),
    'msg': String(required=True),
})

update_standard_req = standards_api.model(
    'UpdateStandardRequest', {
        'type': String(max_length=100, default=None),
        'date': DateTime(default=None, dt_format='iso8601'),
        'value': Float(min=0, default=None),
    })

standard_model = standards_api.model(
    'StandardResponse', {
        'id': String(attribute='public_id', required=True),
        'type': String(required=True, max_length=100),
        'date': DateTime(required=True),
        'value': Float(required=True, min=0),
    })
Пример #13
0
from flask_restplus.fields import String

from . import auth_api

confirm_req = auth_api.model('ConfirmRequest', {
    'token': String(required=True),
})

retry_confirm_email_req = auth_api.model(
    'RetrySendEmailRequest', {
        'email':
        String(pattern=r'\S+@\S+\.\S+',
               example='*****@*****.**',
               required=True),
    })

sign_up_req = auth_api.model(
    'SingRequest', {
        'email':
        String(pattern=r'\S+@\S+\.\S+',
               example='*****@*****.**',
               required=True),
        'password':
        String(required=True),
        'name':
        String(required=True, max_length=100),
        'surname':
        String(required=True, max_length=100),
        'group':
        String(required=True, max_length=100),
        'club':
Пример #14
0
}  # Initiate pumps in test scenario

flow_param = OrderedDict([('prefix', 'milli'), ('volume_unit', 'litres'),
                          ('time_unit', 'per_second')])

## --- Choose session type --- ##
app.config.from_object(__name__)
app.config['test_session'] = True
app.secret_key = 'secret_key'

## --- Flask-RESTPlus models --- ##
config_setup = api.model(
    'config setup', {
        'dllDir':
        String(description='Path to dll directory',
               required=True,
               example='C:/Users/username/AppData/Local/QmixSDK'),
        'configDir':
        String(
            description='Path to config directory',
            required=True,
            example=
            'C:/Users/Public/Documents/QmixElements/Projects/default_project/Configurations/my_own_config'
        )
    })

pump_client_request = api.model(
    'Pumping request', {
        'targetVolume':
        Float(description='Target volume', required=False, example=5.0),
        'flowRate':
Пример #15
0
from flask_restplus.fields import String
from .. import api

fields = api.model(
    'Log',
    {
        'status': String(),
        'host': String(),
        'task': String(),
        'timestamp': String(),
        'log': String(),
    },
)
Пример #16
0
from flask_restplus.fields import String
from .. import api

fields = api.model(
    'Provision',
    {
        'id': String(),
        'status': String(),
    },
)
Пример #17
0
from flask_restplus.fields import String, DateTime, Boolean
from .. import api

fields = api.model(
    'Gallery',
    {
        'date': DateTime(description='Date'),
        'markdown': String(description='Markdown'),
        'published': Boolean(description='Published', default=False),
        'title': String(description='Title'),
    },
)

get_fields = api.clone(
    'Get Gallery',
    fields,
    {
        'id': String(description='ID'),
    },
)
Пример #18
0
)

launch_ns = Namespace('launches',
                      description='Launch events related operations')
api.add_namespace(launch_ns, path='/launches')

app.register_blueprint(blueprint)

# https://flask-restplus.readthedocs.io/en/stable/marshalling.html
launch_model = api.model(
    'Launch',
    {
        'timestamp':
        DateTime(description="in UTC, timezone information is ignored"),
        'schema':
        String(example='binderhub.jupyter.org/launch'),
        'version':
        Integer(example=3),
        'origin':
        String(example='notebooks.gesis.org'),
        'provider':
        String(example='GitHub'),
        'spec':
        String(example='user/repo/branch'),
        'status':
        String(example='success'),
        # TODO return optionally these values according to query params (?repourl=True&binderurl=True...)
        # 'repo_url': String(example='https://github.com/user/repo'),
        # 'binder_url': String(),
        # 'repo_description': String(),
    })
Пример #19
0
from flask_restplus.fields import String
from .. import api


post_fields = api.model(
    'Post Service',
    {
        'service_id': String(),
    },
)
Пример #20
0
app.config.from_object(__name__)
app.secret_key = 'secret_key'

if os.environ.get('PYQMIX_TEST_MODE') in ['1', 'True']:
    app.config.update(test_session=True)
    print('Enabling test mode.')
else:
    app.config.update(test_session=False)

## --- Flask-RESTPlus models --- ##
config_setup = api.model(
    'config setup', {
        'configName':
        String(
            description=
            'Configuration name, i.e. the name of a sub-directory of C:/Users/Public/Documents/QmixElements/Projects/default_project/Configurations/',
            required=True,
            example='five_pumps'),
        'syringeType':
        String(
            description='Syringe type', required=True, example='25 mL glass')
    })

pump_client_request = api.model(
    'Pumping request', {
        'targetVolume':
        Float(description='Target volume', required=False, example=5.0),
        'flowRate':
        Float(description='Flow rate', required=False, example=0.25)
    })
Пример #21
0
from flask_restplus.fields import Nested, String
from .. import api
from .provider import fields as provider_fields
from .role import fields as role_fields
from .service import get_fields as service_fields


fields = api.model(
    'Cluster', {
        'name': String(required=True),
        'username': String(required=True),
        'sshKey': String(required=True),
    }
)

get_fields = api.clone(
    'Get Clusters',
    fields,
    {
        'providers': Nested(provider_fields),
        'id': String(),
        'roles': Nested(role_fields),
        'services': Nested(service_fields),
    }
)
Пример #22
0
from flask_restplus.fields import String
from .. import api

fields = api.model(
    'Roles', {
        'name': String(required=True),
        'description': String(required=True),
        'admin': String(required=True),
    })
Пример #23
0
from flask_restplus.fields import String, Integer, List, Float
from .. import api

fields = api.model(
    'Gallery',
    {},
)

get_fields = api.clone(
    'Get Gallery',
    fields,
    {
        'id': String(description='ID'),
    },
)