CAD System Departments Update!!
+ Updated cadvanced_mdt to v3.0.0
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
###### IMPORTANT CONFIGURATION FILE - DO NOT EDIT OR DELETE ######
|
||||
https://cad.elite-gaming.co.uk|9daa1d24-d0e8-4149-9da4-a5b4033dbb3e
|
||||
@@ -366,12 +366,21 @@ AddEventHandler(
|
||||
end
|
||||
)
|
||||
|
||||
RegisterNetEvent("data:preference_enable_bolo")
|
||||
RegisterNetEvent("data:departments")
|
||||
AddEventHandler(
|
||||
"data:preference_enable_bolo",
|
||||
"data:departments",
|
||||
function(jsonData)
|
||||
print_debug("RECEIVED ENABLE_BOLO PREFERENCE FROM SERVER")
|
||||
pass_to_nui(jsonData, "preference_enable_bolo")
|
||||
print_debug("RECEIVED DEPARTMENTS FROM SERVER")
|
||||
pass_to_nui(jsonData, "departments")
|
||||
end
|
||||
)
|
||||
|
||||
RegisterNetEvent("data:department_announcements")
|
||||
AddEventHandler(
|
||||
"data:department_announcements",
|
||||
function(jsonData)
|
||||
print_debug("RECEIVED DEPARTMENT ANNOUNCEMENTS FROM SERVER")
|
||||
pass_to_nui(jsonData, "department_announcements")
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ games {"gta5"}
|
||||
|
||||
name "CADvanced MDT"
|
||||
description "CADvanced MDT, a FiveM resource that provides integration between CADvanced (https://cadvanced.app) and FiveM in the form of an in-game MDT."
|
||||
version "2.4.0"
|
||||
version "3.0.0"
|
||||
|
||||
ui_page "ui/build/index.html"
|
||||
ui_page_preload "yes"
|
||||
|
||||
@@ -4,6 +4,7 @@ local calls = module("server/modules/calls")
|
||||
local bolos = module("server/modules/bolos")
|
||||
local vehicles = module("server/modules/vehicles")
|
||||
local citizens = module("server/modules/citizens")
|
||||
local departments = module("server/modules/departments")
|
||||
local preferences = module("server/modules/preferences")
|
||||
local cad_config = module("server/modules/cad_config")
|
||||
|
||||
@@ -16,6 +17,7 @@ SetHttpHandler(
|
||||
function(body)
|
||||
print_debug("POST ROUTER RECEIVED " .. body)
|
||||
local data = json.decode(body)
|
||||
local response = "OK"
|
||||
if next(data) ~= nil then
|
||||
print_debug("HANDLING UPDATED " .. data.object)
|
||||
if (data.object == "user") then
|
||||
@@ -67,6 +69,12 @@ SetHttpHandler(
|
||||
elseif (data.object == "bolos") then
|
||||
-- Repopulate all BOLOs
|
||||
bolos.repopulate_bolos()
|
||||
elseif (data.object == "departments") then
|
||||
-- Update all departments
|
||||
departments.repopulate_departments()
|
||||
elseif (data.object == "department_announcements") then
|
||||
-- Update all department announcements
|
||||
departments.repopulate_department_announcements()
|
||||
elseif (data.object == "whitelist") then
|
||||
-- Repopulate the whitelist
|
||||
users.get_whitelisted()
|
||||
@@ -75,11 +83,14 @@ SetHttpHandler(
|
||||
users.display_panic(data.payload.callId)
|
||||
elseif (data.object == "cad_config") then
|
||||
-- We've received an updated config
|
||||
cad_config.receive_update(data.payload)
|
||||
local updated = cad_config.receive_update(data.payload)
|
||||
if (not updated) then
|
||||
response = "FAIL"
|
||||
end
|
||||
end
|
||||
end
|
||||
res.send(json.encode({
|
||||
result = "OK",
|
||||
result = response,
|
||||
cadvanced_mdt_version = GetResourceMetadata('cadvanced_mdt', 'version', 0)
|
||||
}))
|
||||
end
|
||||
|
||||
@@ -2,11 +2,14 @@ local cad_config = {}
|
||||
|
||||
-- Update config from CAD
|
||||
function cad_config.receive_update(updated_config)
|
||||
local retval = getResourcePath()
|
||||
local conf = io.open(retval .. "/cad.conf", "w")
|
||||
conf:write("###### IMPORTANT CONFIGURATION FILE - DO NOT EDIT OR DELETE ######\n")
|
||||
conf:write(updated_config.url .. "|" .. updated_config.key)
|
||||
io.close(conf)
|
||||
local data = "###### IMPORTANT CONFIGURATION FILE - DO NOT EDIT OR DELETE ######\n" .. updated_config.url .. "|" .. updated_config.key
|
||||
local written = SaveResourceFile(
|
||||
"cadvanced_mdt",
|
||||
"cad.conf",
|
||||
data,
|
||||
-1
|
||||
)
|
||||
return written
|
||||
end
|
||||
|
||||
return cad_config
|
||||
@@ -7,6 +7,7 @@ local vehicles = module("server/modules/vehicles")
|
||||
local legal = module("server/modules/legal")
|
||||
local calls = module("server/modules/calls")
|
||||
local bolos = module("server/modules/bolos")
|
||||
local departments = module("server/modules/departments")
|
||||
local client_sender = module("server/modules/comms/client_sender")
|
||||
|
||||
local client_receiver = {}
|
||||
@@ -26,6 +27,7 @@ function client_receiver.client_event_handlers()
|
||||
-- the side effect of distributing it to all clients, including us
|
||||
users.populate_player()
|
||||
client_sender.pass_data({
|
||||
cad_url = conf.val("cad_url"),
|
||||
homepage = conf.val("homepage"),
|
||||
sound_volume = conf.val("sound_volume"),
|
||||
debug = conf.val("debug"),
|
||||
@@ -67,7 +69,8 @@ function client_receiver.client_event_handlers()
|
||||
client_sender.pass_data(state_get("call_grades"), "call_grades", source)
|
||||
client_sender.pass_data(state_get("call_types"), "call_types", source)
|
||||
client_sender.pass_data(state_get("call_incidents"), "call_incidents", source)
|
||||
client_sender.pass_data(state_get("preference_enable_bolo"), "preference_enable_bolo", source)
|
||||
client_sender.pass_data(state_get("departments"), "departments", source)
|
||||
client_sender.pass_data(state_get("department_announcements"), "department_announcements", source)
|
||||
client_sender.pass_data(user_helpers.get_steam_id(source), "steam_id", source)
|
||||
end
|
||||
)
|
||||
@@ -318,6 +321,16 @@ function client_receiver.client_event_handlers()
|
||||
end
|
||||
)
|
||||
|
||||
-- Get a department's announcements
|
||||
RegisterNetEvent("get_department_announcements")
|
||||
AddEventHandler(
|
||||
"get_department_announcements",
|
||||
function(data)
|
||||
print_debug("RECEIVED REQUEST FROM CLIENT TO GET DEPARTMENT ANNOUNCEMENTS")
|
||||
departments.get_department_announcements(data)
|
||||
end
|
||||
)
|
||||
|
||||
-- Send a unit
|
||||
RegisterNetEvent("send_unit")
|
||||
AddEventHandler(
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
local queries = module("server/modules/queries")
|
||||
local client_sender = module("server/modules/comms/client_sender")
|
||||
local api = module("server/modules/comms/api")
|
||||
|
||||
local departments = {}
|
||||
|
||||
-- Repopulate all department announcements
|
||||
function departments.repopulate_department_announcements()
|
||||
departments.get_department_announcements()
|
||||
end
|
||||
|
||||
-- Get all department announcements
|
||||
function departments.get_department_announcements()
|
||||
local q_all_department_announcements = queries.get_department_announcements()
|
||||
api.request(
|
||||
q_all_department_announcements,
|
||||
function(response)
|
||||
response = json.decode(response)
|
||||
if response.error == nil then
|
||||
local department_announcements_table = {}
|
||||
for _, ann in ipairs(response.data.allDepartmentAnnouncements) do
|
||||
table.insert(department_announcements_table, ann)
|
||||
end
|
||||
state_set("department_announcements", department_announcements_table)
|
||||
client_sender.pass_data(state.department_announcements, "department_announcements")
|
||||
else
|
||||
print_debug(response.error)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
-- Repopulate all departments
|
||||
function departments.repopulate_departments()
|
||||
departments.get_all_departments(true)
|
||||
end
|
||||
|
||||
-- Get all departments
|
||||
function departments.get_all_departments(pass_to_client)
|
||||
local q_all_departments = queries.get_all_departments()
|
||||
api.request(
|
||||
q_all_departments,
|
||||
function(response)
|
||||
response = json.decode(response)
|
||||
if response.error == nil then
|
||||
local departments_table = {}
|
||||
for _, dept in ipairs(response.data.allDepartments) do
|
||||
table.insert(departments_table, dept)
|
||||
end
|
||||
state_set("departments", departments_table)
|
||||
if (pass_to_client ~= nil and pass_to_client) then
|
||||
client_sender.pass_data(state.departments, "departments")
|
||||
end
|
||||
else
|
||||
print_debug(response.error)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
return departments;
|
||||
@@ -8,6 +8,7 @@ local vehicles = module("server/modules/vehicles")
|
||||
local legal = module("server/modules/legal")
|
||||
local locations = module("server/modules/locations")
|
||||
local calls = module("server/modules/calls")
|
||||
local departments = module("server/modules/departments")
|
||||
local preferences = module("server/modules/preferences")
|
||||
local client_receiver = module("server/modules/comms/client_receiver")
|
||||
|
||||
@@ -75,8 +76,11 @@ function init.bootstrapData()
|
||||
-- Get all locations
|
||||
locations.get_all_locations()
|
||||
|
||||
-- Find out if BOLOs are enabled
|
||||
preferences.get_preference("enable_bolo")
|
||||
-- Get all departments
|
||||
departments.get_all_departments()
|
||||
|
||||
-- Get all department announcements
|
||||
departments.get_department_announcements()
|
||||
end
|
||||
|
||||
function init.createEventHandlers()
|
||||
|
||||
@@ -16,7 +16,7 @@ function queries.get_user(steam_id)
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = _doSub(
|
||||
'{ getUser(steamId: "$x") { id userName steamId avatarUrl x y roles { id name code } character { ... on Citizen { id firstName lastName active __typename } ... on Officer { id firstName lastName active __typename } } } }',
|
||||
'{ getUser(steamId: "$x") { id userName steamId avatarUrl x y roles { id name code } character { ... on Citizen { id firstName lastName active __typename } ... on Officer { id firstName lastName active department { id colour logo name bolo } __typename } } } }',
|
||||
{x = steam_id}
|
||||
)
|
||||
}
|
||||
@@ -29,7 +29,7 @@ function queries.start_panic(steam_id)
|
||||
variables = {
|
||||
steamId = steam_id
|
||||
},
|
||||
query = 'mutation ($steamId: String!) { startPanic(steamId: $steamId) { id callerInfo markerX markerY callType { id name code readonly } callGrade { id name code readonly } callLocations { id name code readonly } callIncidents { id name code readonly } callDescriptions { id text } } }'
|
||||
query = 'mutation ($steamId: String!) { startPanic(steamId: $steamId) { id callerInfo markerX markerY DepartmentId callType { id name code readonly DepartmentId } callGrade { id name code readonly DepartmentId } callLocations { id name code readonly } callIncidents { id name code readonly DepartmentId } callDescriptions { id text } } }'
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -37,7 +37,7 @@ end
|
||||
function queries.get_all_calls()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allCalls { id callerInfo markerX markerY callGrade { id name } callType { id name } callLocations { id name } callIncidents { id name } callDescriptions { id text } assignedUnits { id } } }"
|
||||
query = "{ allCalls { id callerInfo markerX markerY DepartmentId callGrade { id name code readonly DepartmentId } callType { id name code readonly DepartmentId } callLocations { id name } callIncidents { id name code readonly DepartmentId } callDescriptions { id text } assignedUnits { id } } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -56,7 +56,23 @@ end
|
||||
function queries.get_all_bolos()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allBolos { id boloType details { description knownName weapons lastLocation reason licencePlate driverDescription occupants } updatedAt } }"
|
||||
query = "{ allBolos { id boloType DepartmentId details { description knownName weapons lastLocation reason licencePlate driverDescription occupants } updatedAt } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
|
||||
function queries.get_all_departments()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = '{allDepartments{id name colour logo readonly bolo}}'
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
|
||||
function queries.get_department_announcements()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = 'query allDepartmentAnnouncements($id: ID) { allDepartmentAnnouncements(id: $id) { id text DepartmentId createdAt updatedAt } }'
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -64,7 +80,7 @@ end
|
||||
function queries.get_all_units()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allUnits { id callSign unitType { id name } unitState { id name colour code active } UnitTypeId UnitStateId } }"
|
||||
query = "{ allUnits { id callSign DepartmentId unitType { id name DepartmentId } unitState { id name colour code active DepartmentId } UnitTypeId UnitStateId } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -80,7 +96,7 @@ end
|
||||
function queries.get_all_user_ranks()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allUserRanks { id name position } } "
|
||||
query = "{ allUserRanks { id name position DepartmentId } } "
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -89,7 +105,7 @@ function queries.get_unit(unit_id)
|
||||
local query = {
|
||||
operationname = null,
|
||||
query = _doSub(
|
||||
"{ getUnit(id: $x) { id callSign unitType { id name } unitState { id name colour code } UnitTypeId UnitStateId } }",
|
||||
"{ getUnit(id: $x) { id callSign DepartmentId unitType { id name DepartmentId } unitState { id name colour code DepartmentId } UnitTypeId UnitStateId } }",
|
||||
{x = unit_id}
|
||||
)
|
||||
}
|
||||
@@ -100,7 +116,7 @@ function queries.get_call(call_id)
|
||||
local query = {
|
||||
operationname = null,
|
||||
query = _doSub(
|
||||
"{ getCall(id: $x) { id callerInfo markerX markerY callGrade { id name } callType { id name } callLocations { id name } callIncidents { id name } callDescriptions { id text } assignedUnits { id } } }",
|
||||
"{ getCall(id: $x) { id callerInfo markerX markerY DepartmentId callGrade { id name DepartmentId } callType { id name code readonly DepartmentId } callLocations { id name } callIncidents { id name DepartmentId } callDescriptions { id text } assignedUnits { id } } }",
|
||||
{x = call_id}
|
||||
)
|
||||
}
|
||||
@@ -160,9 +176,10 @@ function queries.send_citizen_call(props)
|
||||
steamId = props.steamId,
|
||||
location = props.location,
|
||||
callerInfo = props.callerInfo,
|
||||
DepartmentId = props.DepartmentId,
|
||||
notes = props.notes
|
||||
},
|
||||
query = 'mutation ($steamId: String!, $location: String!, $callerInfo: String!, $notes: String!) { createCitizenCall(steamId: $steamId, location: $location, callerInfo: $callerInfo, notes: $notes) { id } }'
|
||||
query = 'mutation ($steamId: String!, $location: String!, $callerInfo: String!, $notes: String!, $DepartmentId: ID!) { createCitizenCall(steamId: $steamId, location: $location, callerInfo: $callerInfo, notes: $notes, DepartmentId: $DepartmentId) { id } }'
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -215,7 +232,7 @@ end
|
||||
function queries.get_all_unit_states()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allUnitStates { id name colour } } "
|
||||
query = "{ allUnitStates { id name colour DepartmentId } } "
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -223,7 +240,7 @@ end
|
||||
function queries.get_all_unit_types()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allUnitTypes { id name } } "
|
||||
query = "{ allUnitTypes { id name DepartmentId } } "
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -259,9 +276,10 @@ function queries.set_unit_state(props, unit)
|
||||
id = props.unitId,
|
||||
callSign = unit.callSign,
|
||||
UnitStateId = props.stateId,
|
||||
UnitTypeId = unit.UnitTypeId
|
||||
UnitTypeId = unit.UnitTypeId,
|
||||
DepartmentId = unit.DepartmentId
|
||||
},
|
||||
query = "mutation ($id: ID!, $callSign: String!, $UnitTypeId: ID!, $UnitStateId: ID!) { updateUnit(id: $id, callSign: $callSign, UnitTypeId: $UnitTypeId, UnitStateId: $UnitStateId) { id callSign unitType { id name } unitState { id name colour code } UnitTypeId UnitStateId } }"
|
||||
query = "mutation ($id: ID!, $callSign: String!, $UnitTypeId: ID!, $UnitStateId: ID!, $DepartmentId: ID!) { updateUnit(id: $id, callSign: $callSign, UnitTypeId: $UnitTypeId, UnitStateId: $UnitStateId, DepartmentId: $DepartmentId) { id callSign unitType { id name DepartmentId } unitState { id name colour code DepartmentId } UnitTypeId UnitStateId DepartmentId } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -448,7 +466,7 @@ end
|
||||
function queries.get_all_call_grades()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allCallGrades { id name code } }"
|
||||
query = "{ allCallGrades { id name code DepartmentId } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -456,7 +474,7 @@ end
|
||||
function queries.get_all_call_types()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allCallTypes { id name code } }"
|
||||
query = "{ allCallTypes { id name code DepartmentId } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -464,7 +482,7 @@ end
|
||||
function queries.get_all_call_incidents()
|
||||
local query = {
|
||||
operationName = null,
|
||||
query = "{ allIncidentTypes { id name code } }"
|
||||
query = "{ allIncidentTypes { id name code DepartmentId } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -473,6 +491,7 @@ function queries.create_call(props)
|
||||
local query = {
|
||||
operationName = null,
|
||||
variables = {
|
||||
DepartmentId = props.DepartmentId,
|
||||
callerInfo = props.callerInfo,
|
||||
callGrade = props.callGrade,
|
||||
callType = props.callType,
|
||||
@@ -482,7 +501,7 @@ function queries.create_call(props)
|
||||
markerX = 0,
|
||||
markerY = 0
|
||||
},
|
||||
query = "mutation ($callerInfo: String, $callGrade: CallGradeInput!, $callType: CallTypeInput!, $callIncidents: [IncidentTypeInput]!, $callLocations: [LocationInput!]!, $callDescriptions: [CallDescriptionInput], $markerX: Float, $markerY: Float) { createCall(callerInfo: $callerInfo, callGrade: $callGrade, callType: $callType, callIncidents: $callIncidents, callLocations: $callLocations, callDescriptions: $callDescriptions, markerX: $markerX, markerY: $markerY) { id callerInfo markerX markerY callType { id name code readonly } callGrade { id name code readonly } callLocations { id name code readonly } callIncidents { id name code readonly } callDescriptions { id text } }}"
|
||||
query = "mutation ($callerInfo: String, $callGrade: CallGradeInput!, $callType: CallTypeInput!, $callIncidents: [IncidentTypeInput]!, $callLocations: [LocationInput!]!, $callDescriptions: [CallDescriptionInput], $markerX: Float, $markerY: Float, $DepartmentId: ID!) { createCall(callerInfo: $callerInfo, callGrade: $callGrade, callType: $callType, callIncidents: $callIncidents, callLocations: $callLocations, callDescriptions: $callDescriptions, markerX: $markerX, markerY: $markerY, DepartmentId: $DepartmentId) { id callerInfo markerX markerY DepartmentId callType { id name code readonly DepartmentId } callGrade { id name code readonly DepartmentId } callLocations { id name code readonly } callIncidents { id name code readonly DepartmentId } callDescriptions { id text } }}"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -492,6 +511,7 @@ function queries.update_call(props)
|
||||
operationName = null,
|
||||
variables = {
|
||||
id = props.id,
|
||||
DepartmentId = props.DepartmentId,
|
||||
callerInfo = props.callerInfo,
|
||||
callGrade = props.callGrade,
|
||||
callType = props.callType,
|
||||
@@ -501,7 +521,7 @@ function queries.update_call(props)
|
||||
markerX = props.markerX,
|
||||
markerY = props.markerY
|
||||
},
|
||||
query = "mutation ($id: ID!, $callerInfo: String, $callGrade: CallGradeInput!, $callType: CallTypeInput!, $callIncidents: [IncidentTypeInput]!, $callLocations: [LocationInput!]!, $callDescriptions: [CallDescriptionInput], $markerX: Float, $markerY: Float) { updateCall(id: $id, callerInfo: $callerInfo, callGrade: $callGrade, callType: $callType, callIncidents: $callIncidents, callLocations: $callLocations, callDescriptions: $callDescriptions, markerX: $markerX, markerY: $markerY) { id callerInfo markerX markerY callType { id name code readonly } callGrade { id name code readonly } callLocations { id name code readonly } callIncidents { id name code readonly } callDescriptions { id text } }}"
|
||||
query = "mutation ($id: ID!, $callerInfo: String, $callGrade: CallGradeInput!, $callType: CallTypeInput!, $callIncidents: [IncidentTypeInput]!, $callLocations: [LocationInput!]!, $callDescriptions: [CallDescriptionInput], $markerX: Float, $markerY: Float, $DepartmentId: ID!) { updateCall(id: $id, callerInfo: $callerInfo, callGrade: $callGrade, callType: $callType, callIncidents: $callIncidents, callLocations: $callLocations, callDescriptions: $callDescriptions, markerX: $markerX, markerY: $markerY, DepartmentId: $DepartmentId) { id callerInfo markerX markerY DepartmentId callType { id name code readonly DepartmentId } callGrade { id name code readonly DepartmentId } callLocations { id name code readonly } callIncidents { id name code readonly DepartmentId } callDescriptions { id text } }}"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -511,10 +531,11 @@ function queries.create_bolo(props)
|
||||
operationName = null,
|
||||
variables = {
|
||||
id = props.id,
|
||||
DepartmentId = props.DepartmentId,
|
||||
boloType = props.boloType,
|
||||
details = props.details
|
||||
},
|
||||
query = "mutation createBolo($boloType: String! $details: BoloDetailsInput!) {createBolo(boloType: $boloType details: $details) {id boloType details { description licencePlate driverDescription occupants lastLocation reason } } }"
|
||||
query = "mutation createBolo($boloType: String! $details: BoloDetailsInput! $DepartmentId: ID!) {createBolo(boloType: $boloType details: $details DepartmentId: $DepartmentId) {id boloType DepartmentId details { description licencePlate driverDescription occupants lastLocation reason } } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -524,10 +545,11 @@ function queries.update_bolo(props)
|
||||
operationName = null,
|
||||
variables = {
|
||||
id = props.id,
|
||||
DepartmentId = props.DepartmentId,
|
||||
boloType = props.boloType,
|
||||
details = props.details
|
||||
},
|
||||
query = "mutation ($id: ID! $boloType: String! $details: BoloDetailsInput!){updateBolo(id: $id boloType: $boloType details: $details){id boloType details{licencePlate driverDescription occupants lastLocation reason}}}"
|
||||
query = "mutation ($id: ID! $boloType: String! $details: BoloDetailsInput! $DepartmentId: ID!){updateBolo(id: $id boloType: $boloType details: $details DepartmentId: $DepartmentId){id boloType DepartmentId details {licencePlate driverDescription occupants lastLocation reason}}}"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -558,11 +580,12 @@ function queries.create_unit(props)
|
||||
local query = {
|
||||
operationName = null,
|
||||
variables = {
|
||||
DepartmentId = props.DepartmentId,
|
||||
callSign = props.callSign,
|
||||
unitStateId = props.unitState.id,
|
||||
unitTypeId = props.unitType.id
|
||||
},
|
||||
query = "mutation ($callSign: String!, $unitTypeId: ID!, $unitStateId: ID!) { createUnit(callSign: $callSign, UnitTypeId: $unitTypeId, UnitStateId: $unitStateId) { id } }"
|
||||
query = "mutation ($callSign: String!, $unitTypeId: ID!, $unitStateId: ID!, $DepartmentId: ID!) { createUnit(callSign: $callSign, UnitTypeId: $unitTypeId, UnitStateId: $unitStateId, DepartmentId: $DepartmentId) { id } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
@@ -572,11 +595,12 @@ function queries.update_unit(props)
|
||||
operationName = null,
|
||||
variables = {
|
||||
id = props.id,
|
||||
DepartmentId = props.DepartmentId,
|
||||
callSign = props.callSign,
|
||||
unitStateId = props.unitState.id,
|
||||
unitTypeId = props.unitType.id
|
||||
},
|
||||
query = "mutation ($id: ID!, $callSign: String!, $unitTypeId: ID!, $unitStateId: ID!) { updateUnit(id: $id, callSign: $callSign, UnitTypeId: $unitTypeId, UnitStateId: $unitStateId) { id } }"
|
||||
query = "mutation ($id: ID!, $callSign: String!, $unitTypeId: ID!, $unitStateId: ID!, $DepartmentId: ID!) { updateUnit(id: $id, callSign: $callSign, UnitTypeId: $unitTypeId, UnitStateId: $unitStateId, DepartmentId: $DepartmentId) { id } }"
|
||||
}
|
||||
return json.encode(query)
|
||||
end
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user