Skip to content

Commit 8d2e6c2

Browse files
authored
Merge pull request #435 from Resgrid/develop
RIC-T39 More IC work
2 parents 60db890 + 4a236ca commit 8d2e6c2

37 files changed

Lines changed: 3179 additions & 55 deletions

Core/Resgrid.Model/Events/IncidentCommandEvents.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ public class IncidentClosedEvent
3737
public string IncidentCommandId { get; set; }
3838
}
3939

40+
/// <summary>A previously closed incident command was reopened.</summary>
41+
public class IncidentReopenedEvent
42+
{
43+
public int DepartmentId { get; set; }
44+
public int CallId { get; set; }
45+
public string IncidentCommandId { get; set; }
46+
public string Reason { get; set; }
47+
public string ReopenedByUserId { get; set; }
48+
}
49+
4050
/// <summary>Raised when a resource is assigned to a command structure node.</summary>
4151
public class IncidentResourceAssignedEvent
4252
{

Core/Resgrid.Model/IncidentCommand/CommandStructureNode.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public class CommandStructureNode : IEntity, IChangeTracked
6969
/// <summary>Optional incident need this lane is fulfilling (FK to IncidentNeeds).</summary>
7070
public string LinkedNeedId { get; set; }
7171

72+
/// <summary>Optional named incident map attached to this lane (FK to IncidentMaps) — e.g. the area it is working.</summary>
73+
public string LinkedMapId { get; set; }
74+
7275
/// <summary>Primary lane lead when they are a Resgrid user; null for external leads.</summary>
7376
public string PrimaryLeadUserId { get; set; }
7477

Core/Resgrid.Model/IncidentCommand/IncidentCommand.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,39 @@ public class IncidentCommand : IEntity, IChangeTracked
2626

2727
public string CurrentCommanderUserId { get; set; }
2828

29+
/// <summary>Optional commander-supplied display name for the incident (falls back to the call name in UIs).</summary>
30+
public string Name { get; set; }
31+
32+
/// <summary>Free-form description of where the ICP/HQ (command post) is ("Front lobby of 123 Main St").</summary>
33+
public string CommandPostLocationText { get; set; }
34+
2935
public string CommandPostLatitude { get; set; }
3036

3137
public string CommandPostLongitude { get; set; }
3238

39+
/// <summary>Free-form description of where Staging is located.</summary>
40+
public string StagingLocationText { get; set; }
41+
42+
public string StagingLatitude { get; set; }
43+
44+
public string StagingLongitude { get; set; }
45+
46+
/// <summary>Free-form description of where Rehab is located.</summary>
47+
public string RehabLocationText { get; set; }
48+
49+
public string RehabLatitude { get; set; }
50+
51+
public string RehabLongitude { get; set; }
52+
53+
/// <summary>Saved incident-map view: center latitude (set once the IC pins the map's framing).</summary>
54+
public string MapCenterLatitude { get; set; }
55+
56+
/// <summary>Saved incident-map view: center longitude.</summary>
57+
public string MapCenterLongitude { get; set; }
58+
59+
/// <summary>Saved incident-map view: zoom level (0-22); null until the incident map is created.</summary>
60+
public string MapZoomLevel { get; set; }
61+
3362
public string IncidentActionPlan { get; set; }
3463

3564
/// <summary>NIMS/ICS escalation level for the incident (department defined).</summary>

Core/Resgrid.Model/IncidentCommand/IncidentCommandBoard.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class IncidentCommandBoard
2222

2323
public List<IncidentMapAnnotation> Annotations { get; set; } = new List<IncidentMapAnnotation>();
2424

25+
/// <summary>Named tactical maps for the incident (the main map lives on the Command itself).</summary>
26+
public List<IncidentMap> Maps { get; set; } = new List<IncidentMap>();
27+
2528
/// <summary>Personnel accountability / PAR status (from the Checkin feature) for the incident.</summary>
2629
public List<PersonnelCallCheckInStatus> Accountability { get; set; } = new List<PersonnelCallCheckInStatus>();
2730

Core/Resgrid.Model/IncidentCommand/IncidentCommandChanges.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public class IncidentCommandChanges
2929

3030
public List<IncidentMapAnnotation> Annotations { get; set; } = new List<IncidentMapAnnotation>();
3131

32+
public List<IncidentMap> Maps { get; set; } = new List<IncidentMap>();
33+
3234
public List<IncidentRoleAssignment> Roles { get; set; } = new List<IncidentRoleAssignment>();
3335

3436
public List<IncidentAdHocUnit> AdHocUnits { get; set; } = new List<IncidentAdHocUnit>();

Core/Resgrid.Model/IncidentCommand/IncidentCommandEnums.cs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ public enum TacticalObjectiveStatus
4747
InProgress = 2
4848
}
4949

