Skip to content

Commit

Permalink
Make area deck and robot installation required
Browse files Browse the repository at this point in the history
  • Loading branch information
andchiind committed Jan 12, 2024
1 parent 0503012 commit a02d529
Show file tree
Hide file tree
Showing 15 changed files with 2,855 additions and 22 deletions.
2 changes: 1 addition & 1 deletion backend/api/Controllers/Models/RobotResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class RobotResponse

public string SerialNumber { get; set; }

public Installation? CurrentInstallation { get; }
public Installation CurrentInstallation { get; }

public AreaResponse? CurrentArea { get; set; }

Expand Down
6 changes: 4 additions & 2 deletions backend/api/Database/Models/Area.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ public class Area
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

public virtual Deck? Deck { get; set; }
[Required]
public virtual Deck Deck { get; set; }

[Required]
public virtual Plant Plant { get; set; }

[Required]
public virtual Installation Installation { get; set; }

[Required]
Expand All @@ -23,7 +26,6 @@ public class Area
[Required]
public MapMetadata MapMetadata { get; set; }


public DefaultLocalizationPose? DefaultLocalizationPose { get; set; }

public IList<SafePosition> SafePositions { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions backend/api/Database/Models/Deck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ public class Deck
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

[Required]
public virtual Plant Plant { get; set; }

[Required]
public virtual Installation Installation { get; set; }

public DefaultLocalizationPose? DefaultLocalizationPose { get; set; }
Expand Down
1 change: 1 addition & 0 deletions backend/api/Database/Models/MissionRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class MissionRun : SortableRecord
private MissionStatus _status;

private IList<MissionTask> _tasks;

[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }
Expand Down
1 change: 1 addition & 0 deletions backend/api/Database/Models/MissionTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public MissionTask(MissionTask copy, TaskStatus? status = null)
[Required]
public int TaskOrder { get; set; }

[Required]
public MissionTaskType Type { get; set; }

[MaxLength(200)]
Expand Down
1 change: 1 addition & 0 deletions backend/api/Database/Models/Plant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Plant
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

[Required]
public virtual Installation Installation { get; set; }

[Required]
Expand Down
4 changes: 2 additions & 2 deletions backend/api/Database/Models/Robot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Api.Database.Models
{
public class Robot
{

public Robot()
{
VideoStreams = new List<VideoStream>();
Expand Down Expand Up @@ -65,7 +64,8 @@ public Robot(CreateRobotQuery createQuery, Installation installation, Area? area
[MaxLength(200)]
public string SerialNumber { get; set; }

public Installation? CurrentInstallation { get; set; }
[Required]
public Installation CurrentInstallation { get; set; }

public Area? CurrentArea { get; set; }

Expand Down
10 changes: 4 additions & 6 deletions backend/api/EventHandlers/MissionEventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,10 @@ private async void OnRobotAvailable(object? sender, RobotAvailableEventArgs e)

private void ReportFailureToSignalR(Robot robot, string message)
{
var installation = robot.CurrentInstallation;
if (installation != null)
_ = SignalRService.SendMessageAsync(
"Alert",
installation,
new AlertResponse("safezoneFailure", "Safezone failure", message, installation.InstallationCode, robot.Id));
_ = SignalRService.SendMessageAsync(
"Alert",
robot.CurrentInstallation,
new AlertResponse("safezoneFailure", "Safezone failure", message, robot.CurrentInstallation.InstallationCode, robot.Id));
}

private async void OnEmergencyButtonPressedForRobot(object? sender, EmergencyButtonPressedForRobotEventArgs e)
Expand Down
Loading

0 comments on commit a02d529

Please sign in to comment.