Skip to content
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

Make more fields required #1309

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/DefaultLocalizationPose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class DefaultLocalizationPose
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

[Required]
public Pose Pose { get; set; }

public DefaultLocalizationPose()
Expand Down
5 changes: 3 additions & 2 deletions backend/api/Database/Models/Inspection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null)
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public string Id { get; set; }

[Required]
[MaxLength(200)]
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local
public string? IsarStepId { get; private set; } = Guid.NewGuid().ToString();
public string IsarStepId { get; private set; } = Guid.NewGuid().ToString();

public Position InspectionTarget { get; set; }
public Position? InspectionTarget { get; set; }

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

[Required]
public DateTime InspectionDate { get; set; }

[Required]
public string IsarStepId { get; set; }

[Required]
public string Finding { get; set; }

public InspectionFinding(InspectionFindingQuery createInspectionFindingQuery)
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
9 changes: 8 additions & 1 deletion backend/api/Database/Models/Pose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace Api.Database.Models
[Owned]
public class Orientation
{

public Orientation()
{
X = 0;
Expand All @@ -32,9 +31,14 @@ public Orientation(float x = 0, float y = 0, float z = 0, float w = 1)
Z = z;
W = w;
}

[Required]
public float X { get; set; }
[Required]
public float Y { get; set; }
[Required]
public float Z { get; set; }
[Required]
public float W { get; set; }

public override bool Equals(object obj)
Expand Down Expand Up @@ -80,8 +84,11 @@ public Position(float x = 0, float y = 0, float z = 0)
Z = z;
}

[Required]
public float X { get; set; }
[Required]
public float Y { get; set; }
[Required]
public float Z { get; set; }

public override bool Equals(object obj)
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
3 changes: 1 addition & 2 deletions backend/api/Database/Models/SortableRecord.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma warning disable CS8618
namespace Api.Database.Models
namespace Api.Database.Models
{
public interface SortableRecord
{
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
Loading