{
user {
id
vehicles {
id
geofence {
status
violationTime
}
history(from: "2018-01-01") {
locations {
id
}
}
lastLocation {
lat
lng
landmark
speed
}
deviceFeatures {
canSendImage
canStreamVideo
canControlEngine
}
}
}
}
}
User Information: Postgres
GeoFence: Redis
Vehicle Last Location: Redis
Photo: File System
History: CouchDB
mutation {
stopEngine(input: { id: "XX-XX-XXXX" }) {
vehiclePayload {
id
engineStatus
}
}
}
mutation {
takePhoto(input: { id: "XX-XX-XXXX" }) {
photoPayload {
data
timestamp
message
}
}
Sends "stop" signal to the GPS Server that holds device connections
Sends "take photo" signal to the GPS Server that holds device connections, waits for data to be loaded
Be careful about automagic table to schema translators, your usecase and API is yours to design, team work FTW!
Module (api/) | Responsiblity |
---|---|
lib/vehicles/context.py | Read/Write logic for all asser related things |
utils/vehicles/serializers.py | Conversion between GraphQL type to Python native type |
web/vehicles/types.py | GraphQL Types |
web/vehicles/resolvers.py | Functions that resolves a path by utilizing lib/asset/*.py functions |
web/vehicles/(queries|mutations.py) | Root queries and mutations for assets module |
Replace .py with .go or .ex if you will