Skip to content

Commit

Permalink
Updated documentation to match current state for 0.20 release. Added …
Browse files Browse the repository at this point in the history
…Id to map markers, updated unit app payload call to return call types, added notes api controller call for getting unexpires and started notes, added call and call priorities api call to get by department id. Added stub eventing hub to update when department info changes (not yet implemented)
  • Loading branch information
ucswift committed Feb 27, 2020
1 parent ca7ea05 commit d22e1fb
Show file tree
Hide file tree
Showing 27 changed files with 520 additions and 65 deletions.
2 changes: 1 addition & 1 deletion Core/Resgrid.Config/DataConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class DataConfig
{
public static string ConnectionString = "Data Source=(local);Initial Catalog=Resgrid;Integrated Security=True;MultipleActiveResultSets=True;";
public static string ConnectionString = "Server=rgdevserver;Database=Resgrid;User Id=resgrid_app;Password=resgrid123;MultipleActiveResultSets=True;";

public const string UsersIdentityRoleId = "38b461d7-e848-46ef-8c06-ece5b618d9d1";
public const string AdminsIdentityRoleId = "1f6a03a8-62f4-4179-80fc-2eb96266cf04";
Expand Down
4 changes: 2 additions & 2 deletions Core/Resgrid.Config/ResgridConfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"InfoConfig.ConfigVersion": "1",

"DataConfig.ConnectionString": "Data Source=(local);Initial Catalog=Resgrid;Integrated Security=True;MultipleActiveResultSets=True;",
"DataConfig.ConnectionString": "Server=rgdevserver;Database=Resgrid;User Id=resgrid_app;Password=resgrid123;MultipleActiveResultSets=True;",

"SystemBehaviorConfig.ResgridBaseUrl": "http://resgrid.local",
"SystemBehaviorConfig.ResgridApiBaseUrl": "http://resgridapi.local",
Expand Down Expand Up @@ -43,7 +43,7 @@
"OutboundEmailServerConfig.PostmarkWelcomeTemplateId": "",
"OutboundEmailServerConfig.PostmarkNewDepLinkTemplateId": "",

"WorkerConfig.WorkerDbConnectionString": "Data Source=(local);Initial Catalog=ResgridWorkers;Integrated Security=True;MultipleActiveResultSets=True;",
"WorkerConfig.WorkerDbConnectionString": "Server=rgdevserver;Database=ResgridWorkers;User Id=resgrid_app;Password=resgrid123;MultipleActiveResultSets=True;",
"WorkerConfig.PayloadKey": "XsBYpdbdHkhuGsU3tvTMawyV6d3M2F8EQ8wQ2jVLBREECQmwngACk2hm4Ykb7eW7Qsm6za8RdJBY5Z3xvN6erYry47nJ5XmL",

"ServiceBusConfig.RabbitHostname": "localhost",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ public BigBoardMapModel GetMap()
foreach (var station in stations)
{
MapMakerInfo info = new MapMakerInfo();
info.Id = $"s{station.DepartmentGroupId}";
info.ImagePath = "Station";
info.Title = station.Name;
info.InfoWindowContent = station.Name;
Expand Down Expand Up @@ -417,6 +418,7 @@ public BigBoardMapModel GetMap()
{
MapMakerInfo info = new MapMakerInfo();
info.ImagePath = "Call";
info.Id = $"c{call.CallId}";
info.Title = call.Name;
info.InfoWindowContent = call.NatureOfCall;

Expand Down Expand Up @@ -451,6 +453,7 @@ public BigBoardMapModel GetMap()
{
MapMakerInfo info = new MapMakerInfo();
info.ImagePath = "Engine_Responding";
info.Id = $"u{unit.UnitId}";
info.Title = unit.Unit.Name;
info.InfoWindowContent = "";
info.Latitude = double.Parse(unit.Latitude.Value.ToString());
Expand Down Expand Up @@ -492,6 +495,7 @@ public BigBoardMapModel GetMap()
info.ImagePath = "Person_RespondingCall";
}

//info.Id = $"p{person.}";
info.Title = person.Name;
info.InfoWindowContent = "";
info.Latitude = double.Parse(person.Latitude.Value.ToString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,39 @@ public List<CallPriorityResult> GetAllCallPriorites()
return result;
}

/// <summary>
/// Returns all the call priorities (including deleted ones) for a selected department
/// </summary>
/// <returns>Array of CallPriorityResult objects for each call priority in the department</returns>
[System.Web.Http.AcceptVerbs("GET")]
public List<CallPriorityResult> GetAllCallPrioritesForDepartment(int departmentId)
{
var result = new List<CallPriorityResult>();

if (departmentId != DepartmentId && !IsSystem)
Unauthorized();

var priorities = _callsService.GetCallPrioritesForDepartment(departmentId);

foreach (var p in priorities)
{
var priority = new CallPriorityResult();

priority.Id = p.DepartmentCallPriorityId;
priority.DepartmentId = p.DepartmentId;
priority.Name = StringHelpers.SanitizeHtmlInString(p.Name);
priority.Color = p.Color;
priority.Sort = p.Sort;
priority.IsDeleted = p.IsDeleted;
priority.IsDefault = p.IsDefault;
priority.Tone = p.Tone;

result.Add(priority);
}

return result;
}

/// <summary>
/// Return the audio file for push notifications for a specific call priority
/// </summary>
Expand Down
151 changes: 151 additions & 0 deletions Web/Resgrid.Services/Controllers/Version3/CallsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,157 @@ public List<CallResult> GetActiveCalls()
return result;
}

/// <summary>
/// Returns all the active calls for the department (extended object result, more verbose then GetActiveCalls)
/// </summary>
/// <returns>Array of DepartmentCallResult objects for each active call in the department</returns>
[System.Web.Http.AcceptVerbs("GET")]
public List<DepartmentCallResult> GetActiveCallsForDepartment(int departmentId)
{
var result = new List<DepartmentCallResult>();

if (departmentId != DepartmentId && !IsSystem)
Unauthorized();

var calls = _callsService.GetActiveCallsByDepartment(departmentId).OrderByDescending(x => x.LoggedOn);
var department = _departmentsService.GetDepartmentById(departmentId, false);

foreach (var c in calls)
{
var call = new DepartmentCallResult();

call.Name = StringHelpers.SanitizeHtmlInString(c.Name);

if (!String.IsNullOrWhiteSpace(c.NatureOfCall))
call.NatureOfCall = StringHelpers.SanitizeHtmlInString(c.NatureOfCall);

if (!String.IsNullOrWhiteSpace(c.Notes))
call.Notes = StringHelpers.SanitizeHtmlInString(c.Notes);

//if (c.CallNotes != null)
// call.Nts = c.CallNotes.Count();
//else
// call.Nts = 0;

//if (c.Attachments != null)
//{
// call.Aud = c.Attachments.Count(x => x.CallAttachmentType == (int)CallAttachmentTypes.DispatchAudio);
// call.Img = c.Attachments.Count(x => x.CallAttachmentType == (int)CallAttachmentTypes.Image);
// call.Fls = c.Attachments.Count(x => x.CallAttachmentType == (int)CallAttachmentTypes.File);
//}
//else
//{
// call.Aud = 0;
// call.Img = 0;
// call.Fls = 0;
//}

//if (String.IsNullOrWhiteSpace(c.Address) && !String.IsNullOrWhiteSpace(c.GeoLocationData))
//{
// var geo = c.GeoLocationData.Split(char.Parse(","));

// if (geo.Length == 2)
// call.Add = _geoLocationProvider.GetAddressFromLatLong(double.Parse(geo[0]), double.Parse(geo[1]));
//}
//else
// call.Address = c.Address;

call.LoggedOn = c.LoggedOn.TimeConverter(department);
call.LoggedOnUtc = c.LoggedOn;
call.CallId = c.CallId;
call.Number = c.Number;
call.DepartmentId = c.DepartmentId;
call.ReportingUserId = c.ReportingUserId;
call.Priority = c.Priority;
call.IsCritical = c.IsCritical;
call.Type = c.Type;
call.IncidentNumber = c.IncidentNumber;
call.MapPage = c.MapPage;
call.CompletedNotes = c.CompletedNotes;
call.Address = c.Address;
call.GeoLocationData = c.GeoLocationData;
call.ClosedByUserId = c.ClosedByUserId;
call.ClosedOn = c.ClosedOn;
call.State = c.State;
call.IsDeleted = c.IsDeleted;
call.CallSource = c.CallSource;
call.DispatchCount = c.DispatchCount;
call.LastDispatchedOn = c.LastDispatchedOn;
call.SourceIdentifier = c.SourceIdentifier;
call.ContactName = c.ContactName;
call.ContactNumber = c.ContactNumber;
call.Public = c.Public;
call.ExternalIdentifier = c.ExternalIdentifier;
call.ReferenceNumber = c.ReferenceNumber;

if (c.Dispatches != null)
{
foreach (var dispatch in c.Dispatches)
{
var dispatchResult = new DepartmentCallDispatchResult();
dispatchResult.CallDispatchId = dispatch.CallDispatchId;
dispatchResult.CallId = dispatch.CallId;
dispatchResult.UserId = dispatch.UserId;
dispatchResult.GroupId = dispatch.GroupId;
dispatchResult.DispatchCount = dispatch.DispatchCount;
dispatchResult.LastDispatchedOn = dispatch.LastDispatchedOn;
dispatchResult.ActionLogId = dispatch.ActionLogId;

call.Dispatches.Add(dispatchResult);
}
}

if (c.GroupDispatches != null)
{
foreach (var dispatch in c.GroupDispatches)
{
var dispatchResult = new DepartmentCallDispatchGroupResult();
dispatchResult.CallDispatchGroupId = dispatch.CallDispatchGroupId;
dispatchResult.CallId = dispatch.CallId;
dispatchResult.DepartmentGroupId = dispatch.DepartmentGroupId;
dispatchResult.DispatchCount = dispatch.DispatchCount;
dispatchResult.LastDispatchedOn = dispatch.LastDispatchedOn;

call.GroupDispatches.Add(dispatchResult);
}
}

if (c.UnitDispatches != null)
{
foreach (var dispatch in c.UnitDispatches)
{
var dispatchResult = new DepartmentCallDispatchUnitResult();
dispatchResult.CallDispatchUnitId = dispatch.CallDispatchUnitId;
dispatchResult.CallId = dispatch.CallId;
dispatchResult.UnitId = dispatch.UnitId;
dispatchResult.DispatchCount = dispatch.DispatchCount;
dispatchResult.LastDispatchedOn = dispatch.LastDispatchedOn;

call.UnitDispatches.Add(dispatchResult);
}
}

if (c.RoleDispatches != null)
{
foreach (var dispatch in c.RoleDispatches)
{
var dispatchResult = new DepartmentCallDispatchRoleResult();
dispatchResult.CallDispatchRoleId = dispatch.CallDispatchRoleId;
dispatchResult.CallId = dispatch.CallId;
dispatchResult.RoleId = dispatch.RoleId;
dispatchResult.DispatchCount = dispatch.DispatchCount;
dispatchResult.LastDispatchedOn = dispatch.LastDispatchedOn;

call.RoleDispatches.Add(dispatchResult);
}
}

result.Add(call);
}

return result;
}

/// <summary>
/// Returns a specific call from the Resgrid System
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Resgrid.Web.Services.Controllers.Version3.Models.BigBoard
{
public class MapMakerInfo
{
public string Id { get; set; }
public double Longitude { get; set; }
public double Latitude { get; set; }
public string Title { get; set; }
Expand All @@ -15,4 +16,4 @@ public class MapMakerInfo
public string InfoWindowContent { get; set; }
public string Color { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace Resgrid.Web.Services.Controllers.Version3.Models.Calls
{
public class DepartmentCallDispatchGroupResult
{
public int CallDispatchGroupId { get; set; }
public int CallId { get; set; }
public int DepartmentGroupId { get; set; }
public int DispatchCount { get; set; }
public DateTime? LastDispatchedOn { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace Resgrid.Web.Services.Controllers.Version3.Models.Calls
{
public class DepartmentCallDispatchResult
{
public int CallDispatchId { get; set; }
public int CallId { get; set; }
public string UserId { get; set; }
public int? GroupId { get; set; }
public int DispatchCount { get; set; }
public DateTime? LastDispatchedOn { get; set; }
public int? ActionLogId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace Resgrid.Web.Services.Controllers.Version3.Models.Calls
{
public class DepartmentCallDispatchRoleResult
{
public int CallDispatchRoleId { get; set; }
public int CallId { get; set; }
public int RoleId { get; set; }
public int DispatchCount { get; set; }
public DateTime? LastDispatchedOn { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;

namespace Resgrid.Web.Services.Controllers.Version3.Models.Calls
{
public class DepartmentCallDispatchUnitResult
{
public int CallDispatchUnitId { get; set; }
public int CallId { get; set; }
public int UnitId { get; set; }
public int DispatchCount { get; set; }
public DateTime? LastDispatchedOn { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;

namespace Resgrid.Web.Services.Controllers.Version3.Models.Calls
{
public class DepartmentCallResult
{
public int CallId { get; set; }
public string Number { get; set; }
public int DepartmentId { get; set; }
public string ReportingUserId { get; set; }
public int Priority { get; set; }
public bool IsCritical { get; set; }
public string Type { get; set; }
public string IncidentNumber { get; set; }
public string Name { get; set; }
public string NatureOfCall { get; set; }
public string MapPage { get; set; }
public string Notes { get; set; }
public string CompletedNotes { get; set; }
public string Address { get; set; }
public string GeoLocationData { get; set; }
public DateTime LoggedOn { get; set; }
public DateTime LoggedOnUtc { get; set; }
public string ClosedByUserId { get; set; }
public DateTime? ClosedOn { get; set; }
public int State { get; set; }
public bool IsDeleted { get; set; }
public int CallSource { get; set; }
public int DispatchCount { get; set; }
public DateTime? LastDispatchedOn { get; set; }
public string SourceIdentifier { get; set; }
public ICollection<DepartmentCallDispatchResult> Dispatches { get; set; }
//public ICollection<CallAttachment> Attachments { get; set; }
//public ICollection<CallNote> CallNotes { get; set; }
public string W3W { get; set; }
public ICollection<DepartmentCallDispatchGroupResult> GroupDispatches { get; set; }
public ICollection<DepartmentCallDispatchUnitResult> UnitDispatches { get; set; }
public ICollection<DepartmentCallDispatchRoleResult> RoleDispatches { get; set; }
public string ContactName { get; set; }
public string ContactNumber { get; set; }
public bool Public { get; set; }
public string ExternalIdentifier { get; set; }
public string ReferenceNumber { get; set; }
public List<string> GroupCodesToDispatch { get; set; }
public bool AllCall { get; set; }

public DepartmentCallResult()
{
Dispatches = new List<DepartmentCallDispatchResult>();
GroupDispatches = new List<DepartmentCallDispatchGroupResult>();
UnitDispatches = new List<DepartmentCallDispatchUnitResult>();
RoleDispatches = new List<DepartmentCallDispatchRoleResult>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ public class UnitAppPayloadResult
public List<UnitRoleResult> UnitRoles { get; set; }
public List<CallPriorityResult> Priorities { get; set; }
public List<JoinedDepartmentResult> Departments { get; set; }
public List<CallTypeResult> CallTypes { get; set; }
}
}
Loading

0 comments on commit d22e1fb

Please sign in to comment.