50+
/// <summary>How a completed tactical objective turned out (recorded at close-out).</summary>
51+
public enum TacticalObjectiveOutcome
52+
{
53+
NotSet = 0,
54+
Successful = 1,
55+
Partial = 2,
56+
Unsuccessful = 3
57+
}
58+
5059
/// <summary>Category of an incident need (resource/logistics request tracked at the command level).</summary>
5160
public enum IncidentNeedCategory
5261
{
@@ -55,7 +64,22 @@ public enum IncidentNeedCategory
5564
Medical = 2,
5665
Equipment = 3,
5766
Staffing = 4,
58-
Other = 5
67+
Other = 5,
68+
69+
/// <summary>
70+
/// A request for SPECIFIC Resgrid entities (units/users/roles/groups) that get added to the call
71+
/// and dispatched individually as "requested by command". See <see cref="IncidentNeedEntity"/>.
72+
/// </summary>
73+
Entity = 6
74+
}
75+
76+
/// <summary>What kind of Resgrid entity an <see cref="IncidentNeedEntity"/> requests.</summary>
77+
public enum NeedEntityKind
78+
{
79+
Unit = 0,
80+
User = 1,
81+
Role = 2,
82+
Group = 3
5983
}
6084

6185
/// <summary>Fulfillment state of an incident need.</summary>
@@ -148,6 +172,12 @@ public enum CommandLogEntryType
148172
NeedMet = 33,
149173
ObjectiveProgressUpdated = 34,
150174
LaneLeadChanged = 35,
151-
CommandDetailsUpdated = 36
175+
CommandDetailsUpdated = 36,
176+
177+
/// <summary>A previously closed command was reopened (the reopen reason is embedded in the description).</summary>
178+
CommandReopened = 37,
179+
180+
/// <summary>The incident map's saved view (center/zoom) was created or changed.</summary>
181+
MapViewUpdated = 38
152182
}
153183
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using System;
2+
3+
namespace Resgrid.Model
4+
{
5+
/// <summary>
6+
/// List-card projection of an incident command for the IC app's incident list: identity, lifecycle timing,
7+
/// resolved commander name, locations, and active resource counts. Not persisted (composed by the service).
8+
/// </summary>
9+
public class IncidentCommandSummary
10+
{
11+
public string IncidentCommandId { get; set; }
12+
13+
public int DepartmentId { get; set; }
14+
15+
public int CallId { get; set; }
16+
17+
/// <summary>Commander-supplied incident name; null when unnamed (UIs fall back to the call name).</summary>
18+
public string Name { get; set; }
19+
20+
public string CallName { get; set; }
21+
22+
public string CallNumber { get; set; }
23+
24+
public string CallAddress { get; set; }
25+
26+
/// <summary>Maps to <see cref="IncidentCommandStatus"/>.</summary>
27+
public int Status { get; set; }
28+
29+
public DateTime EstablishedOn { get; set; }
30+
31+
public DateTime? ClosedOn { get; set; }
32+
33+
public string CommanderUserId { get; set; }
34+
35+
/// <summary>Resolved commander full name (falls back to the user id when the profile is unavailable).</summary>
36+
public string CommanderName { get; set; }
37+
38+
public string CommandPostLocationText { get; set; }
39+
40+
public string CommandPostLatitude { get; set; }
41+
42+
public string CommandPostLongitude { get; set; }
43+
44+
/// <summary>Active (unreleased) personnel assignments placed in a lane or staging.</summary>
45+
public int AssignedPersonnelCount { get; set; }
46+
47+
/// <summary>Active (unreleased) unit assignments placed in a lane or staging.</summary>
48+
public int AssignedUnitCount { get; set; }
49+
}
50+
51+
/// <summary>
52+
/// Field bag for <c>IIncidentCommandService.UpdateCommandInfoAsync</c>. Null members are left unchanged;
53+
/// an empty string clears the stored value. Any location whose text is set while its coordinates are
54+
/// blank is geocoded server-side on save.
55+
/// </summary>
56+
public class IncidentCommandInfoUpdate
57+
{
58+
public string Name { get; set; }
59+
60+
/// <summary>Corrected incident start time (UTC); null leaves the original EstablishedOn.</summary>
61+
public DateTime? EstablishedOn { get; set; }
62+
63+
public DateTime? EstimatedEndOn { get; set; }
64+
65+
/// <summary>When true, a null <see cref="EstimatedEndOn"/> clears the stored value instead of leaving it.</summary>
66+
public bool ClearEstimatedEndOn { get; set; }
67+
68+
public string ImportantInformation { get; set; }
69+
70+
public int? IcsLevel { get; set; }
71+
72+
public string CommandPostLocationText { get; set; }
73+
74+
public string CommandPostLatitude { get; set; }
75+
76+
public string CommandPostLongitude { get; set; }
77+
78+
public string StagingLocationText { get; set; }
79+
80+
public string StagingLatitude { get; set; }
81+
82+
public string StagingLongitude { get; set; }
83+
84+
public string RehabLocationText { get; set; }
85+
86+
public string RehabLatitude { get; set; }
87+
88+
public string RehabLongitude { get; set; }
89+
}
90+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel.DataAnnotations.Schema;
4+
using Newtonsoft.Json;
5+
6+
namespace Resgrid.Model
7+
{
8+
/// <summary>
9+
/// A named tactical map for an incident — its own saved framing (center + zoom) and markup
10+
/// (annotations reference it via <see cref="IncidentMapAnnotation.IncidentMapId"/>), with an optional
11+
/// expiry. Lanes can attach one via <see cref="CommandStructureNode.LinkedMapId"/>. The incident's
12+
/// MAIN map lives on <see cref="IncidentCommand"/> itself (MapCenter*/MapZoomLevel, null map id).
13+
/// </summary>
14+
public class IncidentMap : IEntity, IChangeTracked
15+
{
16+
public string IncidentMapId { get; set; }
17+
18+
public string IncidentCommandId { get; set; }
19+
20+
public int DepartmentId { get; set; }
21+
22+
public int CallId { get; set; }
23+
24+
public string Name { get; set; }
25+
26+
public string Description { get; set; }
27+
28+
public string CenterLatitude { get; set; }
29+
30+
public string CenterLongitude { get; set; }
31+
32+
/// <summary>Zoom level (0-22); null until the framing has been pinned.</summary>
33+
public string ZoomLevel { get; set; }
34+
35+
/// <summary>Optional expiry after which the map is stale (kept, but flagged in UIs).</summary>
36+
public DateTime? ExpiresOn { get; set; }
37+
38+
public string CreatedByUserId { get; set; }
39+
40+
public DateTime CreatedOn { get; set; }
41+
42+
public string UpdatedByUserId { get; set; }
43+
44+
public DateTime? UpdatedOn { get; set; }
45+
46+
/// <summary>Soft-delete tombstone so removals propagate to offline clients.</summary>
47+
public DateTime? DeletedOn { get; set; }
48+
49+
/// <summary>Change cursor for offline delta sync + last-write-wins; stamped on every write.</summary>
50+
public DateTime? ModifiedOn { get; set; }
51+
52+
[NotMapped]
53+
public string TableName => "IncidentMaps";
54+
55+
[NotMapped]
56+
public string IdName => "IncidentMapId";
57+
58+
[NotMapped]
59+
public int IdType => 1;
60+
61+
[NotMapped]
62+
[JsonIgnore]
63+
public object IdValue
64+
{
65+
get { return IncidentMapId; }
66+
set { IncidentMapId = (string)value; }
67+
}
68+
69+
[NotMapped]
70+
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
71+
}
72+
}

Core/Resgrid.Model/IncidentCommand/IncidentNeed.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,62 @@ public object IdValue
7474
[NotMapped]
7575
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName" };
7676
}
77+
78+
/// <summary>
79+
/// Append-only audit row for one fulfillment change on an <see cref="IncidentNeed"/>: status and/or
80+
/// fill-quantity transition, the caller's note ("Engine 1 from mutual aid"), who made it, and when.
81+
/// </summary>
82+
public class IncidentNeedUpdate : IEntity
83+
{
84+
public string IncidentNeedUpdateId { get; set; }
85+
86+
public string IncidentNeedId { get; set; }
87+
88+
public string IncidentCommandId { get; set; }
89+
90+
public int DepartmentId { get; set; }
91+
92+
public int CallId { get; set; }
93+
94+
/// <summary>Maps to <see cref="IncidentNeedStatus"/>.</summary>
95+
public int PreviousStatus { get; set; }
96+
97+
/// <summary>Maps to <see cref="IncidentNeedStatus"/>.</summary>
98+
public int NewStatus { get; set; }
99+
100+
public int PreviousQuantityFulfilled { get; set; }
101+
102+
public int NewQuantityFulfilled { get; set; }
103+
104+
/// <summary>Caller-supplied context for the change (which resource filled it, why it was called off, ...).</summary>
105+
public string Note { get; set; }
106+
107+
public string CreatedByUserId { get; set; }
108+
109+
/// <summary>Resolved display name for CreatedByUserId; filled at read time, never persisted.</summary>
110+
[NotMapped]
111+
public string CreatedByUserName { get; set; }
112+
113+
public DateTime CreatedOn { get; set; }
114+
115+
[NotMapped]
116+
public string TableName => "IncidentNeedUpdates";
117+
118+
[NotMapped]
119+
public string IdName => "IncidentNeedUpdateId";
120+
121+
[NotMapped]
122+
public int IdType => 1;
123+
124+
[NotMapped]
125+
[JsonIgnore]
126+
public object IdValue
127+
{
128+
get { return IncidentNeedUpdateId; }
129+
set { IncidentNeedUpdateId = (string)value; }
130+
}
131+
132+
[NotMapped]
133+
public IEnumerable<string> IgnoredProperties => new string[] { "IdValue", "IdType", "TableName", "IdName", "CreatedByUserName" };
134+
}
77135
}

0 commit comments

Comments
 (0)