-
-
Notifications
You must be signed in to change notification settings - Fork 82
RIC-T39 More Backend IC work #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Core/Resgrid.Model/IncidentCommand/IncidentCommandBundle.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Resgrid.Model | ||
| { | ||
| /// <summary> | ||
| /// Shift-start aggregate for offline IC clients: a render-ready snapshot of every ACTIVE incident command in the | ||
| /// caller's department in a single round-trip. Each <see cref="IncidentCommandBoard"/> carries the COMPUTED | ||
| /// accountability / PAR status that the row-based <see cref="IncidentCommandChanges"/> delta cannot, plus the | ||
| /// active ad-hoc resources. The client stores <see cref="ServerTimestampMs"/> and uses it as the <c>since</c> | ||
| /// cursor for subsequent incremental <c>/Sync/Changes</c> pulls. See | ||
| /// docs/architecture/offline-first-architecture.md (§6 / §9.5). | ||
| /// </summary> | ||
| public class IncidentCommandBundle | ||
| { | ||
| /// <summary>Server clock (Unix epoch ms) captured at the start of the read; seeds the next /Sync/Changes cursor.</summary> | ||
| public long ServerTimestampMs { get; set; } | ||
|
|
||
| /// <summary>One render-ready board (incl. accountability / PAR) per active incident command in the department.</summary> | ||
| public List<IncidentCommandBoard> Boards { get; set; } = new List<IncidentCommandBoard>(); | ||
|
|
||
| /// <summary>Active ad-hoc units across the department's active incidents (aggregated by the caller).</summary> | ||
| public List<IncidentAdHocUnit> AdHocUnits { get; set; } = new List<IncidentAdHocUnit>(); | ||
|
|
||
| /// <summary>Active ad-hoc personnel across the department's active incidents (aggregated by the caller).</summary> | ||
| public List<IncidentAdHocPersonnel> AdHocPersonnel { get; set; } = new List<IncidentAdHocPersonnel>(); | ||
| } | ||
| } |
103 changes: 103 additions & 0 deletions
103
Core/Resgrid.Model/IncidentCommand/SyncReferenceData.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using ProtoBuf; | ||
|
|
||
| namespace Resgrid.Model | ||
| { | ||
| /// <summary> | ||
| /// Offline shift-start REFERENCE data: the slowly-changing department configuration + roster an IC app needs to | ||
| /// START and RUN an incident in the field (call types, command templates, units, personnel, groups, POIs, | ||
| /// protocols, accountability config, statuses, feature flags). Pulled once at shift start / on manual refresh; | ||
| /// the LIVE per-incident state comes from /Sync/Bundle (active boards) and /Sync/Changes (deltas). See | ||
| /// docs/architecture/offline-first-architecture.md. Personnel is a SAFE PROJECTION (<see cref="ReferencePersonnel"/>) | ||
| /// — never the raw IdentityUser/UserProfile (which carry credentials + verification codes). | ||
| /// </summary> | ||
| public class SyncReferenceData | ||
| { | ||
| /// <summary>Server clock (Unix epoch ms) captured at the start of the read.</summary> | ||
| public long ServerTimestampMs { get; set; } | ||
|
|
||
| public List<CallType> CallTypes { get; set; } = new List<CallType>(); | ||
|
|
||
| public List<DepartmentCallPriority> CallPriorities { get; set; } = new List<DepartmentCallPriority>(); | ||
|
|
||
| /// <summary>Command-definition templates (predefined swimlanes per call type) used to seed a new command.</summary> | ||
| public List<CommandDefinition> CommandTemplates { get; set; } = new List<CommandDefinition>(); | ||
|
|
||
| public List<Unit> Units { get; set; } = new List<Unit>(); | ||
|
|
||
| public List<UnitType> UnitTypes { get; set; } = new List<UnitType>(); | ||
|
|
||
| public List<ReferenceGroup> Groups { get; set; } = new List<ReferenceGroup>(); | ||
|
|
||
| public List<Poi> Pois { get; set; } = new List<Poi>(); | ||
|
|
||
| public List<PoiType> PoiTypes { get; set; } = new List<PoiType>(); | ||
|
|
||
| public List<DispatchProtocol> Protocols { get; set; } = new List<DispatchProtocol>(); | ||
|
|
||
| public List<CheckInTimerConfig> CheckInTimerConfigs { get; set; } = new List<CheckInTimerConfig>(); | ||
|
|
||
| /// <summary>Department-defined personnel custom statuses.</summary> | ||
| public List<CustomState> PersonnelStates { get; set; } = new List<CustomState>(); | ||
|
|
||
| /// <summary>Department-defined unit custom statuses.</summary> | ||
| public List<CustomState> UnitStates { get; set; } = new List<CustomState>(); | ||
|
|
||
| /// <summary>Safe personnel roster projection (no credentials / contact-verification secrets).</summary> | ||
| public List<ReferencePersonnel> Personnel { get; set; } = new List<ReferencePersonnel>(); | ||
|
|
||
| /// <summary>Resolved feature flags for the department (drives addon/feature gating offline).</summary> | ||
| public List<FeatureFlagEvaluation> Features { get; set; } = new List<FeatureFlagEvaluation>(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Safe, minimal personnel projection for offline rosters — mirrors the field exposure of the existing v4 | ||
| /// PersonnelInfoResultData. Deliberately EXCLUDES the IdentityUser nav, password/security fields, and the | ||
| /// UserProfile contact-verification codes + CalendarSyncToken. | ||
| /// </summary> | ||
| public class ReferencePersonnel | ||
| { | ||
| public string UserId { get; set; } | ||
|
|
||
| public string FirstName { get; set; } | ||
|
|
||
| public string LastName { get; set; } | ||
|
|
||
| public string MobilePhone { get; set; } | ||
|
|
||
| /// <summary>Primary group/station membership, if any.</summary> | ||
| public int? GroupId { get; set; } | ||
|
|
||
| public string GroupName { get; set; } | ||
|
|
||
| /// <summary>Current personnel state (UserState.State); 0 when unknown.</summary> | ||
| public int StateId { get; set; } | ||
|
|
||
| public DateTime? StateTimestamp { get; set; } | ||
| } | ||
|
|
||
| /// <summary>Safe, minimal department group/station projection — excludes the member IdentityUser navs.</summary> | ||
| public class ReferenceGroup | ||
| { | ||
| public int GroupId { get; set; } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public int? Type { get; set; } | ||
|
|
||
| public int? ParentGroupId { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Protobuf-safe cache envelope for the reference bootstrap. The cache provider serializes via protobuf-net, but | ||
| /// most of <see cref="SyncReferenceData"/>'s contained entities are not <c>[ProtoContract]</c>; rather than | ||
| /// ProtoContract-tag ~8 shared entities, the reference payload is cached as a JSON snapshot inside this contract. | ||
| /// </summary> | ||
| [ProtoContract] | ||
| public class ReferenceCacheEnvelope | ||
| { | ||
| [ProtoMember(1)] | ||
| public string Json { get; set; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Resgrid.Model.Services | ||
| { | ||
| /// <summary> | ||
| /// Aggregates the offline shift-start REFERENCE data set (department configuration + a safe personnel roster) into | ||
| /// a single payload, so an IC/Unit app can pull everything it needs to start and run an incident in one round-trip. | ||
| /// The live per-incident state is delivered separately by IIncidentCommandService (board bundle + change deltas). | ||
| /// </summary> | ||
| public interface ISyncService | ||
| { | ||
| Task<SyncReferenceData> GetReferenceDataAsync(int departmentId, bool bypassCache = false); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Keep a durable handoff for
IncidentCommandUpdatedAsync.This now returns before the update is persisted anywhere.
SendMessage(...)only dispatches in-process, and the new downstream publisher path is fire-and-forget, so a Rabbit publish failure or process recycle can drop the only sync trigger for connected IC clients.Either keep the previous CQRS enqueue here or move this event rail to an awaitable/persisted publish path before returning.
Also applies to: 28-39
🤖 Prompt for AI Agents