se renombra status por whoami, se agrega getInfoDevice

develop/backend-letrero
Francisco Sandoval 2023-10-13 19:00:54 -03:00
parent cb7b946f5e
commit 5d8944acaa
2 changed files with 95 additions and 6 deletions

View File

@ -9,8 +9,8 @@ class DispositivoViewSet(viewsets.ModelViewSet):
queryset = models.Dispositivo.objects.all()
serializer_class = serializers.DispositivoSerializer
@action(detail=False, methods=['get'])
def status(self, request, pk=None):
@action(detail=False, methods=['post'])
def whoami(self, request, pk=None):
input = json.loads(request.body)
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"
}
})

View File

@ -19,8 +19,8 @@ GET {{server}}/dispositivos
Authorization: Bearer {{token}}
###
# @name status existente
GET {{server}}/dispositivos/status
# @name whoami_existente
POST {{server}}/dispositivos/whoami/
Authorization: Bearer {{token}}
Content-Type: application/json
@ -33,8 +33,8 @@ Content-Type: application/json
###
# @name status no existente
GET {{server}}/dispositivos/status
# @name whoami_no_existe
POST {{server}}/dispositivos/whoami/
Authorization: Bearer {{token}}
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"
}
}
###