Esempio n. 1
0
#coding: utf-8
from APITaxi_utils import fields
from ..api import api
from APITaxi_models.taxis import ADS

ads_model = api.model(
    'ADS_model_data', {
        'data':
        fields.List(
            fields.Nested(api.model('ADS_model', ADS.marshall_obj(api=api))))
    })

ads_expect = api.model(
    'ADS_expect_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model(
                    'ADS_expect',
                    ADS.marshall_obj(show_all=True, filter_id=True, api=api))))
    })

ads_post = api.model(
    'ADS_post_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model('ADS_post', ADS.marshall_obj(show_all=True,
                                                       api=api))))
    })
Esempio n. 2
0
all_fields = HailModel.marshall_obj(api=api)
all_fields['operateur'] = fields.String(attribute='operateur.email',
                                        required=True)
all_fields['id'] = fields.String()
all_fields['taxi'] = fields.Nested(
    api.model(
        'hail_taxi', {
            'position': fields.Nested(coordinates_descriptor),
            'last_update': fields.Integer(),
            'id': fields.String()
        }))
all_fields['creation_datetime'] = fields.DateTime()

hail_model = api.model(
    'hail_model_data',
    {'data': fields.List(fields.Nested(api.model('hail_model', all_fields)))})

puttable_arguments = [
    'status', 'incident_taxi_reason', 'reporting_customer',
    'reporting_customer_reason', 'customer_lon', 'customer_lat',
    'customer_address', 'customer_phone_number', 'rating_ride',
    'rating_ride_reason', 'incident_customer_reason'
]

dict_hail = dict(
    filter(lambda f: f[0] in puttable_arguments, all_fields.items()))

postable_arguemnts = [
    'customer_id', 'customer_lon', 'customer_lat', 'customer_address',
    'customer_phone_number', 'taxi_id', 'operateur'
]
Esempio n. 3
0
# -*- coding: utf-8 -*-
from ..api import api
from APITaxi_utils import fields

waiting_time_model = api.model('waiting_time_descriptor', {
    "timestamp": fields.String(),
    "waiting_time": fields.Integer()
})

waiting_time_response = api.model(
    'waiting_time_response',
    {"data": fields.List(fields.Nested(waiting_time_model))})
Esempio n. 4
0
# -*- coding: utf-8 -*-
from ..api import api
from APITaxi_utils import fields
from .common import coordinates_descriptor

vehicle_descriptor = api.model(
    'vehicle_descriptor', {
        "model": fields.String,
        "constructor": fields.String,
        "color": fields.String(),
        "licence_plate": fields.String,
        "characteristics": fields.List(fields.String),
        "nb_seats": fields.Integer
    })
ads_descriptor = api.model('ads_descriptor', {
    "numero": fields.String,
    "insee": fields.String
})
driver_descriptor = api.model('driver_descriptor', {
    'professional_licence': fields.String,
    'departement': fields.String
})
taxi_descriptor = api.model(
    'taxi_descriptor', {
        "id":
        fields.String,
        "internal_id":
        fields.String(attribute=lambda t: t.vehicle.internal_id
                      if type(t) is not dict else t['internal_id']),
        "operator":
        fields.String,
Esempio n. 5
0
#coding: utf-8
from ..api import api
from APITaxi_models.vehicle import Vehicle
from APITaxi_utils import fields

vehicle_model = api.model(
    'vehicle_model_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model('vehicle_model', Vehicle.marshall_obj(api=api))))
    })

vehicle_expect = api.model(
    'vehicle_expect_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model(
                    'vehicle_expect',
                    Vehicle.marshall_obj(
                        filter_id=True, api=api, add_description=False))))
    })
Esempio n. 6
0
        return url_for('profile.image', user_id=obj.user_id, src=obj.id)


model_user = api.model(
    "user", {
        'data':
        fields.List(
            fields.Nested(
                api.model(
                    "user_model", {
                        "name":
                        fields.String(attribute='commercial_name'),
                        "logos":
                        fields.List(
                            fields.Nested(
                                api.model(
                                    'logo_model', {
                                        'href':
                                        LogoHref,
                                        'size':
                                        fields.String,
                                        'format':
                                        fields.String(attribute='format_'),
                                    })))
                    })))
    })


@ns_administrative.route('users/<int:user_id>')
class ProfileDetail(Resource):
    @api.marshal_with(model_user)
Esempio n. 7
0
#coding: utf-8
from ..api import api
from APITaxi_models import Driver
from APITaxi_utils import fields

driver_fields = api.model(
    'driver_fields_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model('driver_fields', Driver.marshall_obj(api=api))))
    })

driver_details_expect = api.model(
    'driver_expect_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model('driver_expect',
                          Driver.marshall_obj(filter_id=True, api=api))))
    })
Esempio n. 8
0
#coding: utf-8
from APITaxi_utils import fields
from ..api import api

customer_fields = api.model(
    'customer_model', {
        'customer_id': fields.String,
        'moteur_id': fields.String,
        'reprieve_begin': fields.String,
        'reprieve_end': fields.String,
        'ban_begin': fields.String,
        'ban_end': fields.String,
    })
customer_model = api.model(
    'customer_model_data',
    {'data': fields.List(fields.Nested(customer_fields))})
Esempio n. 9
0
#coding: utf-8
from ..api import api
from APITaxi_models.vehicle import Vehicle
from APITaxi_utils import fields

vehicle_model = api.model(
    'vehicle_model_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model('vehicle_model', Vehicle.marshall_obj(api=api))))
    })

vehicle_expect = api.model(
    'vehicle_expect_data', {
        'data':
        fields.List(
            fields.Nested(
                api.model('vehicle_expect',
                          Vehicle.marshall_obj(filter_id=True, api=api))))
    })