Beispiel #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))))
    })
Beispiel #2
0
# -*- coding: utf-8 -*-
from APITaxi_models.hail import Hail as HailModel
from ..api import api
from APITaxi_utils import fields
from .common import coordinates_descriptor
from copy import deepcopy

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'
]
Beispiel #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))})
Beispiel #4
0
})
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,
        "position":
        fields.Nested(coordinates_descriptor),
        "vehicle":
        fields.Nested(vehicle_descriptor, required=True),
        "last_update":
        fields.Integer,
        "crowfly_distance":
        fields.Float,
        "ads":
        fields.Nested(ads_descriptor, required=True),
        "driver":
        fields.Nested(driver_descriptor, required=True),
        "status":
        fields.String,
        "rating":
        fields.Float
    })
Beispiel #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))))
    })
Beispiel #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)
    def get(self, user_id):
Beispiel #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))))
    })
Beispiel #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))})
Beispiel #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))))
    })