se renombra status por whoami, se agrega getInfoDevice
parent
cb7b946f5e
commit
5d8944acaa
|
@ -9,8 +9,8 @@ class DispositivoViewSet(viewsets.ModelViewSet):
|
||||||
queryset = models.Dispositivo.objects.all()
|
queryset = models.Dispositivo.objects.all()
|
||||||
serializer_class = serializers.DispositivoSerializer
|
serializer_class = serializers.DispositivoSerializer
|
||||||
|
|
||||||
@action(detail=False, methods=['get'])
|
@action(detail=False, methods=['post'])
|
||||||
def status(self, request, pk=None):
|
def whoami(self, request, pk=None):
|
||||||
input = json.loads(request.body)
|
input = json.loads(request.body)
|
||||||
whoami = input['whoami']
|
whoami = input['whoami']
|
||||||
|
|
||||||
|
@ -31,3 +31,76 @@ class DispositivoViewSet(viewsets.ModelViewSet):
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@action(detail=False, methods=['post'])
|
||||||
|
def getInfoDevice(self, request, pk=None):
|
||||||
|
input = json.loads(request.body)
|
||||||
|
|
||||||
|
linea1 = {
|
||||||
|
"Linea": "803010",
|
||||||
|
"Descripción": "Tucapel",
|
||||||
|
"TipoLocomocion": 1,
|
||||||
|
"colorFondo": "Hexadecimal",
|
||||||
|
"colorLetra": "Hexadecimal",
|
||||||
|
"Llegadas": [
|
||||||
|
{
|
||||||
|
"Patente": "RPDA-98",
|
||||||
|
"Planificada": "",
|
||||||
|
"EstimadaGPS": "15:08",
|
||||||
|
"DistanciaGPS": "1.0 KM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Patente": "WYXYZ-22",
|
||||||
|
"Planificada": "",
|
||||||
|
"EstimadaGPS": "15:42",
|
||||||
|
"DistanciaGPS": "5.0 KM"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Patente": "ABCA-65",
|
||||||
|
"Planificada": "",
|
||||||
|
"EstimadaGPS": "16:18",
|
||||||
|
"DistanciaGPS": "13.4 KM"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Mensajelinea": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
linea2 = {
|
||||||
|
"Linea": "5487",
|
||||||
|
"Descripción": "Centauro",
|
||||||
|
"TipoLocomocion": 1,
|
||||||
|
"colorFondo": "Hexadecimal",
|
||||||
|
"colorLetra": "Hexadecimal",
|
||||||
|
"Llegadas": [
|
||||||
|
{
|
||||||
|
"Patente": "PLKJ-32",
|
||||||
|
"Planificada": "15:13",
|
||||||
|
"EstimadaGPS": "",
|
||||||
|
"DistanciaGPS": "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Patente": "GHLK-11",
|
||||||
|
"Planificada": "15:39",
|
||||||
|
"EstimadaGPS": "",
|
||||||
|
"DistanciaGPS": "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Patente": "DFQW-55",
|
||||||
|
"Planificada": "16:22",
|
||||||
|
"EstimadaGPS": "",
|
||||||
|
"DistanciaGPS": "",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Mensajelinea": "Sin info. GPS, la informacion es estimada"
|
||||||
|
}
|
||||||
|
|
||||||
|
detalle_lineas = []
|
||||||
|
detalle_lineas.append(linea1)
|
||||||
|
detalle_lineas.append(linea2)
|
||||||
|
|
||||||
|
return JsonResponse({
|
||||||
|
"GetInfoDeviceResponse": {
|
||||||
|
"DetalleLineas": detalle_lineas,
|
||||||
|
"MensajeParadero": "No considerar, uso futuro"
|
||||||
|
}
|
||||||
|
})
|
|
@ -19,8 +19,8 @@ GET {{server}}/dispositivos
|
||||||
Authorization: Bearer {{token}}
|
Authorization: Bearer {{token}}
|
||||||
|
|
||||||
###
|
###
|
||||||
# @name status existente
|
# @name whoami_existente
|
||||||
GET {{server}}/dispositivos/status
|
POST {{server}}/dispositivos/whoami/
|
||||||
Authorization: Bearer {{token}}
|
Authorization: Bearer {{token}}
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ Content-Type: application/json
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
# @name status no existente
|
# @name whoami_no_existe
|
||||||
GET {{server}}/dispositivos/status
|
POST {{server}}/dispositivos/whoami/
|
||||||
Authorization: Bearer {{token}}
|
Authorization: Bearer {{token}}
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
|
@ -45,3 +45,19 @@ Content-Type: application/json
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
# @name get_info_device
|
||||||
|
POST {{server}}/dispositivos/getInfoDevice/
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"GetInfoDevice": {
|
||||||
|
"idDispositivo": "existe",
|
||||||
|
"KeyAutorizacion":"token"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
|
Loading…
Reference in New Issue