From 4ed2ca6e54cb895e856602c48c5626e7c6d2ea63 Mon Sep 17 00:00:00 2001 From: "Mariana R. Santos" Date: Thu, 3 Oct 2024 15:45:45 +0200 Subject: [PATCH 1/6] Remove isar steps --- .../InspectionFindingController.cs | 18 ++--- .../MissionSchedulingController.cs | 5 +- .../Controllers/Models/CustomMissionQuery.cs | 2 +- backend/api/Database/Context/InitDb.cs | 18 +++-- backend/api/Database/Models/Inspection.cs | 36 +++++----- .../api/Database/Models/InspectionFinding.cs | 4 +- backend/api/Database/Models/MissionRun.cs | 4 +- backend/api/Database/Models/MissionTask.cs | 37 ++++------ .../InspectionFindingEventHandler.cs | 4 +- backend/api/EventHandlers/MqttEventHandler.cs | 33 +-------- backend/api/MQTT/MessageModels/IsarTask.cs | 3 + .../ActionServices/TaskDurationService.cs | 4 +- backend/api/Services/EchoService.cs | 25 +++++-- .../api/Services/InspectionFindingService.cs | 12 ++-- backend/api/Services/InspectionService.cs | 26 +++---- backend/api/Services/IsarService.cs | 10 +-- backend/api/Services/MapService.cs | 9 +-- .../api/Services/MissionDefinitionService.cs | 2 +- backend/api/Services/MissionRunService.cs | 16 ++--- .../api/Services/MissionSchedulingService.cs | 1 - backend/api/Services/MissionTaskService.cs | 4 +- .../Models/IsarControlMissionResponse.cs | 6 -- .../Services/Models/IsarMissionDefinition.cs | 16 ++--- .../Models/IsarStartMissionResponse.cs | 13 ++-- backend/api/Services/Models/IsarStep.cs | 70 ------------------- backend/api/Services/Models/IsarTask.cs | 35 +++++++++- backend/api/appsettings.Development.json | 1 - backend/api/appsettings.Local.json | 1 - backend/api/appsettings.Production.json | 1 - backend/api/appsettings.Staging.json | 1 - backend/api/appsettings.Test.json | 1 - .../MissionPage/TaskOverview/TaskTable.tsx | 25 ++++--- frontend/src/models/Task.ts | 2 +- frontend/src/utils/MapMarkers.tsx | 11 +-- 34 files changed, 179 insertions(+), 277 deletions(-) delete mode 100644 backend/api/Services/Models/IsarStep.cs diff --git a/backend/api/Controllers/InspectionFindingController.cs b/backend/api/Controllers/InspectionFindingController.cs index ce4512b9c..9efa33a1c 100644 --- a/backend/api/Controllers/InspectionFindingController.cs +++ b/backend/api/Controllers/InspectionFindingController.cs @@ -14,25 +14,25 @@ IInspectionService inspectionService ) : ControllerBase { /// - /// Associate a new inspection finding with the inspection corresponding to isarStepId + /// Associate a new inspection finding with the inspection corresponding to isarTaskId /// /// /// [HttpPost] [Authorize(Roles = Role.Admin)] - [Route("{isarStepId}")] + [Route("{isarTaskId}")] [ProducesResponseType(typeof(InspectionFinding), StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status400BadRequest)] [ProducesResponseType(StatusCodes.Status409Conflict)] [ProducesResponseType(StatusCodes.Status401Unauthorized)] [ProducesResponseType(StatusCodes.Status403Forbidden)] [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task> AddFinding([FromBody] InspectionFindingQuery inspectionFinding, [FromRoute] string isarStepId) + public async Task> AddFinding([FromBody] InspectionFindingQuery inspectionFinding, [FromRoute] string isarTaskId) { - logger.LogInformation("Add inspection finding for inspection with isarStepId '{Id}'", isarStepId); + logger.LogInformation("Add inspection finding for inspection with isarTaskId '{Id}'", isarTaskId); try { - var inspection = await inspectionService.AddFinding(inspectionFinding, isarStepId); + var inspection = await inspectionService.AddFinding(inspectionFinding, isarTaskId); if (inspection != null) { @@ -42,14 +42,14 @@ public async Task> AddFinding([FromBody] Inspect } catch (Exception e) { - logger.LogError(e, "Error while adding inspection finding to inspection with IsarStepId '{Id}'", isarStepId); + logger.LogError(e, "Error while adding inspection finding to inspection with IsarTaskId '{Id}'", isarTaskId); return StatusCode(StatusCodes.Status500InternalServerError); } - return NotFound($"Could not find any inspection with the provided '{isarStepId}'"); + return NotFound($"Could not find any inspection with the provided '{isarTaskId}'"); } /// - /// Get the full inspection against an isarStepId + /// Get the full inspection against an isarTaskId /// /// /// @@ -67,7 +67,7 @@ public async Task> GetInspections([FromRoute] string id logger.LogInformation("Get inspection by ID '{id}'", id); try { - var inspection = await inspectionService.ReadByIsarStepId(id, readOnly: true); + var inspection = await inspectionService.ReadByIsarInspectionId(id, readOnly: true); if (inspection != null) { return Ok(inspection); diff --git a/backend/api/Controllers/MissionSchedulingController.cs b/backend/api/Controllers/MissionSchedulingController.cs index 988e14314..26d1884d7 100644 --- a/backend/api/Controllers/MissionSchedulingController.cs +++ b/backend/api/Controllers/MissionSchedulingController.cs @@ -62,10 +62,7 @@ [FromBody] ScheduleMissionQuery scheduledMissionQuery foreach (var task in missionTasks) { task.Id = Guid.NewGuid().ToString(); - foreach (var inspection in task.Inspections) - { - inspection.Id = Guid.NewGuid().ToString(); - } + task.Inspection.Id = Guid.NewGuid().ToString(); } var newMissionRun = new MissionRun diff --git a/backend/api/Controllers/Models/CustomMissionQuery.cs b/backend/api/Controllers/Models/CustomMissionQuery.cs index 9f826ce15..553df37f8 100644 --- a/backend/api/Controllers/Models/CustomMissionQuery.cs +++ b/backend/api/Controllers/Models/CustomMissionQuery.cs @@ -22,7 +22,7 @@ public struct CustomTaskQuery public Pose RobotPose { get; set; } - public List Inspections { get; set; } + public CustomInspectionQuery Inspection { get; set; } } public struct CustomMissionQuery diff --git a/backend/api/Database/Context/InitDb.cs b/backend/api/Database/Context/InitDb.cs index 98d3c0f64..4e1ee816c 100644 --- a/backend/api/Database/Context/InitDb.cs +++ b/backend/api/Database/Context/InitDb.cs @@ -416,12 +416,11 @@ private static List GetMissionDefinitions() private static List GetMissionTasks() { - var inspections = new List { new() }; var url = new Uri( "https://stid.equinor.com/hua/tag?tagNo=ABCD" ); var task1 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -431,7 +430,7 @@ private static List GetMissionTasks() ); var task2 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -441,7 +440,7 @@ private static List GetMissionTasks() ); var task3 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -451,7 +450,7 @@ private static List GetMissionTasks() ); var task4 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -461,7 +460,7 @@ private static List GetMissionTasks() ); var task5 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -471,7 +470,7 @@ private static List GetMissionTasks() ); var task6 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -481,7 +480,7 @@ private static List GetMissionTasks() ); var task7 = new MissionTask( - inspections: inspections, + inspection: new Inspection(), robotPose: new Pose(300.0f, 50.0f, 200.0f, 0.0f, 0.0f, 0.0f, 1.0f), taskOrder: 0, tagLink: url, @@ -668,8 +667,7 @@ public static void PopulateDb(FlotillaDbContext context) var tasks = GetMissionTasks(); foreach (var task in tasks) { - task.Inspections.Add(inspections[0]); - task.Inspections.Add(inspections[1]); + task.Inspection = inspections[0]; } context.AddRange(tasks); context.AddRange(missionDefinitions); diff --git a/backend/api/Database/Models/Inspection.cs b/backend/api/Database/Models/Inspection.cs index 650a578ec..43e359db3 100644 --- a/backend/api/Database/Models/Inspection.cs +++ b/backend/api/Database/Models/Inspection.cs @@ -44,7 +44,7 @@ public Inspection(CustomInspectionQuery inspectionQuery) public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bool useEmptyIDs = false) { Id = useEmptyIDs ? "" : Guid.NewGuid().ToString(); - IsarStepId = useEmptyIDs ? "" : Guid.NewGuid().ToString(); + IsarInspectionId = useEmptyIDs ? "" : Guid.NewGuid().ToString(); Status = inspectionStatus ?? copy.Status; InspectionType = copy.InspectionType; VideoDuration = copy.VideoDuration; @@ -60,7 +60,7 @@ public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bo [Required] [MaxLength(200)] // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local - public string IsarStepId { get; private set; } = Guid.NewGuid().ToString(); + public string IsarInspectionId { get; set; } = Guid.NewGuid().ToString(); [Required] public Position InspectionTarget { get; set; } @@ -106,35 +106,35 @@ or InspectionStatus.Successful public List InspectionFindings { get; set; } - public void UpdateWithIsarInfo(IsarStep isarStep) + public void UpdateWithIsarInfo(IsarTask isarTask) { - UpdateStatus(isarStep.StepStatus); - InspectionType = isarStep.StepType switch + UpdateStatus(isarTask.TaskStatus); + InspectionType = isarTask.TaskType switch { - IsarStepType.RecordAudio => InspectionType.Audio, - IsarStepType.TakeImage => InspectionType.Image, - IsarStepType.TakeThermalImage => InspectionType.ThermalImage, - IsarStepType.TakeVideo => InspectionType.Video, - IsarStepType.TakeThermalVideo => InspectionType.ThermalVideo, + IsarTaskType.RecordAudio => InspectionType.Audio, + IsarTaskType.TakeImage => InspectionType.Image, + IsarTaskType.TakeThermalImage => InspectionType.ThermalImage, + IsarTaskType.TakeVideo => InspectionType.Video, + IsarTaskType.TakeThermalVideo => InspectionType.ThermalVideo, _ => throw new ArgumentException( - $"ISAR step type '{isarStep.StepType}' not supported for inspections" + $"ISAR task type '{isarTask.TaskType}' not supported for inspections" ) }; } - public void UpdateStatus(IsarStepStatus isarStatus) + public void UpdateStatus(IsarTaskStatus isarStatus) { Status = isarStatus switch { - IsarStepStatus.NotStarted => InspectionStatus.NotStarted, - IsarStepStatus.InProgress => InspectionStatus.InProgress, - IsarStepStatus.Successful => InspectionStatus.Successful, - IsarStepStatus.Cancelled => InspectionStatus.Cancelled, - IsarStepStatus.Failed => InspectionStatus.Failed, + IsarTaskStatus.NotStarted => InspectionStatus.NotStarted, + IsarTaskStatus.InProgress => InspectionStatus.InProgress, + IsarTaskStatus.Successful => InspectionStatus.Successful, + IsarTaskStatus.Cancelled => InspectionStatus.Cancelled, + IsarTaskStatus.Failed => InspectionStatus.Failed, _ => throw new ArgumentException( - $"ISAR step status '{isarStatus}' not supported for inspection status" + $"ISAR task status '{isarStatus}' not supported for inspection status" ) }; } diff --git a/backend/api/Database/Models/InspectionFinding.cs b/backend/api/Database/Models/InspectionFinding.cs index 188355096..5d63c470b 100644 --- a/backend/api/Database/Models/InspectionFinding.cs +++ b/backend/api/Database/Models/InspectionFinding.cs @@ -14,7 +14,7 @@ public class InspectionFinding public DateTime InspectionDate { get; set; } [Required] - public string IsarStepId { get; set; } + public string IsarTaskId { get; set; } [Required] public string Finding { get; set; } @@ -28,7 +28,7 @@ public InspectionFinding(InspectionFindingQuery createInspectionFindingQuery) public InspectionFinding() { InspectionDate = DateTime.UtcNow; - IsarStepId = "string"; + IsarTaskId = "string"; Finding = "string"; } } diff --git a/backend/api/Database/Models/MissionRun.cs b/backend/api/Database/Models/MissionRun.cs index b8715a3d3..7a180192e 100644 --- a/backend/api/Database/Models/MissionRun.cs +++ b/backend/api/Database/Models/MissionRun.cs @@ -139,7 +139,7 @@ public void CalculateEstimatedDuration() if (Robot.Model.AverageDurationPerTag is not null) { float totalInspectionDuration = Tasks.Sum( - task => task.Inspections.Sum(inspection => inspection.VideoDuration ?? 0) + task => task.Inspection.VideoDuration ?? 0 ); EstimatedDuration = (uint)( (Robot.Model.AverageDurationPerTag * Tasks.Count) + totalInspectionDuration @@ -161,7 +161,7 @@ public void CalculateEstimatedDuration() ); foreach (var task in Tasks) { - numberOfTags += task.Inspections.Count; + numberOfTags += 1; var currentPosition = task.RobotPose.Position; distance += Math.Abs(currentPosition.X - prevPosition.X) diff --git a/backend/api/Database/Models/MissionTask.cs b/backend/api/Database/Models/MissionTask.cs index eef0f8d82..f0f645177 100644 --- a/backend/api/Database/Models/MissionTask.cs +++ b/backend/api/Database/Models/MissionTask.cs @@ -19,7 +19,7 @@ public MissionTask() { } // ReSharper disable once NotNullOrRequiredMemberIsNotInitialized public MissionTask( - IList inspections, + Inspection inspection, Pose robotPose, int taskOrder, Uri? tagLink, @@ -28,9 +28,7 @@ public MissionTask( TaskStatus status = TaskStatus.NotStarted, MissionTaskType type = MissionTaskType.Inspection) { - Inspections = inspections - .Select(inspection => new Inspection(inspection)) - .ToList(); + Inspection = inspection; TagLink = tagLink; TagId = tagId; RobotPose = robotPose; @@ -42,9 +40,7 @@ public MissionTask( public MissionTask(CustomTaskQuery taskQuery) { - Inspections = taskQuery.Inspections - .Select(inspection => new Inspection(inspection)) - .ToList(); + Inspection = new Inspection(taskQuery.Inspection); TagId = taskQuery.TagId; Description = taskQuery.Description; RobotPose = taskQuery.RobotPose; @@ -63,7 +59,7 @@ public MissionTask(Pose robotPose, MissionTaskType type) RobotPose = robotPose; TaskOrder = 0; Status = TaskStatus.NotStarted; - Inspections = new List(); + Inspection = new Inspection(); break; case MissionTaskType.ReturnHome: Type = type; @@ -71,7 +67,7 @@ public MissionTask(Pose robotPose, MissionTaskType type) RobotPose = robotPose; TaskOrder = 0; Status = TaskStatus.NotStarted; - Inspections = new List(); + Inspection = new Inspection(); break; case MissionTaskType.Inspection: Type = type; @@ -79,7 +75,7 @@ public MissionTask(Pose robotPose, MissionTaskType type) RobotPose = robotPose; TaskOrder = 0; Status = TaskStatus.NotStarted; - Inspections = new List(); + Inspection = new Inspection(); break; default: throw new MissionTaskNotFoundException("MissionTaskType should be Localization, ReturnHome or Inspection"); @@ -97,7 +93,7 @@ public MissionTask(MissionTask copy, TaskStatus? status = null) RobotPose = new Pose(copy.RobotPose); PoseId = copy.PoseId; Status = status ?? copy.Status; - Inspections = copy.Inspections.Select(i => new Inspection(i, InspectionStatus.NotStarted)).ToList(); + Inspection = new Inspection(copy.Inspection, InspectionStatus.NotStarted); } [Key] @@ -152,17 +148,14 @@ or TaskStatus.Failed public DateTime? EndTime { get; private set; } - public IList Inspections { get; set; } + public Inspection Inspection { get; set; } public void UpdateWithIsarInfo(IsarTask isarTask) { UpdateStatus(isarTask.TaskStatus); - foreach (var inspection in Inspections) + if (isarTask.TaskType != IsarTaskType.ReturnToHome && isarTask.TaskType != IsarTaskType.Localize && isarTask.TaskType != IsarTaskType.MoveArm) { - var correspondingStep = isarTask.Steps.Single( - step => step.IsarStepId.Equals(inspection.IsarStepId, StringComparison.Ordinal) - ); - inspection.UpdateWithIsarInfo(correspondingStep); + Inspection.UpdateWithIsarInfo(isarTask); } } @@ -181,13 +174,9 @@ public void UpdateStatus(IsarTaskStatus isarStatus) }; } - public Inspection? GetInspectionByIsarStepId(string isarStepId) + public Inspection? GetInspectionByIsarTaskId(string isarTaskId) { - return Inspections.FirstOrDefault( - inspection => - inspection.IsarStepId != null - && inspection.IsarStepId.Equals(isarStepId, StringComparison.Ordinal) - ); + return Inspection; } public static string ConvertMissionTaskTypeToIsarTaskType(MissionTaskType missionTaskType) @@ -212,7 +201,7 @@ public static string CalculateHashFromTasks(IList tasks) Id = "", IsarTaskId = "" }; - taskCopy.Inspections = taskCopy.Inspections.Select(i => new Inspection(i, useEmptyIDs: true)).ToList(); + taskCopy.Inspection = new Inspection(taskCopy.Inspection, useEmptyIDs: true); genericTasks.Add(taskCopy); } diff --git a/backend/api/EventHandlers/InspectionFindingEventHandler.cs b/backend/api/EventHandlers/InspectionFindingEventHandler.cs index 6491941c6..6001de43d 100644 --- a/backend/api/EventHandlers/InspectionFindingEventHandler.cs +++ b/backend/api/EventHandlers/InspectionFindingEventHandler.cs @@ -78,8 +78,8 @@ private async Task> GenerateFindingsList(List i foreach (var inspectionFinding in inspectionFindings) { - var missionRun = await InspectionFindingService.GetMissionRunByIsarStepId(inspectionFinding.IsarStepId, readOnly: true); - var task = await InspectionFindingService.GetMissionTaskByIsarStepId(inspectionFinding.IsarStepId, readOnly: true); + var missionRun = await InspectionFindingService.GetMissionRunByIsarInspectionId(inspectionFinding.IsarTaskId, readOnly: true); + var task = await InspectionFindingService.GetMissionTaskByIsarInspectionId(inspectionFinding.IsarTaskId, readOnly: true); if (task != null && missionRun != null) { diff --git a/backend/api/EventHandlers/MqttEventHandler.cs b/backend/api/EventHandlers/MqttEventHandler.cs index b0401bd51..562ac9556 100644 --- a/backend/api/EventHandlers/MqttEventHandler.cs +++ b/backend/api/EventHandlers/MqttEventHandler.cs @@ -53,7 +53,6 @@ public override void Subscribe() MqttService.MqttIsarRobotInfoReceived += OnIsarRobotInfo; MqttService.MqttIsarMissionReceived += OnIsarMissionUpdate; MqttService.MqttIsarTaskReceived += OnIsarTaskUpdate; - MqttService.MqttIsarStepReceived += OnIsarStepUpdate; MqttService.MqttIsarBatteryReceived += OnIsarBatteryUpdate; MqttService.MqttIsarPressureReceived += OnIsarPressureUpdate; MqttService.MqttIsarPoseReceived += OnIsarPoseUpdate; @@ -67,7 +66,6 @@ public override void Unsubscribe() MqttService.MqttIsarRobotInfoReceived -= OnIsarRobotInfo; MqttService.MqttIsarMissionReceived -= OnIsarMissionUpdate; MqttService.MqttIsarTaskReceived -= OnIsarTaskUpdate; - MqttService.MqttIsarStepReceived -= OnIsarStepUpdate; MqttService.MqttIsarBatteryReceived -= OnIsarBatteryUpdate; MqttService.MqttIsarPressureReceived -= OnIsarPressureUpdate; MqttService.MqttIsarPoseReceived -= OnIsarPoseUpdate; @@ -384,6 +382,9 @@ private async void OnIsarTaskUpdate(object? sender, MqttReceivedArgs mqttArgs) try { await MissionTaskService.UpdateMissionTaskStatus(task.TaskId, status); } catch (MissionTaskNotFoundException) { return; } + try { await InspectionService.UpdateInspectionStatus(task.TaskId, status); } + catch (InspectionNotFoundException) { return; } + var missionRun = await MissionRunService.ReadByIsarMissionId(task.MissionId, readOnly: true); if (missionRun is null) { @@ -396,34 +397,6 @@ private async void OnIsarTaskUpdate(object? sender, MqttReceivedArgs mqttArgs) "Task '{Id}' updated to '{Status}' for robot '{RobotName}' with ISAR id '{IsarId}'", task.TaskId, task.Status, task.RobotName, task.IsarId); } - private async void OnIsarStepUpdate(object? sender, MqttReceivedArgs mqttArgs) - { - var step = (IsarStepMessage)mqttArgs.Message; - - // Flotilla does not care about DriveTo, Localization, MoveArm or ReturnToHome steps - var stepType = IsarStep.StepTypeFromString(step.StepType); - if (stepType is IsarStepType.DriveToPose or IsarStepType.Localize or IsarStepType.MoveArm or IsarStepType.ReturnToHome) return; - - IsarStepStatus status; - try { status = IsarStep.StatusFromString(step.Status); } - catch (ArgumentException e) - { - _logger.LogError(e, "Failed to parse mission status from MQTT message. Mission '{Id}' was not updated", step.MissionId); - return; - } - - try { await InspectionService.UpdateInspectionStatus(step.StepId, status); } - catch (InspectionNotFoundException) { return; } - - var missionRun = await MissionRunService.ReadByIsarMissionId(step.MissionId, readOnly: true); - if (missionRun is null) _logger.LogWarning("Mission run with ID {Id} was not found", step.MissionId); - - _ = SignalRService.SendMessageAsync("Mission run updated", missionRun?.Area?.Installation, missionRun != null ? new MissionRunResponse(missionRun) : null); - - _logger.LogInformation( - "Inspection '{Id}' updated to '{Status}' for robot '{RobotName}' with ISAR id '{IsarId}'", step.StepId, step.Status, step.RobotName, step.IsarId); - } - private async void OnIsarBatteryUpdate(object? sender, MqttReceivedArgs mqttArgs) { var batteryStatus = (IsarBatteryMessage)mqttArgs.Message; diff --git a/backend/api/MQTT/MessageModels/IsarTask.cs b/backend/api/MQTT/MessageModels/IsarTask.cs index e442b8600..910721eb7 100644 --- a/backend/api/MQTT/MessageModels/IsarTask.cs +++ b/backend/api/MQTT/MessageModels/IsarTask.cs @@ -20,6 +20,9 @@ public class IsarTaskMessage : MqttMessage [JsonPropertyName("status")] public string Status { get; set; } + [JsonPropertyName("task_type")] + public string TaskType { get; set; } + [JsonPropertyName("timestamp")] public DateTime Timestamp { get; set; } } diff --git a/backend/api/Services/ActionServices/TaskDurationService.cs b/backend/api/Services/ActionServices/TaskDurationService.cs index 718773b53..5f3e662d6 100644 --- a/backend/api/Services/ActionServices/TaskDurationService.cs +++ b/backend/api/Services/ActionServices/TaskDurationService.cs @@ -58,11 +58,9 @@ private async Task UpdateAverageDuration(List recentMissionRunsForMo .Select( task => (task.EndTime! - task.StartTime!).Value.TotalSeconds - - task.Inspections.Sum( - inspection => inspection.VideoDuration ?? 0 + - task.Inspection.VideoDuration ?? 0 ) ) - ) .ToList(); // If no valid task times, return diff --git a/backend/api/Services/EchoService.cs b/backend/api/Services/EchoService.cs index 5ff09c5b8..359a5937a 100644 --- a/backend/api/Services/EchoService.cs +++ b/backend/api/Services/EchoService.cs @@ -93,7 +93,7 @@ private async Task GetEchoMission(string echoMissionId) public async Task> GetTasksForMission(string missionSourceId) { var echoMission = await GetEchoMission(missionSourceId); - var missionTasks = echoMission.Tags.Select(t => MissionTaskFromEchoTag(t)).ToList(); + var missionTasks = echoMission.Tags.SelectMany(t => MissionTasksFromEchoTag(t)).ToList(); return missionTasks; } @@ -262,17 +262,24 @@ List echoPlantInfoResponse return echoPlantInfos; } - public MissionTask MissionTaskFromEchoTag(EchoTag echoTag) + public IList MissionTasksFromEchoTag(EchoTag echoTag) { - return new MissionTask - ( - inspections: echoTag.Inspections + var inspections = echoTag.Inspections .Select(inspection => new Inspection( inspectionType: inspection.InspectionType, videoDuration: inspection.TimeInSeconds, inspection.InspectionPoint, status: InspectionStatus.NotStarted)) - .ToList(), + .ToList(); + + var missionTasks = new List(); + + foreach (var inspection in inspections) + { + missionTasks.Add( + new MissionTask + ( + inspection: inspection, tagLink: echoTag.URL, tagId: echoTag.TagId, robotPose: echoTag.Pose, @@ -280,7 +287,11 @@ public MissionTask MissionTaskFromEchoTag(EchoTag echoTag) taskOrder: echoTag.PlanOrder, status: Database.Models.TaskStatus.NotStarted, type: MissionTaskType.Inspection - ); + )); + + } + + return missionTasks; } } } diff --git a/backend/api/Services/InspectionFindingService.cs b/backend/api/Services/InspectionFindingService.cs index f14ac047f..0443d3cb8 100644 --- a/backend/api/Services/InspectionFindingService.cs +++ b/backend/api/Services/InspectionFindingService.cs @@ -12,7 +12,7 @@ public async Task> RetrieveInspectionFindings(DateTime l return await inspectionFindingsQuery.Where(f => f.InspectionDate > lastReportingTime).ToListAsync(); } - public async Task GetMissionRunByIsarStepId(string isarStepId, bool readOnly = true) + public async Task GetMissionRunByIsarInspectionId(string isarTaskId, bool readOnly = true) { var accessibleInstallationCodes = accessRoleService.GetAllowedInstallationCodes(); var query = readOnly ? context.MissionRuns.AsNoTracking() : context.MissionRuns.AsTracking(); @@ -20,17 +20,17 @@ public async Task> RetrieveInspectionFindings(DateTime l #pragma warning disable CA1304 return await query.Include(missionRun => missionRun.Area).ThenInclude(area => area != null ? area.Plant : null) .Include(missionRun => missionRun.Robot) - .Include(missionRun => missionRun.Tasks).ThenInclude(task => task.Inspections) - .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspections.Any(inspection => inspection.IsarStepId == isarStepId))) + .Include(missionRun => missionRun.Tasks).ThenInclude(task => task.Inspection) + .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspection.Id == isarTaskId)) .Where((m) => m.Area == null || accessibleInstallationCodes.Result.Contains(m.Area.Installation.InstallationCode.ToUpper())) .FirstOrDefaultAsync(); #pragma warning restore CA1304 } - public async Task GetMissionTaskByIsarStepId(string isarStepId, bool readOnly = true) + public async Task GetMissionTaskByIsarInspectionId(string isarTaskId, bool readOnly = true) { - var missionRun = await GetMissionRunByIsarStepId(isarStepId, readOnly: readOnly); - return missionRun?.Tasks.Where(missionTask => missionTask.Inspections.Any(inspection => inspection.IsarStepId == isarStepId)).FirstOrDefault(); + var missionRun = await GetMissionRunByIsarInspectionId(isarTaskId, readOnly: readOnly); + return missionRun?.Tasks.Where(missionTask => missionTask.Inspection.Id == isarTaskId).FirstOrDefault(); } } } diff --git a/backend/api/Services/InspectionService.cs b/backend/api/Services/InspectionService.cs index 8c31f152a..5d8bbd6ab 100644 --- a/backend/api/Services/InspectionService.cs +++ b/backend/api/Services/InspectionService.cs @@ -10,9 +10,9 @@ namespace Api.Services { public interface IInspectionService { - public Task UpdateInspectionStatus(string isarStepId, IsarStepStatus isarStepStatus); - public Task ReadByIsarStepId(string id, bool readOnly = true); - public Task AddFinding(InspectionFindingQuery inspectionFindingsQuery, string isarStepId); + public Task UpdateInspectionStatus(string isarTaskId, IsarTaskStatus isarTaskStatus); + public Task ReadByIsarInspectionId(string id, bool readOnly = true); + public Task AddFinding(InspectionFindingQuery inspectionFindingsQuery, string isarTaskId); } @@ -23,17 +23,17 @@ public interface IInspectionService )] public class InspectionService(FlotillaDbContext context, ILogger logger, IAccessRoleService accessRoleService) : IInspectionService { - public async Task UpdateInspectionStatus(string isarStepId, IsarStepStatus isarStepStatus) + public async Task UpdateInspectionStatus(string isarInspectionId, IsarTaskStatus isarTaskStatus) { - var inspection = await ReadByIsarStepId(isarStepId, readOnly: false); + var inspection = await ReadByIsarInspectionId(isarInspectionId, readOnly: false); if (inspection is null) { - string errorMessage = $"Inspection with ID {isarStepId} could not be found"; + string errorMessage = $"Inspection with ID {isarInspectionId} could not be found"; logger.LogError("{Message}", errorMessage); throw new InspectionNotFoundException(errorMessage); } - inspection.UpdateStatus(isarStepStatus); + inspection.UpdateStatus(isarTaskStatus); inspection = await Update(inspection); return inspection; } @@ -54,7 +54,7 @@ private async Task Update(Inspection inspection) var missionRun = await context.MissionRuns .Include(missionRun => missionRun.Area).ThenInclude(area => area != null ? area.Installation : null) .Include(missionRun => missionRun.Robot) - .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspections.Any(i => i.Id == inspection.Id))).AsNoTracking() + .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspection.Id == inspection.Id)).AsNoTracking() .FirstOrDefaultAsync(); var installation = missionRun?.Area?.Installation; @@ -63,9 +63,9 @@ private async Task Update(Inspection inspection) return entry.Entity; } - public async Task ReadByIsarStepId(string id, bool readOnly = true) + public async Task ReadByIsarInspectionId(string id, bool readOnly = true) { - return await GetInspections(readOnly: readOnly).FirstOrDefaultAsync(inspection => inspection.IsarStepId != null && inspection.IsarStepId.Equals(id)); + return await GetInspections(readOnly: readOnly).FirstOrDefaultAsync(inspection => inspection.IsarInspectionId != null && inspection.IsarInspectionId.Equals(id)); } private IQueryable GetInspections(bool readOnly = true) @@ -76,9 +76,9 @@ private IQueryable GetInspections(bool readOnly = true) throw new UnauthorizedAccessException($"User does not have permission to view inspections"); } - public async Task AddFinding(InspectionFindingQuery inspectionFindingQuery, string isarStepId) + public async Task AddFinding(InspectionFindingQuery inspectionFindingQuery, string isarTaskId) { - var inspection = await ReadByIsarStepId(isarStepId, readOnly: false); + var inspection = await ReadByIsarInspectionId(isarTaskId, readOnly: false); if (inspection is null) { @@ -89,7 +89,7 @@ private IQueryable GetInspections(bool readOnly = true) { InspectionDate = inspectionFindingQuery.InspectionDate.ToUniversalTime(), Finding = inspectionFindingQuery.Finding, - IsarStepId = isarStepId, + IsarTaskId = isarTaskId, }; inspection.InspectionFindings.Add(inspectionFinding); diff --git a/backend/api/Services/IsarService.cs b/backend/api/Services/IsarService.cs index 537b7d1e6..b5862e6fa 100644 --- a/backend/api/Services/IsarService.cs +++ b/backend/api/Services/IsarService.cs @@ -25,14 +25,16 @@ public class IsarService(IDownstreamApi isarApi, ILogger logger) : public async Task StartMission(Robot robot, MissionRun missionRun) { + var missionDefinition = new + { + mission_definition = new IsarMissionDefinition(missionRun, includeStartPose: missionRun.MissionRunType == MissionRunType.Localization) + }; + var response = await CallApi( HttpMethod.Post, robot.IsarUri, "schedule/start-mission", - new - { - mission_definition = new IsarMissionDefinition(missionRun, includeStartPose: missionRun.MissionRunType == MissionRunType.Localization) - } + missionDefinition ); if (!response.IsSuccessStatusCode) diff --git a/backend/api/Services/MapService.cs b/backend/api/Services/MapService.cs index 6c4c2b513..7c7e424de 100644 --- a/backend/api/Services/MapService.cs +++ b/backend/api/Services/MapService.cs @@ -63,18 +63,15 @@ public async Task AssignMapToMission(MissionRun missionRun) var positions = new List(); foreach (var task in missionRun.Tasks) { - if (!task.Inspections.Any()) + if (task.Inspection == null) { positions.Add(task.RobotPose.Position); continue; } - foreach (var inspection in task.Inspections) + if (task.Inspection.InspectionTarget != null) { - if (inspection.InspectionTarget != null) - { - positions.Add(inspection.InspectionTarget); - } + positions.Add(task.Inspection.InspectionTarget); } } try diff --git a/backend/api/Services/MissionDefinitionService.cs b/backend/api/Services/MissionDefinitionService.cs index cea0b906f..329d6a3e8 100644 --- a/backend/api/Services/MissionDefinitionService.cs +++ b/backend/api/Services/MissionDefinitionService.cs @@ -185,7 +185,7 @@ private IQueryable GetMissionDefinitionsWithSubModels(bool re .Include(missionDefinition => missionDefinition.Source) .Include(missionDefinition => missionDefinition.LastSuccessfulRun) .ThenInclude(missionRun => missionRun != null ? missionRun.Tasks : null)! - .ThenInclude(missionTask => missionTask.Inspections) + .ThenInclude(missionTask => missionTask.Inspection) .ThenInclude(inspection => inspection.InspectionFindings) .Include(missionDefinition => missionDefinition.Area != null ? missionDefinition.Area.Deck : null) .ThenInclude(deck => deck != null ? deck.DefaultLocalizationPose : null) diff --git a/backend/api/Services/MissionRunService.cs b/backend/api/Services/MissionRunService.cs index 3386fad21..2135de4b1 100644 --- a/backend/api/Services/MissionRunService.cs +++ b/backend/api/Services/MissionRunService.cs @@ -247,7 +247,7 @@ public bool IncludesUnsupportedInspectionType(MissionRun missionRun) { if (missionRun.Robot.RobotCapabilities == null) return false; - return missionRun.Tasks.SelectMany((t) => t.Inspections).Any((i) => !i.IsSupportedInspectionType(missionRun.Robot.RobotCapabilities)); + return missionRun.Tasks.Any(task => !task.Inspection.IsSupportedInspectionType(missionRun.Robot.RobotCapabilities)); } public async Task Update(MissionRun missionRun) @@ -299,7 +299,7 @@ private IQueryable GetMissionRunsWithSubModels(bool readOnly = true) .Include(missionRun => missionRun.Robot) .ThenInclude(robot => robot.Model) .Include(missionRun => missionRun.Tasks) - .ThenInclude(task => task.Inspections) + .ThenInclude(task => task.Inspection) .ThenInclude(inspections => inspections.InspectionFindings) .Include(missionRun => missionRun.Robot) .ThenInclude(robot => robot.CurrentInstallation) @@ -428,10 +428,7 @@ MissionRunQueryStringParameters parameters Expression> inspectionTypeFilter = parameters.InspectionTypes is null ? mission => true : mission => mission.Tasks.Any( - task => - task.Inspections.Any( - inspection => parameters.InspectionTypes.Contains(inspection.InspectionType) - ) + task => parameters.InspectionTypes.Contains(task.Inspection.InspectionType) ); Expression> localizationFilter = !parameters.ExcludeLocalization @@ -597,11 +594,10 @@ public async Task SetMissionRunToFailed(string missionRunId, string foreach (var task in missionRun.Tasks.Where(task => !task.IsCompleted)) { task.Status = Database.Models.TaskStatus.Failed; - foreach ( - var inspection in task.Inspections.Where(inspection => !inspection.IsCompleted) - ) + + if (!task.Inspection.IsCompleted) { - inspection.Status = InspectionStatus.Failed; + task.Inspection.Status = InspectionStatus.Failed; } } return await Update(missionRun); diff --git a/backend/api/Services/MissionSchedulingService.cs b/backend/api/Services/MissionSchedulingService.cs index 72afa4906..5e12a927e 100644 --- a/backend/api/Services/MissionSchedulingService.cs +++ b/backend/api/Services/MissionSchedulingService.cs @@ -300,7 +300,6 @@ public async Task ScheduleMissionToDriveToSafePosition(string robotId, string ar var customTaskQuery = new CustomTaskQuery { RobotPose = clonedPose, - Inspections = [], TaskOrder = 0 }; diff --git a/backend/api/Services/MissionTaskService.cs b/backend/api/Services/MissionTaskService.cs index 491aca1a9..656004576 100644 --- a/backend/api/Services/MissionTaskService.cs +++ b/backend/api/Services/MissionTaskService.cs @@ -36,7 +36,7 @@ public async Task UpdateMissionTaskStatus(string isarTaskId, IsarTa private async Task Update(MissionTask missionTask) { - foreach (var inspection in missionTask.Inspections) { context.Entry(inspection).State = EntityState.Unchanged; } + context.Entry(missionTask.Inspection).State = EntityState.Unchanged; var entry = context.Update(missionTask); await context.SaveChangesAsync(); @@ -51,7 +51,7 @@ private async Task Update(MissionTask missionTask) private IQueryable GetMissionTasks(bool readOnly = true) { return (readOnly ? context.MissionTasks.AsNoTracking() : context.MissionTasks.AsTracking()) - .Include(missionTask => missionTask.Inspections).ThenInclude(inspection => inspection.InspectionFindings); + .Include(missionTask => missionTask.Inspection).ThenInclude(inspection => inspection.InspectionFindings); } public void DetachTracking(MissionTask missionTask) diff --git a/backend/api/Services/Models/IsarControlMissionResponse.cs b/backend/api/Services/Models/IsarControlMissionResponse.cs index 7772d9271..cd6823151 100644 --- a/backend/api/Services/Models/IsarControlMissionResponse.cs +++ b/backend/api/Services/Models/IsarControlMissionResponse.cs @@ -16,11 +16,5 @@ public class IsarControlMissionResponse [JsonPropertyName("task_status")] public string IsarTaskStatus { get; set; } - - [JsonPropertyName("step_id")] - public string IsarStepId { get; set; } - - [JsonPropertyName("step_status")] - public string IsarStepStatus { get; set; } } } diff --git a/backend/api/Services/Models/IsarMissionDefinition.cs b/backend/api/Services/Models/IsarMissionDefinition.cs index 2bce74876..cbf4e31bd 100644 --- a/backend/api/Services/Models/IsarMissionDefinition.cs +++ b/backend/api/Services/Models/IsarMissionDefinition.cs @@ -58,8 +58,8 @@ public struct IsarTaskDefinition [JsonPropertyName("tag")] public string? Tag { get; set; } - [JsonPropertyName("inspections")] - public List Inspections { get; set; } + [JsonPropertyName("inspection")] + public IsarInspectionDefinition Inspection { get; set; } public IsarTaskDefinition(MissionTask missionTask, MissionRun missionRun) { @@ -67,12 +67,7 @@ public IsarTaskDefinition(MissionTask missionTask, MissionRun missionRun) Type = MissionTask.ConvertMissionTaskTypeToIsarTaskType(missionTask.Type); Pose = new IsarPose(missionTask.RobotPose); Tag = missionTask.TagId; - var isarInspections = new List(); - foreach (var inspection in missionTask.Inspections) - { - isarInspections.Add(new IsarInspectionDefinition(inspection, missionRun)); - } - Inspections = isarInspections; + Inspection = new IsarInspectionDefinition(missionTask.Inspection, missionRun); } } @@ -95,7 +90,7 @@ public struct IsarInspectionDefinition public IsarInspectionDefinition(Inspection inspection, MissionRun missionRun) { - Id = inspection.IsarStepId; + Id = inspection.Id; Type = inspection.InspectionType.ToString(); InspectionTarget = inspection.InspectionTarget != null ? new IsarPosition( inspection.InspectionTarget.X, @@ -104,7 +99,7 @@ public IsarInspectionDefinition(Inspection inspection, MissionRun missionRun) "asset" ) : null; Duration = inspection.VideoDuration; - var metadata = new Dictionary + Metadata = new Dictionary { { "map", missionRun.Map?.MapName }, { "description", missionRun.Description }, @@ -114,7 +109,6 @@ public IsarInspectionDefinition(Inspection inspection, MissionRun missionRun) { "status_reason", missionRun.StatusReason }, { "analysis_type", inspection.AnalysisType?.ToString() } }; - Metadata = metadata; } } diff --git a/backend/api/Services/Models/IsarStartMissionResponse.cs b/backend/api/Services/Models/IsarStartMissionResponse.cs index 0121f0ead..2c3063f79 100644 --- a/backend/api/Services/Models/IsarStartMissionResponse.cs +++ b/backend/api/Services/Models/IsarStartMissionResponse.cs @@ -20,16 +20,11 @@ public class IsarTaskResponse [JsonPropertyName("tag_id")] public string TagId { get; set; } - [JsonPropertyName("steps")] - public IList Steps { get; set; } - } + [JsonPropertyName("type")] + public string TaskType { get; set; } - public class IsarStepResponse - { - [JsonPropertyName("id")] - public string IsarStepId { get; set; } + [JsonPropertyName("task_action_id")] + public string TaskActionId { get; set; } - [JsonPropertyName("type")] - public string Type { get; set; } } } diff --git a/backend/api/Services/Models/IsarStep.cs b/backend/api/Services/Models/IsarStep.cs deleted file mode 100644 index 0c19c7716..000000000 --- a/backend/api/Services/Models/IsarStep.cs +++ /dev/null @@ -1,70 +0,0 @@ -namespace Api.Services.Models -{ - public class IsarStep(IsarStepResponse stepResponse) - { - public string IsarStepId { get; } = stepResponse.IsarStepId; - - public IsarStepStatus StepStatus { get; } = IsarStepStatus.NotStarted; - - public IsarStepType StepType { get; } = StepTypeFromString(stepResponse.Type); - - - public static IsarStepStatus StatusFromString(string status) - { - return status switch - { - "successful" => IsarStepStatus.Successful, - "not_started" => IsarStepStatus.NotStarted, - "in_progress" => IsarStepStatus.InProgress, - "failed" => IsarStepStatus.Failed, - "cancelled" => IsarStepStatus.Cancelled, - _ - => throw new ArgumentException( - $"Failed to parse step status '{status}' - not supported" - ) - }; - } - - public static IsarStepType StepTypeFromString(string isarClassName) - { - return isarClassName switch - { - "DriveToPose" => IsarStepType.DriveToPose, - "RecordAudio" => IsarStepType.RecordAudio, - "TakeImage" => IsarStepType.TakeImage, - "TakeVideo" => IsarStepType.TakeVideo, - "TakeThermalImage" => IsarStepType.TakeThermalImage, - "TakeThermalVideo" => IsarStepType.TakeThermalVideo, - "Localize" => IsarStepType.Localize, - "ReturnToHome" => IsarStepType.ReturnToHome, - "MoveArm" => IsarStepType.MoveArm, - _ - => throw new ArgumentException( - $"Failed to parse step type '{isarClassName}' - not supported" - ) - }; - } - } - - public enum IsarStepStatus - { - Successful, - InProgress, - NotStarted, - Failed, - Cancelled - } - - public enum IsarStepType - { - DriveToPose, - Localize, - ReturnToHome, - TakeImage, - TakeVideo, - TakeThermalImage, - TakeThermalVideo, - RecordAudio, - MoveArm - } -} diff --git a/backend/api/Services/Models/IsarTask.cs b/backend/api/Services/Models/IsarTask.cs index 5a55e48a7..cd98ee82e 100644 --- a/backend/api/Services/Models/IsarTask.cs +++ b/backend/api/Services/Models/IsarTask.cs @@ -6,8 +6,7 @@ public class IsarTask(IsarTaskResponse taskResponse) public IsarTaskStatus TaskStatus { get; } = IsarTaskStatus.NotStarted; - public IList Steps { get; } = taskResponse.Steps.Select(step => new IsarStep(step)).ToList(); - + public IsarTaskType TaskType { get; } = TaskTypeFromString(taskResponse.TaskType); public static IsarTaskStatus StatusFromString(string status) { @@ -26,8 +25,28 @@ public static IsarTaskStatus StatusFromString(string status) ) }; } + + public static IsarTaskType TaskTypeFromString(string isarClassName) + { + return isarClassName switch + { + "record_audio" => IsarTaskType.RecordAudio, + "take_image" => IsarTaskType.TakeImage, + "take_video" => IsarTaskType.TakeVideo, + "take_thermal_image" => IsarTaskType.TakeThermalImage, + "take_thermal_video" => IsarTaskType.TakeThermalVideo, + "localize" => IsarTaskType.Localize, + "return_to_home" => IsarTaskType.ReturnToHome, + "move_arm" => IsarTaskType.MoveArm, + _ + => throw new ArgumentException( + $"Failed to parse step type '{isarClassName}' - not supported" + ) + }; + } } + public enum IsarTaskStatus { Successful, @@ -38,4 +57,16 @@ public enum IsarTaskStatus Cancelled, Paused, } + + public enum IsarTaskType + { + Localize, + ReturnToHome, + TakeImage, + TakeVideo, + TakeThermalImage, + TakeThermalVideo, + RecordAudio, + MoveArm + } } diff --git a/backend/api/appsettings.Development.json b/backend/api/appsettings.Development.json index e9955ddc6..09d690d06 100644 --- a/backend/api/appsettings.Development.json +++ b/backend/api/appsettings.Development.json @@ -28,7 +28,6 @@ "isar/+/robot_heartbeat", "isar/+/mission", "isar/+/task", - "isar/+/step", "isar/+/battery", "isar/+/pressure", "isar/+/pose", diff --git a/backend/api/appsettings.Local.json b/backend/api/appsettings.Local.json index ba15e5f55..04a227247 100644 --- a/backend/api/appsettings.Local.json +++ b/backend/api/appsettings.Local.json @@ -28,7 +28,6 @@ "isar/+/robot_heartbeat", "isar/+/mission", "isar/+/task", - "isar/+/step", "isar/+/battery", "isar/+/pressure", "isar/+/pose", diff --git a/backend/api/appsettings.Production.json b/backend/api/appsettings.Production.json index 2339c5fbe..10cf8db36 100644 --- a/backend/api/appsettings.Production.json +++ b/backend/api/appsettings.Production.json @@ -24,7 +24,6 @@ "isar/+/robot_heartbeat", "isar/+/mission", "isar/+/task", - "isar/+/step", "isar/+/battery", "isar/+/pressure", "isar/+/pose", diff --git a/backend/api/appsettings.Staging.json b/backend/api/appsettings.Staging.json index e0e78b682..32543700f 100644 --- a/backend/api/appsettings.Staging.json +++ b/backend/api/appsettings.Staging.json @@ -28,7 +28,6 @@ "isar/+/robot_heartbeat", "isar/+/mission", "isar/+/task", - "isar/+/step", "isar/+/battery", "isar/+/pressure", "isar/+/pose", diff --git a/backend/api/appsettings.Test.json b/backend/api/appsettings.Test.json index fc712c030..e9e96baf2 100644 --- a/backend/api/appsettings.Test.json +++ b/backend/api/appsettings.Test.json @@ -26,7 +26,6 @@ "isar/+/robot_heartbeat", "isar/+/mission", "isar/+/task", - "isar/+/step", "isar/+/battery", "isar/+/pressure", "isar/+/pose", diff --git a/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx b/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx index dbe54652c..5be387511 100644 --- a/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx +++ b/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx @@ -106,20 +106,19 @@ const InspectionTypesDisplay = ({ task }: { task: Task }) => { const { TranslateText } = useLanguageContext() return ( <> - {task.inspections?.map((inspection) => { - if (inspection.inspectionUrl) - return ( - - {TranslateText(inspection.inspectionType as string)} - - ) - else - return ( - - {TranslateText(inspection.inspectionType as string)} - + {task.inspection.inspectionUrl && ( + + + {TranslateText(task.inspection.inspectionType as string)} + ) +} +{!task.inspection.inspectionUrl && + ( + + {TranslateText(task.inspection.inspectionType as string)} + ) - })} + } ) } diff --git a/frontend/src/models/Task.ts b/frontend/src/models/Task.ts index d1184cb70..655d6a7e4 100644 --- a/frontend/src/models/Task.ts +++ b/frontend/src/models/Task.ts @@ -15,7 +15,7 @@ export interface Task { isCompleted: boolean startTime?: Date endTime?: Date - inspections: Inspection[] + inspection: Inspection } export enum TaskStatus { diff --git a/frontend/src/utils/MapMarkers.tsx b/frontend/src/utils/MapMarkers.tsx index c5847d03a..7646c0963 100644 --- a/frontend/src/utils/MapMarkers.tsx +++ b/frontend/src/utils/MapMarkers.tsx @@ -20,19 +20,20 @@ export const placeTagsInMap = ( const orderedTasks = orderTasksByDrawOrder(tasks, currentTaskOrder, maxTaskOrder) orderedTasks.forEach((task) => { - if (task.inspections.length === 0) { + if (task.inspection === null) { const pixelPosition = calculateObjectPixelPosition(mapMetadata, task.robotPose.position) // Workaround for current bug in echo const order = task.taskOrder + 1 drawTagMarker(pixelPosition[0], pixelPosition[1], map, order, 30, task.status) } - task.inspections.forEach((inspection) => { - const pixelPosition = calculateObjectPixelPosition(mapMetadata, inspection.inspectionTarget) + else + { + const pixelPosition = calculateObjectPixelPosition(mapMetadata, task.inspection.inspectionTarget) // Workaround for current bug in echo const order = task.taskOrder + 1 drawTagMarker(pixelPosition[0], pixelPosition[1], map, order, 30, task.status) - }) - }) + } +}) } export const placeRobotInMap = (mapMetadata: MapMetadata, map: HTMLCanvasElement, robotPose: Pose) => { From 347b596c0be287d5465a03f00eb88580f9508a4a Mon Sep 17 00:00:00 2001 From: "Mariana R. Santos" Date: Thu, 10 Oct 2024 16:20:20 +0200 Subject: [PATCH 2/6] Fix tests --- backend/api.test/Client/AreaTests.cs | 13 ++--- backend/api.test/Client/MissionTests.cs | 52 ++++++++++++++----- backend/api.test/Mocks/MissionLoaderMock.cs | 4 +- .../MissionPage/TaskOverview/TaskTable.tsx | 21 ++++---- frontend/src/utils/MapMarkers.tsx | 8 ++- 5 files changed, 59 insertions(+), 39 deletions(-) diff --git a/backend/api.test/Client/AreaTests.cs b/backend/api.test/Client/AreaTests.cs index 37057ed29..11c4ad3b6 100644 --- a/backend/api.test/Client/AreaTests.cs +++ b/backend/api.test/Client/AreaTests.cs @@ -168,20 +168,17 @@ public async Task MissionIsCreatedInArea() string testMissionName = "testMissionInAreaTest"; - var inspections = new List + var inspection = new CustomInspectionQuery { - new() - { - AnalysisType = AnalysisType.CarSeal, - InspectionTarget = new Position(), - InspectionType = InspectionType.Image - } + AnalysisType = AnalysisType.CarSeal, + InspectionTarget = new Position(), + InspectionType = InspectionType.Image }; var tasks = new List { new() { - Inspections = inspections, + Inspection = inspection, TagId = "test", RobotPose = new Pose(), TaskOrder = 0 diff --git a/backend/api.test/Client/MissionTests.cs b/backend/api.test/Client/MissionTests.cs index 7e5aef1e9..f732c789c 100644 --- a/backend/api.test/Client/MissionTests.cs +++ b/backend/api.test/Client/MissionTests.cs @@ -471,9 +471,9 @@ public async Task ScheduleDuplicateCustomMissionDefinitions() Port = 3000, CurrentInstallationCode = installationCode, CurrentAreaName = null, - RobotCapabilities = [], VideoStreams = new List(), - Documentation = new List() + Documentation = new List(), + RobotCapabilities = [RobotCapabilitiesEnum.take_image] }; string robotUrl = "/robots"; @@ -493,13 +493,21 @@ public async Task ScheduleDuplicateCustomMissionDefinitions() new() { RobotPose = new Pose(new Position(23, 14, 4), new Orientation()), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 0 }, new() { RobotPose = new Pose(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 1 } ] @@ -555,7 +563,7 @@ public async Task GetNextRun() Port = 3000, CurrentInstallationCode = installation.InstallationCode, CurrentAreaName = areaName, - RobotCapabilities = [], + RobotCapabilities = [RobotCapabilitiesEnum.take_image], VideoStreams = new List(), Documentation = new List() }; @@ -578,7 +586,11 @@ public async Task GetNextRun() new() { RobotPose = new Pose(), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 0 } ] @@ -738,7 +750,7 @@ public async Task MissionDoesNotStartIfRobotIsNotInSameInstallationAsMission() Port = 3000, CurrentInstallationCode = otherInstallation.InstallationCode, CurrentAreaName = null, - RobotCapabilities = [], + RobotCapabilities = [RobotCapabilitiesEnum.take_image], VideoStreams = new List(), Documentation = new List() }; @@ -760,13 +772,21 @@ public async Task MissionDoesNotStartIfRobotIsNotInSameInstallationAsMission() new() { RobotPose = new Pose(), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 0 }, new() { RobotPose = new Pose(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 1 } ] @@ -810,7 +830,7 @@ public async Task MissionFailsIfRobotIsNotInSameDeckAsMission() Port = 3000, CurrentInstallationCode = installation.InstallationCode, CurrentAreaName = area1.AreaName, - RobotCapabilities = [], + RobotCapabilities = [RobotCapabilitiesEnum.take_image], VideoStreams = new List(), Documentation = new List() }; @@ -832,13 +852,21 @@ public async Task MissionFailsIfRobotIsNotInSameDeckAsMission() new() { RobotPose = new Pose(new Position(1, 9, 4), new Orientation()), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 0 }, new() { RobotPose = new Pose(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f), - Inspections = [], + Inspection = new CustomInspectionQuery + { + InspectionTarget = new Position(), + InspectionType = InspectionType.Image + }, TaskOrder = 1 } ] diff --git a/backend/api.test/Mocks/MissionLoaderMock.cs b/backend/api.test/Mocks/MissionLoaderMock.cs index b3937f1a4..65b2da021 100644 --- a/backend/api.test/Mocks/MissionLoaderMock.cs +++ b/backend/api.test/Mocks/MissionLoaderMock.cs @@ -25,7 +25,7 @@ public class MockMissionLoader() : IMissionLoader private readonly List _mockMissionTasks = [ new MissionTask( - inspections: [], + inspection: new Inspection(), taskOrder: 0, tagId: "1", tagLink: new Uri("https://testurl.com"), @@ -37,7 +37,7 @@ public class MockMissionLoader() : IMissionLoader } ), new MissionTask( - inspections: [], + inspection: new Inspection(), taskOrder: 0, tagId: "2", tagLink: new Uri("https://testurl.com"), diff --git a/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx b/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx index 5be387511..a9500372c 100644 --- a/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx +++ b/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx @@ -107,18 +107,15 @@ const InspectionTypesDisplay = ({ task }: { task: Task }) => { return ( <> {task.inspection.inspectionUrl && ( - - - {TranslateText(task.inspection.inspectionType as string)} - ) -} -{!task.inspection.inspectionUrl && - ( - - {TranslateText(task.inspection.inspectionType as string)} - - ) - } + + {TranslateText(task.inspection.inspectionType as string)} + + )} + {!task.inspection.inspectionUrl && ( + + {TranslateText(task.inspection.inspectionType as string)} + + )} ) } diff --git a/frontend/src/utils/MapMarkers.tsx b/frontend/src/utils/MapMarkers.tsx index 7646c0963..ebb0aaba2 100644 --- a/frontend/src/utils/MapMarkers.tsx +++ b/frontend/src/utils/MapMarkers.tsx @@ -25,15 +25,13 @@ export const placeTagsInMap = ( // Workaround for current bug in echo const order = task.taskOrder + 1 drawTagMarker(pixelPosition[0], pixelPosition[1], map, order, 30, task.status) - } - else - { + } else { const pixelPosition = calculateObjectPixelPosition(mapMetadata, task.inspection.inspectionTarget) // Workaround for current bug in echo const order = task.taskOrder + 1 drawTagMarker(pixelPosition[0], pixelPosition[1], map, order, 30, task.status) - } -}) + } + }) } export const placeRobotInMap = (mapMetadata: MapMetadata, map: HTMLCanvasElement, robotPose: Pose) => { From 0e3a7dd9428c97998ea3cbdd8b75e0e9f8f28ef8 Mon Sep 17 00:00:00 2001 From: "Mariana R. Santos" Date: Mon, 14 Oct 2024 10:58:21 +0200 Subject: [PATCH 3/6] Change to only one inspection per task --- .../api.test/Database/DatabaseUtilities.cs | 2 +- .../InspectionFindingController.cs | 2 +- .../MissionSchedulingController.cs | 2 +- .../Controllers/Models/CustomMissionQuery.cs | 2 +- backend/api/Database/Models/Inspection.cs | 5 +-- backend/api/Database/Models/MissionRun.cs | 2 +- backend/api/Database/Models/MissionTask.cs | 36 +++++++++++-------- backend/api/Database/Models/Robot.cs | 1 - backend/api/EventHandlers/MqttEventHandler.cs | 7 ++-- backend/api/MQTT/MessageModels/IsarTask.cs | 18 ++++++++++ .../ActionServices/TaskDurationService.cs | 2 +- .../api/Services/InspectionFindingService.cs | 4 +-- backend/api/Services/InspectionService.cs | 16 ++++----- .../api/Services/MissionDefinitionService.cs | 2 +- backend/api/Services/MissionRunService.cs | 8 ++--- backend/api/Services/MissionTaskService.cs | 5 +-- .../Services/Models/IsarMissionDefinition.cs | 4 +-- .../MissionPage/TaskOverview/TaskTable.tsx | 20 +++++------ frontend/src/models/Inspection.ts | 2 +- 19 files changed, 84 insertions(+), 56 deletions(-) diff --git a/backend/api.test/Database/DatabaseUtilities.cs b/backend/api.test/Database/DatabaseUtilities.cs index de9635a5d..ee3e65c7d 100644 --- a/backend/api.test/Database/DatabaseUtilities.cs +++ b/backend/api.test/Database/DatabaseUtilities.cs @@ -161,7 +161,7 @@ public async Task NewRobot(RobotStatus status, Installation installation, Host = "localhost", Port = 3000, Status = status, - RobotCapabilities = [RobotCapabilitiesEnum.drive_to_pose, RobotCapabilitiesEnum.take_image, RobotCapabilitiesEnum.return_to_home, RobotCapabilitiesEnum.localize] + RobotCapabilities = [RobotCapabilitiesEnum.take_image, RobotCapabilitiesEnum.return_to_home, RobotCapabilitiesEnum.localize] }; var robotModel = await _robotModelService.ReadByRobotType(createRobotQuery.RobotType, readOnly: true); diff --git a/backend/api/Controllers/InspectionFindingController.cs b/backend/api/Controllers/InspectionFindingController.cs index 9efa33a1c..b7c0e2da8 100644 --- a/backend/api/Controllers/InspectionFindingController.cs +++ b/backend/api/Controllers/InspectionFindingController.cs @@ -67,7 +67,7 @@ public async Task> GetInspections([FromRoute] string id logger.LogInformation("Get inspection by ID '{id}'", id); try { - var inspection = await inspectionService.ReadByIsarInspectionId(id, readOnly: true); + var inspection = await inspectionService.ReadByIsarTaskId(id, readOnly: true); if (inspection != null) { return Ok(inspection); diff --git a/backend/api/Controllers/MissionSchedulingController.cs b/backend/api/Controllers/MissionSchedulingController.cs index 26d1884d7..c4951a5f4 100644 --- a/backend/api/Controllers/MissionSchedulingController.cs +++ b/backend/api/Controllers/MissionSchedulingController.cs @@ -62,7 +62,7 @@ [FromBody] ScheduleMissionQuery scheduledMissionQuery foreach (var task in missionTasks) { task.Id = Guid.NewGuid().ToString(); - task.Inspection.Id = Guid.NewGuid().ToString(); + if (task.Inspection != null) task.Inspection.Id = Guid.NewGuid().ToString(); } var newMissionRun = new MissionRun diff --git a/backend/api/Controllers/Models/CustomMissionQuery.cs b/backend/api/Controllers/Models/CustomMissionQuery.cs index 553df37f8..9421e9ef7 100644 --- a/backend/api/Controllers/Models/CustomMissionQuery.cs +++ b/backend/api/Controllers/Models/CustomMissionQuery.cs @@ -22,7 +22,7 @@ public struct CustomTaskQuery public Pose RobotPose { get; set; } - public CustomInspectionQuery Inspection { get; set; } + public CustomInspectionQuery? Inspection { get; set; } } public struct CustomMissionQuery diff --git a/backend/api/Database/Models/Inspection.cs b/backend/api/Database/Models/Inspection.cs index 43e359db3..97a287191 100644 --- a/backend/api/Database/Models/Inspection.cs +++ b/backend/api/Database/Models/Inspection.cs @@ -44,7 +44,7 @@ public Inspection(CustomInspectionQuery inspectionQuery) public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bool useEmptyIDs = false) { Id = useEmptyIDs ? "" : Guid.NewGuid().ToString(); - IsarInspectionId = useEmptyIDs ? "" : Guid.NewGuid().ToString(); + IsarTaskId = copy.IsarTaskId; Status = inspectionStatus ?? copy.Status; InspectionType = copy.InspectionType; VideoDuration = copy.VideoDuration; @@ -60,7 +60,7 @@ public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bo [Required] [MaxLength(200)] // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local - public string IsarInspectionId { get; set; } = Guid.NewGuid().ToString(); + public string IsarTaskId { get; set; } = Guid.NewGuid().ToString(); [Required] public Position InspectionTarget { get; set; } @@ -121,6 +121,7 @@ public void UpdateWithIsarInfo(IsarTask isarTask) $"ISAR task type '{isarTask.TaskType}' not supported for inspections" ) }; + IsarTaskId = isarTask.IsarTaskId; } public void UpdateStatus(IsarTaskStatus isarStatus) diff --git a/backend/api/Database/Models/MissionRun.cs b/backend/api/Database/Models/MissionRun.cs index 7a180192e..46bb84071 100644 --- a/backend/api/Database/Models/MissionRun.cs +++ b/backend/api/Database/Models/MissionRun.cs @@ -139,7 +139,7 @@ public void CalculateEstimatedDuration() if (Robot.Model.AverageDurationPerTag is not null) { float totalInspectionDuration = Tasks.Sum( - task => task.Inspection.VideoDuration ?? 0 + task => task.Inspection?.VideoDuration ?? 0 ); EstimatedDuration = (uint)( (Robot.Model.AverageDurationPerTag * Tasks.Count) + totalInspectionDuration diff --git a/backend/api/Database/Models/MissionTask.cs b/backend/api/Database/Models/MissionTask.cs index f0f645177..c0e666e69 100644 --- a/backend/api/Database/Models/MissionTask.cs +++ b/backend/api/Database/Models/MissionTask.cs @@ -19,7 +19,7 @@ public MissionTask() { } // ReSharper disable once NotNullOrRequiredMemberIsNotInitialized public MissionTask( - Inspection inspection, + Inspection? inspection, Pose robotPose, int taskOrder, Uri? tagLink, @@ -40,13 +40,17 @@ public MissionTask( public MissionTask(CustomTaskQuery taskQuery) { - Inspection = new Inspection(taskQuery.Inspection); TagId = taskQuery.TagId; Description = taskQuery.Description; RobotPose = taskQuery.RobotPose; TaskOrder = taskQuery.TaskOrder; Status = TaskStatus.NotStarted; - Type = MissionTaskType.Inspection; + Type = MissionTaskType.ReturnHome; + if (taskQuery.Inspection is not null) + { + Inspection = new Inspection((CustomInspectionQuery)taskQuery.Inspection); + Type = MissionTaskType.Inspection; + } } public MissionTask(Pose robotPose, MissionTaskType type) @@ -59,7 +63,6 @@ public MissionTask(Pose robotPose, MissionTaskType type) RobotPose = robotPose; TaskOrder = 0; Status = TaskStatus.NotStarted; - Inspection = new Inspection(); break; case MissionTaskType.ReturnHome: Type = type; @@ -67,7 +70,6 @@ public MissionTask(Pose robotPose, MissionTaskType type) RobotPose = robotPose; TaskOrder = 0; Status = TaskStatus.NotStarted; - Inspection = new Inspection(); break; case MissionTaskType.Inspection: Type = type; @@ -93,7 +95,10 @@ public MissionTask(MissionTask copy, TaskStatus? status = null) RobotPose = new Pose(copy.RobotPose); PoseId = copy.PoseId; Status = status ?? copy.Status; - Inspection = new Inspection(copy.Inspection, InspectionStatus.NotStarted); + if (copy.Inspection is not null) + { + Inspection = new Inspection(copy.Inspection, InspectionStatus.NotStarted); + } } [Key] @@ -148,14 +153,14 @@ or TaskStatus.Failed public DateTime? EndTime { get; private set; } - public Inspection Inspection { get; set; } + public Inspection? Inspection { get; set; } public void UpdateWithIsarInfo(IsarTask isarTask) { UpdateStatus(isarTask.TaskStatus); if (isarTask.TaskType != IsarTaskType.ReturnToHome && isarTask.TaskType != IsarTaskType.Localize && isarTask.TaskType != IsarTaskType.MoveArm) { - Inspection.UpdateWithIsarInfo(isarTask); + Inspection?.UpdateWithIsarInfo(isarTask); } } @@ -174,11 +179,6 @@ public void UpdateStatus(IsarTaskStatus isarStatus) }; } - public Inspection? GetInspectionByIsarTaskId(string isarTaskId) - { - return Inspection; - } - public static string ConvertMissionTaskTypeToIsarTaskType(MissionTaskType missionTaskType) { return missionTaskType switch @@ -199,9 +199,15 @@ public static string CalculateHashFromTasks(IList tasks) var taskCopy = new MissionTask(task) { Id = "", - IsarTaskId = "" + IsarTaskId = "", }; - taskCopy.Inspection = new Inspection(taskCopy.Inspection, useEmptyIDs: true); + if (taskCopy.Inspection is not null) + { + taskCopy.Inspection = new Inspection(taskCopy.Inspection, useEmptyIDs: true) + { + IsarTaskId = "" + }; + } genericTasks.Add(taskCopy); } diff --git a/backend/api/Database/Models/Robot.cs b/backend/api/Database/Models/Robot.cs index 58ab25656..54fae7dba 100644 --- a/backend/api/Database/Models/Robot.cs +++ b/backend/api/Database/Models/Robot.cs @@ -178,7 +178,6 @@ public enum RobotCapabilitiesEnum take_image, take_video, take_thermal_video, - drive_to_pose, record_audio, localize, docking_procedure, diff --git a/backend/api/EventHandlers/MqttEventHandler.cs b/backend/api/EventHandlers/MqttEventHandler.cs index 562ac9556..3140a4a81 100644 --- a/backend/api/EventHandlers/MqttEventHandler.cs +++ b/backend/api/EventHandlers/MqttEventHandler.cs @@ -382,8 +382,11 @@ private async void OnIsarTaskUpdate(object? sender, MqttReceivedArgs mqttArgs) try { await MissionTaskService.UpdateMissionTaskStatus(task.TaskId, status); } catch (MissionTaskNotFoundException) { return; } - try { await InspectionService.UpdateInspectionStatus(task.TaskId, status); } - catch (InspectionNotFoundException) { return; } + if (task.GetMissionTaskTypeFromIsarTask(task.TaskType) == MissionTaskType.Inspection) + { + try { await InspectionService.UpdateInspectionStatus(task.TaskId, status); } + catch (InspectionNotFoundException) { return; } + } var missionRun = await MissionRunService.ReadByIsarMissionId(task.MissionId, readOnly: true); if (missionRun is null) diff --git a/backend/api/MQTT/MessageModels/IsarTask.cs b/backend/api/MQTT/MessageModels/IsarTask.cs index 910721eb7..68764cd34 100644 --- a/backend/api/MQTT/MessageModels/IsarTask.cs +++ b/backend/api/MQTT/MessageModels/IsarTask.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using Api.Database.Models; namespace Api.Mqtt.MessageModels { @@ -25,5 +26,22 @@ public class IsarTaskMessage : MqttMessage [JsonPropertyName("timestamp")] public DateTime Timestamp { get; set; } + + + public MissionTaskType GetMissionTaskTypeFromIsarTask(string isarTaskType) + { + return isarTaskType switch + { + "record_audio" => MissionTaskType.Inspection, + "take_image" => MissionTaskType.Inspection, + "take_video" => MissionTaskType.Inspection, + "take_thermal_image" => MissionTaskType.Inspection, + "take_thermal_video" => MissionTaskType.Inspection, + "localize" => MissionTaskType.Localization, + "return_to_home" => MissionTaskType.ReturnHome, + + _ => throw new ArgumentException($"ISAR Task type '{isarTaskType}' not supported") + }; + } } } diff --git a/backend/api/Services/ActionServices/TaskDurationService.cs b/backend/api/Services/ActionServices/TaskDurationService.cs index 5f3e662d6..019b126ed 100644 --- a/backend/api/Services/ActionServices/TaskDurationService.cs +++ b/backend/api/Services/ActionServices/TaskDurationService.cs @@ -58,7 +58,7 @@ private async Task UpdateAverageDuration(List recentMissionRunsForMo .Select( task => (task.EndTime! - task.StartTime!).Value.TotalSeconds - - task.Inspection.VideoDuration ?? 0 + - task.Inspection?.VideoDuration ?? 0 ) ) .ToList(); diff --git a/backend/api/Services/InspectionFindingService.cs b/backend/api/Services/InspectionFindingService.cs index 0443d3cb8..c36679f31 100644 --- a/backend/api/Services/InspectionFindingService.cs +++ b/backend/api/Services/InspectionFindingService.cs @@ -21,7 +21,7 @@ public async Task> RetrieveInspectionFindings(DateTime l return await query.Include(missionRun => missionRun.Area).ThenInclude(area => area != null ? area.Plant : null) .Include(missionRun => missionRun.Robot) .Include(missionRun => missionRun.Tasks).ThenInclude(task => task.Inspection) - .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspection.Id == isarTaskId)) + .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspection != null && missionTask.Inspection.Id == isarTaskId)) .Where((m) => m.Area == null || accessibleInstallationCodes.Result.Contains(m.Area.Installation.InstallationCode.ToUpper())) .FirstOrDefaultAsync(); #pragma warning restore CA1304 @@ -30,7 +30,7 @@ public async Task> RetrieveInspectionFindings(DateTime l public async Task GetMissionTaskByIsarInspectionId(string isarTaskId, bool readOnly = true) { var missionRun = await GetMissionRunByIsarInspectionId(isarTaskId, readOnly: readOnly); - return missionRun?.Tasks.Where(missionTask => missionTask.Inspection.Id == isarTaskId).FirstOrDefault(); + return missionRun?.Tasks.Where(missionTask => missionTask.Inspection != null && missionTask.Inspection.Id == isarTaskId).FirstOrDefault(); } } } diff --git a/backend/api/Services/InspectionService.cs b/backend/api/Services/InspectionService.cs index 5d8bbd6ab..377f13982 100644 --- a/backend/api/Services/InspectionService.cs +++ b/backend/api/Services/InspectionService.cs @@ -11,7 +11,7 @@ namespace Api.Services public interface IInspectionService { public Task UpdateInspectionStatus(string isarTaskId, IsarTaskStatus isarTaskStatus); - public Task ReadByIsarInspectionId(string id, bool readOnly = true); + public Task ReadByIsarTaskId(string id, bool readOnly = true); public Task AddFinding(InspectionFindingQuery inspectionFindingsQuery, string isarTaskId); } @@ -23,12 +23,12 @@ public interface IInspectionService )] public class InspectionService(FlotillaDbContext context, ILogger logger, IAccessRoleService accessRoleService) : IInspectionService { - public async Task UpdateInspectionStatus(string isarInspectionId, IsarTaskStatus isarTaskStatus) + public async Task UpdateInspectionStatus(string isarTaskId, IsarTaskStatus isarTaskStatus) { - var inspection = await ReadByIsarInspectionId(isarInspectionId, readOnly: false); + var inspection = await ReadByIsarTaskId(isarTaskId, readOnly: false); if (inspection is null) { - string errorMessage = $"Inspection with ID {isarInspectionId} could not be found"; + string errorMessage = $"Inspection with task ID {isarTaskId} could not be found"; logger.LogError("{Message}", errorMessage); throw new InspectionNotFoundException(errorMessage); } @@ -54,7 +54,7 @@ private async Task Update(Inspection inspection) var missionRun = await context.MissionRuns .Include(missionRun => missionRun.Area).ThenInclude(area => area != null ? area.Installation : null) .Include(missionRun => missionRun.Robot) - .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspection.Id == inspection.Id)).AsNoTracking() + .Where(missionRun => missionRun.Tasks.Any(missionTask => missionTask.Inspection != null && missionTask.Inspection.Id == inspection.Id)).AsNoTracking() .FirstOrDefaultAsync(); var installation = missionRun?.Area?.Installation; @@ -63,9 +63,9 @@ private async Task Update(Inspection inspection) return entry.Entity; } - public async Task ReadByIsarInspectionId(string id, bool readOnly = true) + public async Task ReadByIsarTaskId(string id, bool readOnly = true) { - return await GetInspections(readOnly: readOnly).FirstOrDefaultAsync(inspection => inspection.IsarInspectionId != null && inspection.IsarInspectionId.Equals(id)); + return await GetInspections(readOnly: readOnly).FirstOrDefaultAsync(inspection => inspection.IsarTaskId != null && inspection.IsarTaskId.Equals(id)); } private IQueryable GetInspections(bool readOnly = true) @@ -78,7 +78,7 @@ private IQueryable GetInspections(bool readOnly = true) public async Task AddFinding(InspectionFindingQuery inspectionFindingQuery, string isarTaskId) { - var inspection = await ReadByIsarInspectionId(isarTaskId, readOnly: false); + var inspection = await ReadByIsarTaskId(isarTaskId, readOnly: false); if (inspection is null) { diff --git a/backend/api/Services/MissionDefinitionService.cs b/backend/api/Services/MissionDefinitionService.cs index 329d6a3e8..2babc91c1 100644 --- a/backend/api/Services/MissionDefinitionService.cs +++ b/backend/api/Services/MissionDefinitionService.cs @@ -186,7 +186,7 @@ private IQueryable GetMissionDefinitionsWithSubModels(bool re .Include(missionDefinition => missionDefinition.LastSuccessfulRun) .ThenInclude(missionRun => missionRun != null ? missionRun.Tasks : null)! .ThenInclude(missionTask => missionTask.Inspection) - .ThenInclude(inspection => inspection.InspectionFindings) + .ThenInclude(inspection => inspection != null ? inspection.InspectionFindings : null)! .Include(missionDefinition => missionDefinition.Area != null ? missionDefinition.Area.Deck : null) .ThenInclude(deck => deck != null ? deck.DefaultLocalizationPose : null) .ThenInclude(defaultLocalizationPose => defaultLocalizationPose != null ? defaultLocalizationPose.Pose : null) diff --git a/backend/api/Services/MissionRunService.cs b/backend/api/Services/MissionRunService.cs index 2135de4b1..af748d36b 100644 --- a/backend/api/Services/MissionRunService.cs +++ b/backend/api/Services/MissionRunService.cs @@ -247,7 +247,7 @@ public bool IncludesUnsupportedInspectionType(MissionRun missionRun) { if (missionRun.Robot.RobotCapabilities == null) return false; - return missionRun.Tasks.Any(task => !task.Inspection.IsSupportedInspectionType(missionRun.Robot.RobotCapabilities)); + return missionRun.Tasks.Any(task => task.Inspection != null && !task.Inspection.IsSupportedInspectionType(missionRun.Robot.RobotCapabilities)); } public async Task Update(MissionRun missionRun) @@ -300,7 +300,7 @@ private IQueryable GetMissionRunsWithSubModels(bool readOnly = true) .ThenInclude(robot => robot.Model) .Include(missionRun => missionRun.Tasks) .ThenInclude(task => task.Inspection) - .ThenInclude(inspections => inspections.InspectionFindings) + .ThenInclude(inspections => inspections != null ? inspections.InspectionFindings : null) .Include(missionRun => missionRun.Robot) .ThenInclude(robot => robot.CurrentInstallation) .Where((m) => m.Area == null || accessibleInstallationCodes.Result.Contains(m.Area.Installation.InstallationCode.ToUpper())) @@ -428,7 +428,7 @@ MissionRunQueryStringParameters parameters Expression> inspectionTypeFilter = parameters.InspectionTypes is null ? mission => true : mission => mission.Tasks.Any( - task => parameters.InspectionTypes.Contains(task.Inspection.InspectionType) + task => task.Inspection != null && parameters.InspectionTypes.Contains(task.Inspection.InspectionType) ); Expression> localizationFilter = !parameters.ExcludeLocalization @@ -595,7 +595,7 @@ public async Task SetMissionRunToFailed(string missionRunId, string { task.Status = Database.Models.TaskStatus.Failed; - if (!task.Inspection.IsCompleted) + if (task.Inspection != null && !task.Inspection.IsCompleted) { task.Inspection.Status = InspectionStatus.Failed; } diff --git a/backend/api/Services/MissionTaskService.cs b/backend/api/Services/MissionTaskService.cs index 656004576..4421d0bcd 100644 --- a/backend/api/Services/MissionTaskService.cs +++ b/backend/api/Services/MissionTaskService.cs @@ -36,7 +36,8 @@ public async Task UpdateMissionTaskStatus(string isarTaskId, IsarTa private async Task Update(MissionTask missionTask) { - context.Entry(missionTask.Inspection).State = EntityState.Unchanged; + if (missionTask.Inspection != null) context.Entry(missionTask.Inspection).State = EntityState.Unchanged; + var entry = context.Update(missionTask); await context.SaveChangesAsync(); @@ -51,7 +52,7 @@ private async Task Update(MissionTask missionTask) private IQueryable GetMissionTasks(bool readOnly = true) { return (readOnly ? context.MissionTasks.AsNoTracking() : context.MissionTasks.AsTracking()) - .Include(missionTask => missionTask.Inspection).ThenInclude(inspection => inspection.InspectionFindings); + .Include(missionTask => missionTask.Inspection).ThenInclude(inspection => inspection != null ? inspection.InspectionFindings : null); } public void DetachTracking(MissionTask missionTask) diff --git a/backend/api/Services/Models/IsarMissionDefinition.cs b/backend/api/Services/Models/IsarMissionDefinition.cs index cbf4e31bd..1573479f8 100644 --- a/backend/api/Services/Models/IsarMissionDefinition.cs +++ b/backend/api/Services/Models/IsarMissionDefinition.cs @@ -59,7 +59,7 @@ public struct IsarTaskDefinition public string? Tag { get; set; } [JsonPropertyName("inspection")] - public IsarInspectionDefinition Inspection { get; set; } + public IsarInspectionDefinition? Inspection { get; set; } public IsarTaskDefinition(MissionTask missionTask, MissionRun missionRun) { @@ -67,7 +67,7 @@ public IsarTaskDefinition(MissionTask missionTask, MissionRun missionRun) Type = MissionTask.ConvertMissionTaskTypeToIsarTaskType(missionTask.Type); Pose = new IsarPose(missionTask.RobotPose); Tag = missionTask.TagId; - Inspection = new IsarInspectionDefinition(missionTask.Inspection, missionRun); + if (missionTask.Inspection != null) Inspection = new IsarInspectionDefinition(missionTask.Inspection, missionRun); } } diff --git a/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx b/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx index a9500372c..64b63e6d1 100644 --- a/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx +++ b/frontend/src/components/Pages/MissionPage/TaskOverview/TaskTable.tsx @@ -106,16 +106,16 @@ const InspectionTypesDisplay = ({ task }: { task: Task }) => { const { TranslateText } = useLanguageContext() return ( <> - {task.inspection.inspectionUrl && ( - - {TranslateText(task.inspection.inspectionType as string)} - - )} - {!task.inspection.inspectionUrl && ( - - {TranslateText(task.inspection.inspectionType as string)} - - )} + {task.inspection && + (task.inspection.inspectionUrl ? ( + + {TranslateText(task.inspection.inspectionType as string)} + + ) : ( + + {TranslateText(task.inspection.inspectionType as string)} + + ))} ) } diff --git a/frontend/src/models/Inspection.ts b/frontend/src/models/Inspection.ts index b19ffdaa1..c4d76d349 100644 --- a/frontend/src/models/Inspection.ts +++ b/frontend/src/models/Inspection.ts @@ -9,7 +9,7 @@ export interface Inspection { inspectionTarget: Position videoDuration?: number analysisType?: string - inspectionUrl?: string + inspectionUrl?: string | null startTime?: Date endTime?: Date } From ea9030b71f76552a6d1ce70e1c0d63de024ef615 Mon Sep 17 00:00:00 2001 From: "Mariana R. Santos" Date: Mon, 14 Oct 2024 13:28:12 +0200 Subject: [PATCH 4/6] Remove csharpier format --- .github/workflows/backend_lint_and_test.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/backend_lint_and_test.yml b/.github/workflows/backend_lint_and_test.yml index 53d2209b9..39eccff08 100644 --- a/.github/workflows/backend_lint_and_test.yml +++ b/.github/workflows/backend_lint_and_test.yml @@ -59,8 +59,3 @@ jobs: # We are using severity level 'info' here. - name: Run dotnet format run: dotnet format --severity info --verbosity diagnostic --verify-no-changes --exclude ./api/migrations - - - name: Run csharpier format - run: | - dotnet tool restore - dotnet csharpier --check From b8e6176114e86796b1bcdc21504e07fb93d22c8c Mon Sep 17 00:00:00 2001 From: "Mariana R. Santos" Date: Tue, 15 Oct 2024 12:40:49 +0200 Subject: [PATCH 5/6] Adress requested changes --- .github/workflows/backend_lint_and_test.yml | 5 +++ backend/api/Database/Models/Inspection.cs | 7 ++-- backend/api/Database/Models/MissionRun.cs | 4 +-- backend/api/Database/Models/MissionTask.cs | 16 ++++----- backend/api/Services/EchoService.cs | 33 +++++++++---------- .../api/Services/MissionDefinitionService.cs | 2 +- frontend/src/models/Inspection.ts | 2 +- 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/.github/workflows/backend_lint_and_test.yml b/.github/workflows/backend_lint_and_test.yml index 39eccff08..53d2209b9 100644 --- a/.github/workflows/backend_lint_and_test.yml +++ b/.github/workflows/backend_lint_and_test.yml @@ -59,3 +59,8 @@ jobs: # We are using severity level 'info' here. - name: Run dotnet format run: dotnet format --severity info --verbosity diagnostic --verify-no-changes --exclude ./api/migrations + + - name: Run csharpier format + run: | + dotnet tool restore + dotnet csharpier --check diff --git a/backend/api/Database/Models/Inspection.cs b/backend/api/Database/Models/Inspection.cs index 97a287191..45b51eaf4 100644 --- a/backend/api/Database/Models/Inspection.cs +++ b/backend/api/Database/Models/Inspection.cs @@ -41,10 +41,10 @@ public Inspection(CustomInspectionQuery inspectionQuery) } // Creates a blank deepcopy of the provided inspection - public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bool useEmptyIDs = false) + public Inspection(Inspection copy, InspectionStatus? inspectionStatus = null, bool useEmptyID = false) { - Id = useEmptyIDs ? "" : Guid.NewGuid().ToString(); - IsarTaskId = copy.IsarTaskId; + Id = useEmptyID ? "" : Guid.NewGuid().ToString(); + IsarTaskId = useEmptyID ? "" : copy.IsarTaskId; Status = inspectionStatus ?? copy.Status; InspectionType = copy.InspectionType; VideoDuration = copy.VideoDuration; @@ -133,6 +133,7 @@ public void UpdateStatus(IsarTaskStatus isarStatus) IsarTaskStatus.Successful => InspectionStatus.Successful, IsarTaskStatus.Cancelled => InspectionStatus.Cancelled, IsarTaskStatus.Failed => InspectionStatus.Failed, + IsarTaskStatus.Paused => InspectionStatus.InProgress, _ => throw new ArgumentException( $"ISAR task status '{isarStatus}' not supported for inspection status" diff --git a/backend/api/Database/Models/MissionRun.cs b/backend/api/Database/Models/MissionRun.cs index 46bb84071..9f1440020 100644 --- a/backend/api/Database/Models/MissionRun.cs +++ b/backend/api/Database/Models/MissionRun.cs @@ -153,7 +153,6 @@ public void CalculateEstimatedDuration() const int AssumedXyMetersFromFirst = 20; double distance = 0; - int numberOfTags = 0; var prevPosition = new Position( Tasks.First().RobotPose.Position.X + AssumedXyMetersFromFirst, Tasks.First().RobotPose.Position.Y + AssumedXyMetersFromFirst, @@ -161,7 +160,6 @@ public void CalculateEstimatedDuration() ); foreach (var task in Tasks) { - numberOfTags += 1; var currentPosition = task.RobotPose.Position; distance += Math.Abs(currentPosition.X - prevPosition.X) @@ -170,7 +168,7 @@ public void CalculateEstimatedDuration() } int estimate = (int)( (distance / (RobotVelocity * EfficiencyFactor)) - + (numberOfTags * InspectionTime) + + InspectionTime ); EstimatedDuration = (uint)estimate * 60; } diff --git a/backend/api/Database/Models/MissionTask.cs b/backend/api/Database/Models/MissionTask.cs index c0e666e69..d78fcdcd7 100644 --- a/backend/api/Database/Models/MissionTask.cs +++ b/backend/api/Database/Models/MissionTask.cs @@ -28,7 +28,6 @@ public MissionTask( TaskStatus status = TaskStatus.NotStarted, MissionTaskType type = MissionTaskType.Inspection) { - Inspection = inspection; TagLink = tagLink; TagId = tagId; RobotPose = robotPose; @@ -36,6 +35,7 @@ public MissionTask( TaskOrder = taskOrder; Status = status; Type = type; + if (inspection != null) Inspection = new Inspection(inspection); } public MissionTask(CustomTaskQuery taskQuery) @@ -45,12 +45,15 @@ public MissionTask(CustomTaskQuery taskQuery) RobotPose = taskQuery.RobotPose; TaskOrder = taskQuery.TaskOrder; Status = TaskStatus.NotStarted; - Type = MissionTaskType.ReturnHome; if (taskQuery.Inspection is not null) { Inspection = new Inspection((CustomInspectionQuery)taskQuery.Inspection); Type = MissionTaskType.Inspection; } + else + { + Type = MissionTaskType.ReturnHome; + } } public MissionTask(Pose robotPose, MissionTaskType type) @@ -201,13 +204,8 @@ public static string CalculateHashFromTasks(IList tasks) Id = "", IsarTaskId = "", }; - if (taskCopy.Inspection is not null) - { - taskCopy.Inspection = new Inspection(taskCopy.Inspection, useEmptyIDs: true) - { - IsarTaskId = "" - }; - } + if (taskCopy.Inspection is not null) taskCopy.Inspection = new Inspection(taskCopy.Inspection, useEmptyID: true); + genericTasks.Add(taskCopy); } diff --git a/backend/api/Services/EchoService.cs b/backend/api/Services/EchoService.cs index 359a5937a..559196c6c 100644 --- a/backend/api/Services/EchoService.cs +++ b/backend/api/Services/EchoService.cs @@ -265,12 +265,12 @@ List echoPlantInfoResponse public IList MissionTasksFromEchoTag(EchoTag echoTag) { var inspections = echoTag.Inspections - .Select(inspection => new Inspection( - inspectionType: inspection.InspectionType, - videoDuration: inspection.TimeInSeconds, - inspection.InspectionPoint, - status: InspectionStatus.NotStarted)) - .ToList(); + .Select(inspection => new Inspection( + inspectionType: inspection.InspectionType, + videoDuration: inspection.TimeInSeconds, + inspection.InspectionPoint, + status: InspectionStatus.NotStarted)) + .ToList(); var missionTasks = new List(); @@ -278,17 +278,16 @@ public IList MissionTasksFromEchoTag(EchoTag echoTag) { missionTasks.Add( new MissionTask - ( - inspection: inspection, - tagLink: echoTag.URL, - tagId: echoTag.TagId, - robotPose: echoTag.Pose, - poseId: echoTag.PoseId, - taskOrder: echoTag.PlanOrder, - status: Database.Models.TaskStatus.NotStarted, - type: MissionTaskType.Inspection - )); - + ( + inspection: inspection, + tagLink: echoTag.URL, + tagId: echoTag.TagId, + robotPose: echoTag.Pose, + poseId: echoTag.PoseId, + taskOrder: echoTag.PlanOrder, + status: Database.Models.TaskStatus.NotStarted, + type: MissionTaskType.Inspection + )); } return missionTasks; diff --git a/backend/api/Services/MissionDefinitionService.cs b/backend/api/Services/MissionDefinitionService.cs index 2babc91c1..3027c5295 100644 --- a/backend/api/Services/MissionDefinitionService.cs +++ b/backend/api/Services/MissionDefinitionService.cs @@ -186,7 +186,7 @@ private IQueryable GetMissionDefinitionsWithSubModels(bool re .Include(missionDefinition => missionDefinition.LastSuccessfulRun) .ThenInclude(missionRun => missionRun != null ? missionRun.Tasks : null)! .ThenInclude(missionTask => missionTask.Inspection) - .ThenInclude(inspection => inspection != null ? inspection.InspectionFindings : null)! + .ThenInclude(inspection => inspection != null ? inspection.InspectionFindings : null) .Include(missionDefinition => missionDefinition.Area != null ? missionDefinition.Area.Deck : null) .ThenInclude(deck => deck != null ? deck.DefaultLocalizationPose : null) .ThenInclude(defaultLocalizationPose => defaultLocalizationPose != null ? defaultLocalizationPose.Pose : null) diff --git a/frontend/src/models/Inspection.ts b/frontend/src/models/Inspection.ts index c4d76d349..b19ffdaa1 100644 --- a/frontend/src/models/Inspection.ts +++ b/frontend/src/models/Inspection.ts @@ -9,7 +9,7 @@ export interface Inspection { inspectionTarget: Position videoDuration?: number analysisType?: string - inspectionUrl?: string | null + inspectionUrl?: string startTime?: Date endTime?: Date } From 6416bb4adc514cc349e5e3b2d5f375564fd06d1a Mon Sep 17 00:00:00 2001 From: "Mariana R. Santos" Date: Thu, 17 Oct 2024 13:20:16 +0200 Subject: [PATCH 6/6] Update migrations --- .../20231002084005_InitialCreate.Designer.cs | 1195 -------------- ...tLocalizationPoseToDeckAndArea.Designer.cs | 1231 --------------- ...AddDefaultLocalizationPoseToDeckAndArea.cs | 176 --- ...nameLastRunToLastSuccessfulRun.Designer.cs | 1231 --------------- ...120557_RenameLastRunToLastSuccessfulRun.cs | 60 - ...0_AddMissionQueueFrozenToRobot.Designer.cs | 1238 --------------- ...1101135310_AddMissionQueueFrozenToRobot.cs | 40 - ...0231106131042_ChangeToDateTime.Designer.cs | 1238 --------------- .../20231106131042_ChangeToDateTime.cs | 22 - ...06153232_AddInspectionFindings.Designer.cs | 1275 --------------- .../20231106153232_AddInspectionFindings.cs | 45 - ...9194856_MakeInspectionNotOwned.Designer.cs | 1275 --------------- .../20231109194856_MakeInspectionNotOwned.cs | 111 -- ...195524_MakeMissionTaskNotOwned.Designer.cs | 1274 --------------- .../20231109195524_MakeMissionTaskNotOwned.cs | 133 -- ...ddInspectionTargetToInspection.Designer.cs | 1312 ---------------- ...4141124_AddInspectionTargetToInspection.cs | 133 -- ..._RemoveInspectionFindingsTable.Designer.cs | 1275 --------------- ...115125019_RemoveInspectionFindingsTable.cs | 45 - ...240_AddInspectionFindingsTable.Designer.cs | 1311 ---------------- ...231115130240_AddInspectionFindingsTable.cs | 49 - ...efactorInspectionFindingsTable.Designer.cs | 1307 ---------------- ...6095346_RefactorInspectionFindingsTable.cs | 47 - ...081038_InspectionFindingReport.Designer.cs | 1314 ---------------- .../20231124081038_InspectionFindingReport.cs | 76 - ...128111821_FixNamingConventions.Designer.cs | 1314 ---------------- .../20231128111821_FixNamingConventions.cs | 28 - .../20231208115225_AddAccessRoles.Designer.cs | 1347 ---------------- .../20231208115225_AddAccessRoles.cs | 45 - ...5904_RemoveCurrentInstallation.Designer.cs | 1343 ---------------- ...0231208115904_RemoveCurrentInstallation.cs | 29 - ...AddCurrentInstallationAsObject.Designer.cs | 1354 ---------------- ...08120216_AddCurrentInstallationAsObject.cs | 48 - ...748_MakeAreaInMissionsRequired.Designer.cs | 1360 ---------------- ...231219141748_MakeAreaInMissionsRequired.cs | 100 -- ...219153128_AddTypeToMissionTask.Designer.cs | 1358 ---------------- .../20231219153128_AddTypeToMissionTask.cs | 29 - ...4142156_MakeDeckInAreaRequired.Designer.cs | 1366 ---------------- .../20240104142156_MakeDeckInAreaRequired.cs | 36 - ...rrentRobotInstallationRequired.Designer.cs | 1369 ---------------- ...42_MakeCurrentRobotInstallationRequired.cs | 59 - ...iredFieldsToInspectionAndPoses.Designer.cs | 1369 ---------------- ...1_AddRequiredFieldsToInspectionAndPoses.cs | 94 -- ...4_MakeInspectionTargetOptional.Designer.cs | 1368 ---------------- ...0126115524_MakeInspectionTargetOptional.cs | 72 - ...129130002_AddMissionRunCounter.Designer.cs | 1372 ---------------- .../20240129130002_AddMissionRunCounter.cs | 29 - ...6_MakeInspectionTargetRequired.Designer.cs | 1370 ---------------- ...0129154746_MakeInspectionTargetRequired.cs | 72 - ...145750_RemoveMissionRunCounter.Designer.cs | 1369 ---------------- .../20240207145750_RemoveMissionRunCounter.cs | 29 - ...8092245_RemoveInspectionTarget.Designer.cs | 1345 ---------------- .../20240208092245_RemoveInspectionTarget.cs | 48 - ...askTypeFromDriveToToReturnHome.Designer.cs | 1345 ---------------- ...eMissionTaskTypeFromDriveToToReturnHome.cs | 22 - ...40322094856_RenameRobotEnabled.Designer.cs | 1345 ---------------- .../20240322094856_RenameRobotEnabled.cs | 28 - ...322141359_AddDeprecatedToRobot.Designer.cs | 1348 ---------------- .../20240322141359_AddDeprecatedToRobot.cs | 29 - ...238_AddRobotCapabilitesToRobot.Designer.cs | 1351 ---------------- ...240403071238_AddRobotCapabilitesToRobot.cs | 28 - ...240412093857_AddMissionRunType.Designer.cs | 1351 ---------------- .../20240412093857_AddMissionRunType.cs | 28 - ...dDockToDefaultLocalisationPose.Designer.cs | 1354 ---------------- ...132916_AddDockToDefaultLocalisationPose.cs | 29 - ...2121_AddMissionRunIsDeprecated.Designer.cs | 1357 ---------------- ...0240717092121_AddMissionRunIsDeprecated.cs | 29 - ...4102244_AddRobotFlotillaStatus.Designer.cs | 1361 ---------------- .../20240724102244_AddRobotFlotillaStatus.cs | 29 - ...ustomMissionTasksToSourceTable.Designer.cs | 1360 ---------------- ...053_MoveCustomMissionTasksToSourceTable.cs | 28 - ...0240813114738_AddUserInfoTable.Designer.cs | 1379 ----------------- .../20240813114738_AddUserInfoTable.cs | 33 - ...829080813_RenameEchoProperties.Designer.cs | 1375 ---------------- .../20240829080813_RenameEchoProperties.cs | 49 - .../20240910132840_AddDocumentationToRobot.cs | 46 - ...7_AddMigrationsForNewDatabase.Designer.cs} | 35 +- ...1017111347_AddMigrationsForNewDatabase.cs} | 310 +++- .../FlotillaDbContextModelSnapshot.cs | 29 +- 79 files changed, 259 insertions(+), 52554 deletions(-) delete mode 100644 backend/api/Migrations/20231002084005_InitialCreate.Designer.cs delete mode 100644 backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.Designer.cs delete mode 100644 backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.cs delete mode 100644 backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.Designer.cs delete mode 100644 backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.cs delete mode 100644 backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.Designer.cs delete mode 100644 backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.cs delete mode 100644 backend/api/Migrations/20231106131042_ChangeToDateTime.Designer.cs delete mode 100644 backend/api/Migrations/20231106131042_ChangeToDateTime.cs delete mode 100644 backend/api/Migrations/20231106153232_AddInspectionFindings.Designer.cs delete mode 100644 backend/api/Migrations/20231106153232_AddInspectionFindings.cs delete mode 100644 backend/api/Migrations/20231109194856_MakeInspectionNotOwned.Designer.cs delete mode 100644 backend/api/Migrations/20231109194856_MakeInspectionNotOwned.cs delete mode 100644 backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.Designer.cs delete mode 100644 backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.cs delete mode 100644 backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.Designer.cs delete mode 100644 backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.cs delete mode 100644 backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.Designer.cs delete mode 100644 backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.cs delete mode 100644 backend/api/Migrations/20231115130240_AddInspectionFindingsTable.Designer.cs delete mode 100644 backend/api/Migrations/20231115130240_AddInspectionFindingsTable.cs delete mode 100644 backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.Designer.cs delete mode 100644 backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.cs delete mode 100644 backend/api/Migrations/20231124081038_InspectionFindingReport.Designer.cs delete mode 100644 backend/api/Migrations/20231124081038_InspectionFindingReport.cs delete mode 100644 backend/api/Migrations/20231128111821_FixNamingConventions.Designer.cs delete mode 100644 backend/api/Migrations/20231128111821_FixNamingConventions.cs delete mode 100644 backend/api/Migrations/20231208115225_AddAccessRoles.Designer.cs delete mode 100644 backend/api/Migrations/20231208115225_AddAccessRoles.cs delete mode 100644 backend/api/Migrations/20231208115904_RemoveCurrentInstallation.Designer.cs delete mode 100644 backend/api/Migrations/20231208115904_RemoveCurrentInstallation.cs delete mode 100644 backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.Designer.cs delete mode 100644 backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.cs delete mode 100644 backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.Designer.cs delete mode 100644 backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.cs delete mode 100644 backend/api/Migrations/20231219153128_AddTypeToMissionTask.Designer.cs delete mode 100644 backend/api/Migrations/20231219153128_AddTypeToMissionTask.cs delete mode 100644 backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.Designer.cs delete mode 100644 backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.cs delete mode 100644 backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.Designer.cs delete mode 100644 backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.cs delete mode 100644 backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.Designer.cs delete mode 100644 backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.cs delete mode 100644 backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.Designer.cs delete mode 100644 backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.cs delete mode 100644 backend/api/Migrations/20240129130002_AddMissionRunCounter.Designer.cs delete mode 100644 backend/api/Migrations/20240129130002_AddMissionRunCounter.cs delete mode 100644 backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.Designer.cs delete mode 100644 backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.cs delete mode 100644 backend/api/Migrations/20240207145750_RemoveMissionRunCounter.Designer.cs delete mode 100644 backend/api/Migrations/20240207145750_RemoveMissionRunCounter.cs delete mode 100644 backend/api/Migrations/20240208092245_RemoveInspectionTarget.Designer.cs delete mode 100644 backend/api/Migrations/20240208092245_RemoveInspectionTarget.cs delete mode 100644 backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.Designer.cs delete mode 100644 backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.cs delete mode 100644 backend/api/Migrations/20240322094856_RenameRobotEnabled.Designer.cs delete mode 100644 backend/api/Migrations/20240322094856_RenameRobotEnabled.cs delete mode 100644 backend/api/Migrations/20240322141359_AddDeprecatedToRobot.Designer.cs delete mode 100644 backend/api/Migrations/20240322141359_AddDeprecatedToRobot.cs delete mode 100644 backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.Designer.cs delete mode 100644 backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.cs delete mode 100644 backend/api/Migrations/20240412093857_AddMissionRunType.Designer.cs delete mode 100644 backend/api/Migrations/20240412093857_AddMissionRunType.cs delete mode 100644 backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.Designer.cs delete mode 100644 backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.cs delete mode 100644 backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.Designer.cs delete mode 100644 backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.cs delete mode 100644 backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.Designer.cs delete mode 100644 backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.cs delete mode 100644 backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.Designer.cs delete mode 100644 backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.cs delete mode 100644 backend/api/Migrations/20240813114738_AddUserInfoTable.Designer.cs delete mode 100644 backend/api/Migrations/20240813114738_AddUserInfoTable.cs delete mode 100644 backend/api/Migrations/20240829080813_RenameEchoProperties.Designer.cs delete mode 100644 backend/api/Migrations/20240829080813_RenameEchoProperties.cs delete mode 100644 backend/api/Migrations/20240910132840_AddDocumentationToRobot.cs rename backend/api/Migrations/{20240910132840_AddDocumentationToRobot.Designer.cs => 20241017111347_AddMigrationsForNewDatabase.Designer.cs} (98%) rename backend/api/Migrations/{20231002084005_InitialCreate.cs => 20241017111347_AddMigrationsForNewDatabase.cs} (72%) diff --git a/backend/api/Migrations/20231002084005_InitialCreate.Designer.cs b/backend/api/Migrations/20231002084005_InitialCreate.Designer.cs deleted file mode 100644 index 2741a60bf..000000000 --- a/backend/api/Migrations/20231002084005_InitialCreate.Designer.cs +++ /dev/null @@ -1,1195 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231002084005_InitialCreate")] - partial class InitialCreate - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "DefaultLocalizationPose", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseAreaId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("PoseAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseAreaId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("PoseAreaId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose") - .IsRequired(); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastRun") - .WithMany() - .HasForeignKey("LastRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspection"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.Designer.cs b/backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.Designer.cs deleted file mode 100644 index e81ee992a..000000000 --- a/backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.Designer.cs +++ /dev/null @@ -1,1231 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231009102654_AddDefaultLocalizationPoseToDeckAndArea")] - partial class AddDefaultLocalizationPoseToDeckAndArea - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastRun") - .WithMany() - .HasForeignKey("LastRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspection"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.cs b/backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.cs deleted file mode 100644 index e9d7572aa..000000000 --- a/backend/api/Migrations/20231009102654_AddDefaultLocalizationPoseToDeckAndArea.cs +++ /dev/null @@ -1,176 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddDefaultLocalizationPoseToDeckAndArea : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Orientation_W", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Orientation_X", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Orientation_Y", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Orientation_Z", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Position_X", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Position_Y", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPose_Position_Z", - table: "Areas"); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPoseId", - table: "Decks", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPoseId", - table: "Areas", - type: "text", - nullable: true); - - migrationBuilder.CreateTable( - name: "DefaultLocalizationPoses", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Pose_Position_X = table.Column(type: "real", nullable: false), - Pose_Position_Y = table.Column(type: "real", nullable: false), - Pose_Position_Z = table.Column(type: "real", nullable: false), - Pose_Orientation_X = table.Column(type: "real", nullable: false), - Pose_Orientation_Y = table.Column(type: "real", nullable: false), - Pose_Orientation_Z = table.Column(type: "real", nullable: false), - Pose_Orientation_W = table.Column(type: "real", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DefaultLocalizationPoses", x => x.Id); - }); - - migrationBuilder.CreateIndex( - name: "IX_Decks_DefaultLocalizationPoseId", - table: "Decks", - column: "DefaultLocalizationPoseId"); - - migrationBuilder.CreateIndex( - name: "IX_Areas_DefaultLocalizationPoseId", - table: "Areas", - column: "DefaultLocalizationPoseId"); - - migrationBuilder.AddForeignKey( - name: "FK_Areas_DefaultLocalizationPoses_DefaultLocalizationPoseId", - table: "Areas", - column: "DefaultLocalizationPoseId", - principalTable: "DefaultLocalizationPoses", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Decks_DefaultLocalizationPoses_DefaultLocalizationPoseId", - table: "Decks", - column: "DefaultLocalizationPoseId", - principalTable: "DefaultLocalizationPoses", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Areas_DefaultLocalizationPoses_DefaultLocalizationPoseId", - table: "Areas"); - - migrationBuilder.DropForeignKey( - name: "FK_Decks_DefaultLocalizationPoses_DefaultLocalizationPoseId", - table: "Decks"); - - migrationBuilder.DropTable( - name: "DefaultLocalizationPoses"); - - migrationBuilder.DropIndex( - name: "IX_Decks_DefaultLocalizationPoseId", - table: "Decks"); - - migrationBuilder.DropIndex( - name: "IX_Areas_DefaultLocalizationPoseId", - table: "Areas"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPoseId", - table: "Decks"); - - migrationBuilder.DropColumn( - name: "DefaultLocalizationPoseId", - table: "Areas"); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Orientation_W", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Orientation_X", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Orientation_Y", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Orientation_Z", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Position_X", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Position_Y", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "DefaultLocalizationPose_Position_Z", - table: "Areas", - type: "real", - nullable: false, - defaultValue: 0f); - } - } -} diff --git a/backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.Designer.cs b/backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.Designer.cs deleted file mode 100644 index 71e386202..000000000 --- a/backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.Designer.cs +++ /dev/null @@ -1,1231 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231016120557_RenameLastRunToLastSuccessfulRun")] - partial class RenameLastRunToLastSuccessfulRun - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspection"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.cs b/backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.cs deleted file mode 100644 index 0d410f760..000000000 --- a/backend/api/Migrations/20231016120557_RenameLastRunToLastSuccessfulRun.cs +++ /dev/null @@ -1,60 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RenameLastRunToLastSuccessfulRun : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_MissionRuns_LastRunId", - table: "MissionDefinitions"); - - migrationBuilder.RenameColumn( - name: "LastRunId", - table: "MissionDefinitions", - newName: "LastSuccessfulRunId"); - - migrationBuilder.RenameIndex( - name: "IX_MissionDefinitions_LastRunId", - table: "MissionDefinitions", - newName: "IX_MissionDefinitions_LastSuccessfulRunId"); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_MissionRuns_LastSuccessfulRunId", - table: "MissionDefinitions", - column: "LastSuccessfulRunId", - principalTable: "MissionRuns", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_MissionRuns_LastSuccessfulRunId", - table: "MissionDefinitions"); - - migrationBuilder.RenameColumn( - name: "LastSuccessfulRunId", - table: "MissionDefinitions", - newName: "LastRunId"); - - migrationBuilder.RenameIndex( - name: "IX_MissionDefinitions_LastSuccessfulRunId", - table: "MissionDefinitions", - newName: "IX_MissionDefinitions_LastRunId"); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_MissionRuns_LastRunId", - table: "MissionDefinitions", - column: "LastRunId", - principalTable: "MissionRuns", - principalColumn: "Id"); - } - } -} diff --git a/backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.Designer.cs b/backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.Designer.cs deleted file mode 100644 index 84c6b57ba..000000000 --- a/backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.Designer.cs +++ /dev/null @@ -1,1238 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231101135310_AddMissionQueueFrozenToRobot")] - partial class AddMissionQueueFrozenToRobot - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastRun") - .WithMany() - .HasForeignKey("LastRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspection"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.cs b/backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.cs deleted file mode 100644 index c5e3c9ccc..000000000 --- a/backend/api/Migrations/20231101135310_AddMissionQueueFrozenToRobot.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddMissionQueueFrozenToRobot : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "MissionQueueFrozen", - table: "Robots", - type: "boolean", - nullable: false, - defaultValue: false); - - migrationBuilder.AddColumn( - name: "MissionRunPriority", - table: "MissionRuns", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "MissionQueueFrozen", - table: "Robots"); - - migrationBuilder.DropColumn( - name: "MissionRunPriority", - table: "MissionRuns"); - } - } -} diff --git a/backend/api/Migrations/20231106131042_ChangeToDateTime.Designer.cs b/backend/api/Migrations/20231106131042_ChangeToDateTime.Designer.cs deleted file mode 100644 index 1b82233af..000000000 --- a/backend/api/Migrations/20231106131042_ChangeToDateTime.Designer.cs +++ /dev/null @@ -1,1238 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231106131042_ChangeToDateTime")] - partial class ChangeToDateTime - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastRun") - .WithMany() - .HasForeignKey("LastRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspection"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231106131042_ChangeToDateTime.cs b/backend/api/Migrations/20231106131042_ChangeToDateTime.cs deleted file mode 100644 index 2706175c9..000000000 --- a/backend/api/Migrations/20231106131042_ChangeToDateTime.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class ChangeToDateTime : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/backend/api/Migrations/20231106153232_AddInspectionFindings.Designer.cs b/backend/api/Migrations/20231106153232_AddInspectionFindings.Designer.cs deleted file mode 100644 index 14a1da874..000000000 --- a/backend/api/Migrations/20231106153232_AddInspectionFindings.Designer.cs +++ /dev/null @@ -1,1275 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231106153232_AddInspectionFindings")] - partial class AddInspectionFindings - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastRun") - .WithMany() - .HasForeignKey("LastRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspection"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsMany("Api.Database.Models.InspectionFindings", "InspectionFindings", b3 => - { - b3.Property("InspectionId") - .HasColumnType("text"); - - b3.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b3.Property("Id")); - - b3.Property("Area") - .IsRequired() - .HasColumnType("text"); - - b3.Property("FindingsTag") - .IsRequired() - .HasColumnType("text"); - - b3.Property("InspectionDate") - .IsRequired() - .HasColumnType("text"); - - b3.Property("RobotName") - .IsRequired() - .HasColumnType("text"); - - b3.HasKey("InspectionId", "Id"); - - b3.ToTable("InspectionFindings"); - - b3.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b2.Navigation("InspectionFindings"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231106153232_AddInspectionFindings.cs b/backend/api/Migrations/20231106153232_AddInspectionFindings.cs deleted file mode 100644 index 17286db8a..000000000 --- a/backend/api/Migrations/20231106153232_AddInspectionFindings.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddInspectionFindings : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "InspectionFindings", - columns: table => new - { - InspectionId = table.Column(type: "text", nullable: false), - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RobotName = table.Column(type: "text", nullable: false), - InspectionDate = table.Column(type: "text", nullable: false), - Area = table.Column(type: "text", nullable: false), - FindingsTag = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_InspectionFindings", x => new { x.InspectionId, x.Id }); - table.ForeignKey( - name: "FK_InspectionFindings_Inspection_InspectionId", - column: x => x.InspectionId, - principalTable: "Inspection", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "InspectionFindings"); - } - } -} diff --git a/backend/api/Migrations/20231109194856_MakeInspectionNotOwned.Designer.cs b/backend/api/Migrations/20231109194856_MakeInspectionNotOwned.Designer.cs deleted file mode 100644 index 62e3dd45a..000000000 --- a/backend/api/Migrations/20231109194856_MakeInspectionNotOwned.Designer.cs +++ /dev/null @@ -1,1275 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231109194856_MakeInspectionNotOwned")] - partial class MakeInspectionNotOwned - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTask"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspections"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsMany("Api.Database.Models.InspectionFindings", "InspectionFindings", b3 => - { - b3.Property("InspectionId") - .HasColumnType("text"); - - b3.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b3.Property("Id")); - - b3.Property("Area") - .IsRequired() - .HasColumnType("text"); - - b3.Property("FindingsTag") - .IsRequired() - .HasColumnType("text"); - - b3.Property("InspectionDate") - .IsRequired() - .HasColumnType("text"); - - b3.Property("RobotName") - .IsRequired() - .HasColumnType("text"); - - b3.HasKey("InspectionId", "Id"); - - b3.ToTable("InspectionFindings"); - - b3.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b2.Navigation("InspectionFindings"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTask"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTask"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231109194856_MakeInspectionNotOwned.cs b/backend/api/Migrations/20231109194856_MakeInspectionNotOwned.cs deleted file mode 100644 index 99a44fcdb..000000000 --- a/backend/api/Migrations/20231109194856_MakeInspectionNotOwned.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeInspectionNotOwned : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_InspectionFindings_Inspection_InspectionId", - table: "InspectionFindings"); - - migrationBuilder.DropTable( - name: "Inspection"); - - migrationBuilder.CreateTable( - name: "Inspections", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - IsarStepId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - Status = table.Column(type: "text", nullable: false), - InspectionType = table.Column(type: "text", nullable: false), - VideoDuration = table.Column(type: "real", nullable: true), - AnalysisType = table.Column(type: "text", nullable: true), - InspectionUrl = table.Column(type: "character varying(250)", maxLength: 250, nullable: true), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - MissionTaskId = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Inspections", x => x.Id); - table.ForeignKey( - name: "FK_Inspections_MissionTask_MissionTaskId", - column: x => x.MissionTaskId, - principalTable: "MissionTask", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Inspections_MissionTaskId", - table: "Inspections", - column: "MissionTaskId"); - - migrationBuilder.AddForeignKey( - name: "FK_InspectionFindings_Inspections_InspectionId", - table: "InspectionFindings", - column: "InspectionId", - principalTable: "Inspections", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_InspectionFindings_Inspections_InspectionId", - table: "InspectionFindings"); - - migrationBuilder.DropTable( - name: "Inspections"); - - migrationBuilder.CreateTable( - name: "Inspection", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - AnalysisType = table.Column(type: "text", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - InspectionType = table.Column(type: "text", nullable: false), - InspectionUrl = table.Column(type: "character varying(250)", maxLength: 250, nullable: true), - IsarStepId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - MissionTaskId = table.Column(type: "text", nullable: false), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - Status = table.Column(type: "text", nullable: false), - VideoDuration = table.Column(type: "real", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Inspection", x => x.Id); - table.ForeignKey( - name: "FK_Inspection_MissionTask_MissionTaskId", - column: x => x.MissionTaskId, - principalTable: "MissionTask", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Inspection_MissionTaskId", - table: "Inspection", - column: "MissionTaskId"); - - migrationBuilder.AddForeignKey( - name: "FK_InspectionFindings_Inspection_InspectionId", - table: "InspectionFindings", - column: "InspectionId", - principalTable: "Inspection", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.Designer.cs b/backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.Designer.cs deleted file mode 100644 index fbac42b2d..000000000 --- a/backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.Designer.cs +++ /dev/null @@ -1,1274 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231109195524_MakeMissionTaskNotOwned")] - partial class MakeMissionTaskNotOwned - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.MissionTask", "Tasks", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b1.Property("EchoPoseId") - .HasColumnType("integer"); - - b1.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b1.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b1.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("TaskOrder") - .HasColumnType("integer"); - - b1.HasKey("Id"); - - b1.HasIndex("MissionRunId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsMany("Api.Database.Models.Inspection", "Inspections", b2 => - { - b2.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b2.Property("AnalysisType") - .HasColumnType("text"); - - b2.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b2.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b2.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b2.Property("MissionTaskId") - .IsRequired() - .HasColumnType("text"); - - b2.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b2.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b2.Property("VideoDuration") - .HasColumnType("real"); - - b2.HasKey("Id"); - - b2.HasIndex("MissionTaskId"); - - b2.ToTable("Inspections"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsMany("Api.Database.Models.InspectionFindings", "InspectionFindings", b3 => - { - b3.Property("InspectionId") - .HasColumnType("text"); - - b3.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b3.Property("Id")); - - b3.Property("Area") - .IsRequired() - .HasColumnType("text"); - - b3.Property("FindingsTag") - .IsRequired() - .HasColumnType("text"); - - b3.Property("InspectionDate") - .IsRequired() - .HasColumnType("text"); - - b3.Property("RobotName") - .IsRequired() - .HasColumnType("text"); - - b3.HasKey("InspectionId", "Id"); - - b3.ToTable("InspectionFindings"); - - b3.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b2.Navigation("InspectionFindings"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Pose", "RobotPose", b2 => - { - b2.Property("MissionTaskId") - .HasColumnType("text"); - - b2.HasKey("MissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("MissionTaskId"); - - b2.OwnsOne("Api.Database.Models.Orientation", "Orientation", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("W") - .HasColumnType("real"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTasks"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.OwnsOne("Api.Database.Models.Position", "Position", b3 => - { - b3.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b3.Property("X") - .HasColumnType("real"); - - b3.Property("Y") - .HasColumnType("real"); - - b3.Property("Z") - .HasColumnType("real"); - - b3.HasKey("PoseMissionTaskId"); - - b3.ToTable("MissionTasks"); - - b3.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b2.Navigation("Orientation") - .IsRequired(); - - b2.Navigation("Position") - .IsRequired(); - }); - - b1.Navigation("InspectionTarget") - .IsRequired(); - - b1.Navigation("Inspections"); - - b1.Navigation("RobotPose") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.cs b/backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.cs deleted file mode 100644 index 5f49e0628..000000000 --- a/backend/api/Migrations/20231109195524_MakeMissionTaskNotOwned.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeMissionTaskNotOwned : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Inspections_MissionTask_MissionTaskId", - table: "Inspections"); - - migrationBuilder.DropTable( - name: "MissionTask"); - - migrationBuilder.CreateTable( - name: "MissionTasks", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - IsarTaskId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - TaskOrder = table.Column(type: "integer", nullable: false), - TagId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - EchoTagLink = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - InspectionTarget_X = table.Column(type: "real", nullable: false), - InspectionTarget_Y = table.Column(type: "real", nullable: false), - InspectionTarget_Z = table.Column(type: "real", nullable: false), - RobotPose_Position_X = table.Column(type: "real", nullable: false), - RobotPose_Position_Y = table.Column(type: "real", nullable: false), - RobotPose_Position_Z = table.Column(type: "real", nullable: false), - RobotPose_Orientation_X = table.Column(type: "real", nullable: false), - RobotPose_Orientation_Y = table.Column(type: "real", nullable: false), - RobotPose_Orientation_Z = table.Column(type: "real", nullable: false), - RobotPose_Orientation_W = table.Column(type: "real", nullable: false), - EchoPoseId = table.Column(type: "integer", nullable: true), - Status = table.Column(type: "text", nullable: false), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - MissionRunId = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_MissionTasks", x => x.Id); - table.ForeignKey( - name: "FK_MissionTasks_MissionRuns_MissionRunId", - column: x => x.MissionRunId, - principalTable: "MissionRuns", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_MissionTasks_MissionRunId", - table: "MissionTasks", - column: "MissionRunId"); - - migrationBuilder.AddForeignKey( - name: "FK_Inspections_MissionTasks_MissionTaskId", - table: "Inspections", - column: "MissionTaskId", - principalTable: "MissionTasks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Inspections_MissionTasks_MissionTaskId", - table: "Inspections"); - - migrationBuilder.DropTable( - name: "MissionTasks"); - - migrationBuilder.CreateTable( - name: "MissionTask", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - EchoPoseId = table.Column(type: "integer", nullable: true), - EchoTagLink = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - IsarTaskId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - MissionRunId = table.Column(type: "text", nullable: false), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - Status = table.Column(type: "text", nullable: false), - TagId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - TaskOrder = table.Column(type: "integer", nullable: false), - InspectionTarget_X = table.Column(type: "real", nullable: false), - InspectionTarget_Y = table.Column(type: "real", nullable: false), - InspectionTarget_Z = table.Column(type: "real", nullable: false), - RobotPose_Orientation_W = table.Column(type: "real", nullable: false), - RobotPose_Orientation_X = table.Column(type: "real", nullable: false), - RobotPose_Orientation_Y = table.Column(type: "real", nullable: false), - RobotPose_Orientation_Z = table.Column(type: "real", nullable: false), - RobotPose_Position_X = table.Column(type: "real", nullable: false), - RobotPose_Position_Y = table.Column(type: "real", nullable: false), - RobotPose_Position_Z = table.Column(type: "real", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_MissionTask", x => x.Id); - table.ForeignKey( - name: "FK_MissionTask_MissionRuns_MissionRunId", - column: x => x.MissionRunId, - principalTable: "MissionRuns", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_MissionTask_MissionRunId", - table: "MissionTask", - column: "MissionRunId"); - - migrationBuilder.AddForeignKey( - name: "FK_Inspections_MissionTask_MissionTaskId", - table: "Inspections", - column: "MissionTaskId", - principalTable: "MissionTask", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.Designer.cs b/backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.Designer.cs deleted file mode 100644 index 05c054ff4..000000000 --- a/backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.Designer.cs +++ /dev/null @@ -1,1312 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231114141124_AddInspectionTargetToInspection")] - partial class AddInspectionTargetToInspection - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.OwnsMany("Api.Database.Models.InspectionFindings", "InspectionFindings", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property("Id")); - - b1.Property("Area") - .IsRequired() - .HasColumnType("text"); - - b1.Property("FindingsTag") - .IsRequired() - .HasColumnType("text"); - - b1.Property("InspectionDate") - .IsRequired() - .HasColumnType("text"); - - b1.Property("RobotName") - .IsRequired() - .HasColumnType("text"); - - b1.HasKey("InspectionId", "Id"); - - b1.ToTable("InspectionFindings"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionFindings"); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.cs b/backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.cs deleted file mode 100644 index f2761f87e..000000000 --- a/backend/api/Migrations/20231114141124_AddInspectionTargetToInspection.cs +++ /dev/null @@ -1,133 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddInspectionTargetToInspection : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Inspections_MissionTasks_MissionTaskId", - table: "Inspections"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionTasks_MissionRuns_MissionRunId", - table: "MissionTasks"); - - migrationBuilder.AlterColumn( - name: "MissionRunId", - table: "MissionTasks", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "MissionTaskId", - table: "Inspections", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AddColumn( - name: "InspectionTarget_X", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "InspectionTarget_Y", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddColumn( - name: "InspectionTarget_Z", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f); - - migrationBuilder.AddForeignKey( - name: "FK_Inspections_MissionTasks_MissionTaskId", - table: "Inspections", - column: "MissionTaskId", - principalTable: "MissionTasks", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_MissionTasks_MissionRuns_MissionRunId", - table: "MissionTasks", - column: "MissionRunId", - principalTable: "MissionRuns", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Inspections_MissionTasks_MissionTaskId", - table: "Inspections"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionTasks_MissionRuns_MissionRunId", - table: "MissionTasks"); - - migrationBuilder.DropColumn( - name: "InspectionTarget_X", - table: "Inspections"); - - migrationBuilder.DropColumn( - name: "InspectionTarget_Y", - table: "Inspections"); - - migrationBuilder.DropColumn( - name: "InspectionTarget_Z", - table: "Inspections"); - - migrationBuilder.AlterColumn( - name: "MissionRunId", - table: "MissionTasks", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "MissionTaskId", - table: "Inspections", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_Inspections_MissionTasks_MissionTaskId", - table: "Inspections", - column: "MissionTaskId", - principalTable: "MissionTasks", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_MissionTasks_MissionRuns_MissionRunId", - table: "MissionTasks", - column: "MissionRunId", - principalTable: "MissionRuns", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - } -} diff --git a/backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.Designer.cs b/backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.Designer.cs deleted file mode 100644 index 252784d44..000000000 --- a/backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.Designer.cs +++ /dev/null @@ -1,1275 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231115125019_RemoveInspectionFindingsTable")] - partial class RemoveInspectionFindingsTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.cs b/backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.cs deleted file mode 100644 index 34d27cdf8..000000000 --- a/backend/api/Migrations/20231115125019_RemoveInspectionFindingsTable.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RemoveInspectionFindingsTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "InspectionFindings"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "InspectionFindings", - columns: table => new - { - InspectionId = table.Column(type: "text", nullable: false), - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - Area = table.Column(type: "text", nullable: false), - FindingsTag = table.Column(type: "text", nullable: false), - InspectionDate = table.Column(type: "text", nullable: false), - RobotName = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_InspectionFindings", x => new { x.InspectionId, x.Id }); - table.ForeignKey( - name: "FK_InspectionFindings_Inspections_InspectionId", - column: x => x.InspectionId, - principalTable: "Inspections", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - } - } -} diff --git a/backend/api/Migrations/20231115130240_AddInspectionFindingsTable.Designer.cs b/backend/api/Migrations/20231115130240_AddInspectionFindingsTable.Designer.cs deleted file mode 100644 index 3ce6a9912..000000000 --- a/backend/api/Migrations/20231115130240_AddInspectionFindingsTable.Designer.cs +++ /dev/null @@ -1,1311 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231115130240_AddInspectionFindingsTable")] - partial class AddInspectionFindingsTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.OwnsMany("Api.Database.Models.InspectionFinding", "InspectionFindings", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Area") - .IsRequired() - .HasColumnType("text"); - - b1.Property("Findings") - .IsRequired() - .HasColumnType("text"); - - b1.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b1.HasKey("Id"); - - b1.HasIndex("InspectionId"); - - b1.ToTable("InspectionFinding"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionFindings"); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231115130240_AddInspectionFindingsTable.cs b/backend/api/Migrations/20231115130240_AddInspectionFindingsTable.cs deleted file mode 100644 index c41c3fc31..000000000 --- a/backend/api/Migrations/20231115130240_AddInspectionFindingsTable.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddInspectionFindingsTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "InspectionFinding", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - InspectionDate = table.Column(type: "timestamp with time zone", nullable: false), - Area = table.Column(type: "text", nullable: false), - IsarStepId = table.Column(type: "text", nullable: false), - Findings = table.Column(type: "text", nullable: false), - InspectionId = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_InspectionFinding", x => x.Id); - table.ForeignKey( - name: "FK_InspectionFinding_Inspections_InspectionId", - column: x => x.InspectionId, - principalTable: "Inspections", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_InspectionFinding_InspectionId", - table: "InspectionFinding", - column: "InspectionId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "InspectionFinding"); - } - } -} diff --git a/backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.Designer.cs b/backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.Designer.cs deleted file mode 100644 index d5f7fd458..000000000 --- a/backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.Designer.cs +++ /dev/null @@ -1,1307 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231116095346_RefactorInspectionFindingsTable")] - partial class RefactorInspectionFindingsTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.11") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.OwnsMany("Api.Database.Models.InspectionFinding", "InspectionFindings", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Findings") - .IsRequired() - .HasColumnType("text"); - - b1.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b1.HasKey("Id"); - - b1.HasIndex("InspectionId"); - - b1.ToTable("InspectionFinding"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionFindings"); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.cs b/backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.cs deleted file mode 100644 index dd89e88bb..000000000 --- a/backend/api/Migrations/20231116095346_RefactorInspectionFindingsTable.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RefactorInspectionFindingsTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Area", - table: "InspectionFinding"); - - migrationBuilder.AlterColumn( - name: "InspectionId", - table: "InspectionFinding", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "InspectionId", - table: "InspectionFinding", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AddColumn( - name: "Area", - table: "InspectionFinding", - type: "text", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/backend/api/Migrations/20231124081038_InspectionFindingReport.Designer.cs b/backend/api/Migrations/20231124081038_InspectionFindingReport.Designer.cs deleted file mode 100644 index 5ce1ef2b5..000000000 --- a/backend/api/Migrations/20231124081038_InspectionFindingReport.Designer.cs +++ /dev/null @@ -1,1314 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231124081038_InspectionFindingReport")] - partial class InspectionFindingReport - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Findings") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231124081038_InspectionFindingReport.cs b/backend/api/Migrations/20231124081038_InspectionFindingReport.cs deleted file mode 100644 index 2ecddee0d..000000000 --- a/backend/api/Migrations/20231124081038_InspectionFindingReport.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class InspectionFindingReport : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "InspectionFinding"); - - migrationBuilder.CreateTable( - name: "InspectionFindings", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - InspectionDate = table.Column(type: "timestamp with time zone", nullable: false), - IsarStepId = table.Column(type: "text", nullable: false), - Findings = table.Column(type: "text", nullable: false), - InspectionId = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_InspectionFindings", x => x.Id); - table.ForeignKey( - name: "FK_InspectionFindings_Inspections_InspectionId", - column: x => x.InspectionId, - principalTable: "Inspections", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_InspectionFindings_InspectionId", - table: "InspectionFindings", - column: "InspectionId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "InspectionFindings"); - - migrationBuilder.CreateTable( - name: "InspectionFinding", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Findings = table.Column(type: "text", nullable: false), - InspectionDate = table.Column(type: "timestamp with time zone", nullable: false), - InspectionId = table.Column(type: "text", nullable: false), - IsarStepId = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_InspectionFinding", x => x.Id); - table.ForeignKey( - name: "FK_InspectionFinding_Inspections_InspectionId", - column: x => x.InspectionId, - principalTable: "Inspections", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_InspectionFinding_InspectionId", - table: "InspectionFinding", - column: "InspectionId"); - } - } -} diff --git a/backend/api/Migrations/20231128111821_FixNamingConventions.Designer.cs b/backend/api/Migrations/20231128111821_FixNamingConventions.Designer.cs deleted file mode 100644 index 144e14674..000000000 --- a/backend/api/Migrations/20231128111821_FixNamingConventions.Designer.cs +++ /dev/null @@ -1,1314 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231128111821_FixNamingConventions")] - partial class FixNamingConventions - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231128111821_FixNamingConventions.cs b/backend/api/Migrations/20231128111821_FixNamingConventions.cs deleted file mode 100644 index f8b84d141..000000000 --- a/backend/api/Migrations/20231128111821_FixNamingConventions.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class FixNamingConventions : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Findings", - table: "InspectionFindings", - newName: "Finding"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Finding", - table: "InspectionFindings", - newName: "Findings"); - } - } -} diff --git a/backend/api/Migrations/20231208115225_AddAccessRoles.Designer.cs b/backend/api/Migrations/20231208115225_AddAccessRoles.Designer.cs deleted file mode 100644 index db7c0436b..000000000 --- a/backend/api/Migrations/20231208115225_AddAccessRoles.Designer.cs +++ /dev/null @@ -1,1347 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231208115225_AddAccessRoles")] - partial class AddAccessRoles - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallation") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231208115225_AddAccessRoles.cs b/backend/api/Migrations/20231208115225_AddAccessRoles.cs deleted file mode 100644 index 3aa24ce9c..000000000 --- a/backend/api/Migrations/20231208115225_AddAccessRoles.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddAccessRoles : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AccessRoles", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - InstallationId = table.Column(type: "text", nullable: true), - RoleName = table.Column(type: "text", nullable: false), - AccessLevel = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AccessRoles", x => x.Id); - table.ForeignKey( - name: "FK_AccessRoles_Installations_InstallationId", - column: x => x.InstallationId, - principalTable: "Installations", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_AccessRoles_InstallationId", - table: "AccessRoles", - column: "InstallationId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AccessRoles"); - } - } -} diff --git a/backend/api/Migrations/20231208115904_RemoveCurrentInstallation.Designer.cs b/backend/api/Migrations/20231208115904_RemoveCurrentInstallation.Designer.cs deleted file mode 100644 index 98cab84f3..000000000 --- a/backend/api/Migrations/20231208115904_RemoveCurrentInstallation.Designer.cs +++ /dev/null @@ -1,1343 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231208115904_RemoveCurrentInstallation")] - partial class RemoveCurrentInstallation - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231208115904_RemoveCurrentInstallation.cs b/backend/api/Migrations/20231208115904_RemoveCurrentInstallation.cs deleted file mode 100644 index 04e318825..000000000 --- a/backend/api/Migrations/20231208115904_RemoveCurrentInstallation.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RemoveCurrentInstallation : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CurrentInstallation", - table: "Robots"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CurrentInstallation", - table: "Robots", - type: "text", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.Designer.cs b/backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.Designer.cs deleted file mode 100644 index 2cb4f8190..000000000 --- a/backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.Designer.cs +++ /dev/null @@ -1,1354 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231208120216_AddCurrentInstallationAsObject")] - partial class AddCurrentInstallationAsObject - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.cs b/backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.cs deleted file mode 100644 index af6298731..000000000 --- a/backend/api/Migrations/20231208120216_AddCurrentInstallationAsObject.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddCurrentInstallationAsObject : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CurrentInstallationId", - table: "Robots", - type: "text", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_Robots_CurrentInstallationId", - table: "Robots", - column: "CurrentInstallationId"); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_Installations_CurrentInstallationId", - table: "Robots", - column: "CurrentInstallationId", - principalTable: "Installations", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Robots_Installations_CurrentInstallationId", - table: "Robots"); - - migrationBuilder.DropIndex( - name: "IX_Robots_CurrentInstallationId", - table: "Robots"); - - migrationBuilder.DropColumn( - name: "CurrentInstallationId", - table: "Robots"); - } - } -} diff --git a/backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.Designer.cs b/backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.Designer.cs deleted file mode 100644 index 99387786c..000000000 --- a/backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.Designer.cs +++ /dev/null @@ -1,1360 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231219141748_MakeAreaInMissionsRequired")] - partial class MakeAreaInMissionsRequired - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.cs b/backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.cs deleted file mode 100644 index 36603287f..000000000 --- a/backend/api/Migrations/20231219141748_MakeAreaInMissionsRequired.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeAreaInMissionsRequired : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_Areas_AreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionRuns_Areas_AreaId", - table: "MissionRuns"); - - migrationBuilder.AlterColumn( - name: "AreaId", - table: "MissionRuns", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "AreaId", - table: "MissionDefinitions", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_Areas_AreaId", - table: "MissionDefinitions", - column: "AreaId", - principalTable: "Areas", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_MissionRuns_Areas_AreaId", - table: "MissionRuns", - column: "AreaId", - principalTable: "Areas", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_Areas_AreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionRuns_Areas_AreaId", - table: "MissionRuns"); - - migrationBuilder.AlterColumn( - name: "AreaId", - table: "MissionRuns", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AlterColumn( - name: "AreaId", - table: "MissionDefinitions", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_Areas_AreaId", - table: "MissionDefinitions", - column: "AreaId", - principalTable: "Areas", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_MissionRuns_Areas_AreaId", - table: "MissionRuns", - column: "AreaId", - principalTable: "Areas", - principalColumn: "Id"); - } - } -} diff --git a/backend/api/Migrations/20231219153128_AddTypeToMissionTask.Designer.cs b/backend/api/Migrations/20231219153128_AddTypeToMissionTask.Designer.cs deleted file mode 100644 index b49054298..000000000 --- a/backend/api/Migrations/20231219153128_AddTypeToMissionTask.Designer.cs +++ /dev/null @@ -1,1358 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20231219153128_AddTypeToMissionTask")] - partial class AddTypeToMissionTask - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId"); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20231219153128_AddTypeToMissionTask.cs b/backend/api/Migrations/20231219153128_AddTypeToMissionTask.cs deleted file mode 100644 index 5fce95cc0..000000000 --- a/backend/api/Migrations/20231219153128_AddTypeToMissionTask.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddTypeToMissionTask : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Type", - table: "MissionTasks", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Type", - table: "MissionTasks"); - } - } -} diff --git a/backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.Designer.cs b/backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.Designer.cs deleted file mode 100644 index 448c05190..000000000 --- a/backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.Designer.cs +++ /dev/null @@ -1,1366 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240104142156_MakeDeckInAreaRequired")] - partial class MakeDeckInAreaRequired - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId"); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.cs b/backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.cs deleted file mode 100644 index d51cfbc49..000000000 --- a/backend/api/Migrations/20240104142156_MakeDeckInAreaRequired.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeDeckInAreaRequired : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "DeckId", - table: "Areas", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "DeckId", - table: "Areas", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - } - } -} diff --git a/backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.Designer.cs b/backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.Designer.cs deleted file mode 100644 index 9ee1c53ae..000000000 --- a/backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.Designer.cs +++ /dev/null @@ -1,1369 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240104143242_MakeCurrentRobotInstallationRequired")] - partial class MakeCurrentRobotInstallationRequired - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.cs b/backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.cs deleted file mode 100644 index 1cfc7073e..000000000 --- a/backend/api/Migrations/20240104143242_MakeCurrentRobotInstallationRequired.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeCurrentRobotInstallationRequired : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Robots_Installations_CurrentInstallationId", - table: "Robots"); - - migrationBuilder.AlterColumn( - name: "CurrentInstallationId", - table: "Robots", - type: "text", - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "text", - oldNullable: true); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_Installations_CurrentInstallationId", - table: "Robots", - column: "CurrentInstallationId", - principalTable: "Installations", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Robots_Installations_CurrentInstallationId", - table: "Robots"); - - migrationBuilder.AlterColumn( - name: "CurrentInstallationId", - table: "Robots", - type: "text", - nullable: true, - oldClrType: typeof(string), - oldType: "text"); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_Installations_CurrentInstallationId", - table: "Robots", - column: "CurrentInstallationId", - principalTable: "Installations", - principalColumn: "Id"); - } - } -} diff --git a/backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.Designer.cs b/backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.Designer.cs deleted file mode 100644 index d90938647..000000000 --- a/backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.Designer.cs +++ /dev/null @@ -1,1369 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240112094731_AddRequiredFieldsToInspectionAndPoses")] - partial class AddRequiredFieldsToInspectionAndPoses - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.cs b/backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.cs deleted file mode 100644 index c051d4ba3..000000000 --- a/backend/api/Migrations/20240112094731_AddRequiredFieldsToInspectionAndPoses.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddRequiredFieldsToInspectionAndPoses : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "IsarStepId", - table: "Inspections", - type: "character varying(200)", - maxLength: 200, - nullable: false, - defaultValue: "", - oldClrType: typeof(string), - oldType: "character varying(200)", - oldMaxLength: 200, - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Z", - table: "Inspections", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Y", - table: "Inspections", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_X", - table: "Inspections", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "IsarStepId", - table: "Inspections", - type: "character varying(200)", - maxLength: 200, - nullable: true, - oldClrType: typeof(string), - oldType: "character varying(200)", - oldMaxLength: 200); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Z", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Y", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_X", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - } - } -} diff --git a/backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.Designer.cs b/backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.Designer.cs deleted file mode 100644 index 4ee9af0bf..000000000 --- a/backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.Designer.cs +++ /dev/null @@ -1,1368 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240126115524_MakeInspectionTargetOptional")] - partial class MakeInspectionTargetOptional - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget"); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.cs b/backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.cs deleted file mode 100644 index c2c44e500..000000000 --- a/backend/api/Migrations/20240126115524_MakeInspectionTargetOptional.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeInspectionTargetOptional : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "InspectionTarget_Z", - table: "MissionTasks", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Y", - table: "MissionTasks", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_X", - table: "MissionTasks", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "InspectionTarget_Z", - table: "MissionTasks", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Y", - table: "MissionTasks", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_X", - table: "MissionTasks", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - } - } -} diff --git a/backend/api/Migrations/20240129130002_AddMissionRunCounter.Designer.cs b/backend/api/Migrations/20240129130002_AddMissionRunCounter.Designer.cs deleted file mode 100644 index da1308201..000000000 --- a/backend/api/Migrations/20240129130002_AddMissionRunCounter.Designer.cs +++ /dev/null @@ -1,1372 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240129130002_AddMissionRunCounter")] - partial class AddMissionRunCounter - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunCount") - .HasColumnType("integer"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240129130002_AddMissionRunCounter.cs b/backend/api/Migrations/20240129130002_AddMissionRunCounter.cs deleted file mode 100644 index 73c67d983..000000000 --- a/backend/api/Migrations/20240129130002_AddMissionRunCounter.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddMissionRunCounter : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "MissionRunCount", - table: "MissionRuns", - type: "integer", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "MissionRunCount", - table: "MissionRuns"); - } - } -} diff --git a/backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.Designer.cs b/backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.Designer.cs deleted file mode 100644 index f781cbd17..000000000 --- a/backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.Designer.cs +++ /dev/null @@ -1,1370 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240129154746_MakeInspectionTargetRequired")] - partial class MakeInspectionTargetRequired - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.cs b/backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.cs deleted file mode 100644 index f0123595d..000000000 --- a/backend/api/Migrations/20240129154746_MakeInspectionTargetRequired.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MakeInspectionTargetRequired : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "InspectionTarget_Z", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Y", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_X", - table: "Inspections", - type: "real", - nullable: false, - defaultValue: 0f, - oldClrType: typeof(float), - oldType: "real", - oldNullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "InspectionTarget_Z", - table: "Inspections", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_Y", - table: "Inspections", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - - migrationBuilder.AlterColumn( - name: "InspectionTarget_X", - table: "Inspections", - type: "real", - nullable: true, - oldClrType: typeof(float), - oldType: "real"); - } - } -} diff --git a/backend/api/Migrations/20240207145750_RemoveMissionRunCounter.Designer.cs b/backend/api/Migrations/20240207145750_RemoveMissionRunCounter.Designer.cs deleted file mode 100644 index 3f9fac595..000000000 --- a/backend/api/Migrations/20240207145750_RemoveMissionRunCounter.Designer.cs +++ /dev/null @@ -1,1369 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240207145750_RemoveMissionRunCounter")] - partial class RemoveMissionRunCounter - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - }); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("InspectionTarget"); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240207145750_RemoveMissionRunCounter.cs b/backend/api/Migrations/20240207145750_RemoveMissionRunCounter.cs deleted file mode 100644 index a9d8e1296..000000000 --- a/backend/api/Migrations/20240207145750_RemoveMissionRunCounter.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RemoveMissionRunCounter : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "MissionRunCount", - table: "MissionRuns"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "MissionRunCount", - table: "MissionRuns", - type: "integer", - nullable: false, - defaultValue: 0); - } - } -} diff --git a/backend/api/Migrations/20240208092245_RemoveInspectionTarget.Designer.cs b/backend/api/Migrations/20240208092245_RemoveInspectionTarget.Designer.cs deleted file mode 100644 index 3c93dd768..000000000 --- a/backend/api/Migrations/20240208092245_RemoveInspectionTarget.Designer.cs +++ /dev/null @@ -1,1345 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240208092245_RemoveInspectionTarget")] - partial class RemoveInspectionTarget - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240208092245_RemoveInspectionTarget.cs b/backend/api/Migrations/20240208092245_RemoveInspectionTarget.cs deleted file mode 100644 index 49054ccec..000000000 --- a/backend/api/Migrations/20240208092245_RemoveInspectionTarget.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RemoveInspectionTarget : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "InspectionTarget_X", - table: "MissionTasks"); - - migrationBuilder.DropColumn( - name: "InspectionTarget_Y", - table: "MissionTasks"); - - migrationBuilder.DropColumn( - name: "InspectionTarget_Z", - table: "MissionTasks"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "InspectionTarget_X", - table: "MissionTasks", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "InspectionTarget_Y", - table: "MissionTasks", - type: "real", - nullable: true); - - migrationBuilder.AddColumn( - name: "InspectionTarget_Z", - table: "MissionTasks", - type: "real", - nullable: true); - } - } -} diff --git a/backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.Designer.cs b/backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.Designer.cs deleted file mode 100644 index 2be292cf7..000000000 --- a/backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.Designer.cs +++ /dev/null @@ -1,1345 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome")] - partial class RenameMissionTaskTypeFromDriveToToReturnHome - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Enabled") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.cs b/backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.cs deleted file mode 100644 index e7977e61b..000000000 --- a/backend/api/Migrations/20240304135031_RenameMissionTaskTypeFromDriveToToReturnHome.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RenameMissionTaskTypeFromDriveToToReturnHome : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/backend/api/Migrations/20240322094856_RenameRobotEnabled.Designer.cs b/backend/api/Migrations/20240322094856_RenameRobotEnabled.Designer.cs deleted file mode 100644 index 8fa5a3750..000000000 --- a/backend/api/Migrations/20240322094856_RenameRobotEnabled.Designer.cs +++ /dev/null @@ -1,1345 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240322094856_RenameRobotEnabled")] - partial class RenameRobotEnabled - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240322094856_RenameRobotEnabled.cs b/backend/api/Migrations/20240322094856_RenameRobotEnabled.cs deleted file mode 100644 index 82c63625f..000000000 --- a/backend/api/Migrations/20240322094856_RenameRobotEnabled.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RenameRobotEnabled : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "Enabled", - table: "Robots", - newName: "IsarConnected"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "IsarConnected", - table: "Robots", - newName: "Enabled"); - } - } -} diff --git a/backend/api/Migrations/20240322141359_AddDeprecatedToRobot.Designer.cs b/backend/api/Migrations/20240322141359_AddDeprecatedToRobot.Designer.cs deleted file mode 100644 index c0fe60737..000000000 --- a/backend/api/Migrations/20240322141359_AddDeprecatedToRobot.Designer.cs +++ /dev/null @@ -1,1348 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240322141359_AddDeprecatedToRobot")] - partial class AddDeprecatedToRobot - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240322141359_AddDeprecatedToRobot.cs b/backend/api/Migrations/20240322141359_AddDeprecatedToRobot.cs deleted file mode 100644 index 354a9f640..000000000 --- a/backend/api/Migrations/20240322141359_AddDeprecatedToRobot.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddDeprecatedToRobot : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Deprecated", - table: "Robots", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Deprecated", - table: "Robots"); - } - } -} diff --git a/backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.Designer.cs b/backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.Designer.cs deleted file mode 100644 index e49a34a82..000000000 --- a/backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.Designer.cs +++ /dev/null @@ -1,1351 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240403071238_AddRobotCapabilitesToRobot")] - partial class AddRobotCapabilitesToRobot - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunPriority") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.cs b/backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.cs deleted file mode 100644 index 99ba9be42..000000000 --- a/backend/api/Migrations/20240403071238_AddRobotCapabilitesToRobot.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddRobotCapabilitesToRobot : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "RobotCapabilities", - table: "Robots", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "RobotCapabilities", - table: "Robots"); - } - } -} diff --git a/backend/api/Migrations/20240412093857_AddMissionRunType.Designer.cs b/backend/api/Migrations/20240412093857_AddMissionRunType.Designer.cs deleted file mode 100644 index 3497dd277..000000000 --- a/backend/api/Migrations/20240412093857_AddMissionRunType.Designer.cs +++ /dev/null @@ -1,1351 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240412093857_AddMissionRunType")] - partial class AddMissionRunType - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240412093857_AddMissionRunType.cs b/backend/api/Migrations/20240412093857_AddMissionRunType.cs deleted file mode 100644 index 7a0503650..000000000 --- a/backend/api/Migrations/20240412093857_AddMissionRunType.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddMissionRunType : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "MissionRunPriority", - table: "MissionRuns", - newName: "MissionRunType"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "MissionRunType", - table: "MissionRuns", - newName: "MissionRunPriority"); - } - } -} diff --git a/backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.Designer.cs b/backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.Designer.cs deleted file mode 100644 index db87d45d9..000000000 --- a/backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.Designer.cs +++ /dev/null @@ -1,1354 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240716132916_AddDockToDefaultLocalisationPose")] - partial class AddDockToDefaultLocalisationPose - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DockingEnabled") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.cs b/backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.cs deleted file mode 100644 index 3a0dd72be..000000000 --- a/backend/api/Migrations/20240716132916_AddDockToDefaultLocalisationPose.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddDockToDefaultLocalisationPose : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "DockingEnabled", - table: "DefaultLocalizationPoses", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DockingEnabled", - table: "DefaultLocalizationPoses"); - } - } -} diff --git a/backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.Designer.cs b/backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.Designer.cs deleted file mode 100644 index 0e3bdca26..000000000 --- a/backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.Designer.cs +++ /dev/null @@ -1,1357 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240717092121_AddMissionRunIsDeprecated")] - partial class AddMissionRunIsDeprecated - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DockingEnabled") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.cs b/backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.cs deleted file mode 100644 index f2c392bb1..000000000 --- a/backend/api/Migrations/20240717092121_AddMissionRunIsDeprecated.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddMissionRunIsDeprecated : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IsDeprecated", - table: "MissionRuns", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IsDeprecated", - table: "MissionRuns"); - } - } -} diff --git a/backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.Designer.cs b/backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.Designer.cs deleted file mode 100644 index f0beacf1c..000000000 --- a/backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.Designer.cs +++ /dev/null @@ -1,1361 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240724102244_AddRobotFlotillaStatus")] - partial class AddRobotFlotillaStatus - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DockingEnabled") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("FlotillaStatus") - .IsRequired() - .HasColumnType("text"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.cs b/backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.cs deleted file mode 100644 index 1aa34aa5d..000000000 --- a/backend/api/Migrations/20240724102244_AddRobotFlotillaStatus.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddRobotFlotillaStatus : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "FlotillaStatus", - table: "Robots", - type: "text", - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "FlotillaStatus", - table: "Robots"); - } - } -} diff --git a/backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.Designer.cs b/backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.Designer.cs deleted file mode 100644 index 880f0878d..000000000 --- a/backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.Designer.cs +++ /dev/null @@ -1,1360 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240726090053_MoveCustomMissionTasksToSourceTable")] - partial class MoveCustomMissionTasksToSourceTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DockingEnabled") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("CustomMissionTasks") - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.cs b/backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.cs deleted file mode 100644 index 11196e598..000000000 --- a/backend/api/Migrations/20240726090053_MoveCustomMissionTasksToSourceTable.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class MoveCustomMissionTasksToSourceTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "CustomMissionTasks", - table: "Sources", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "CustomMissionTasks", - table: "Sources"); - } - } -} diff --git a/backend/api/Migrations/20240813114738_AddUserInfoTable.Designer.cs b/backend/api/Migrations/20240813114738_AddUserInfoTable.Designer.cs deleted file mode 100644 index fee0147ab..000000000 --- a/backend/api/Migrations/20240813114738_AddUserInfoTable.Designer.cs +++ /dev/null @@ -1,1379 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240813114738_AddUserInfoTable")] - partial class AddUserInfoTable - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DockingEnabled") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EchoPoseId") - .HasColumnType("integer"); - - b.Property("EchoTagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("FlotillaStatus") - .IsRequired() - .HasColumnType("text"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("CustomMissionTasks") - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.UserInfo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Oid") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("UserInfos"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240813114738_AddUserInfoTable.cs b/backend/api/Migrations/20240813114738_AddUserInfoTable.cs deleted file mode 100644 index 7ab31d85d..000000000 --- a/backend/api/Migrations/20240813114738_AddUserInfoTable.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddUserInfoTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "UserInfos", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Oid = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserInfos", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "UserInfos"); - } - } -} diff --git a/backend/api/Migrations/20240829080813_RenameEchoProperties.Designer.cs b/backend/api/Migrations/20240829080813_RenameEchoProperties.Designer.cs deleted file mode 100644 index 13b242a9c..000000000 --- a/backend/api/Migrations/20240829080813_RenameEchoProperties.Designer.cs +++ /dev/null @@ -1,1375 +0,0 @@ -// -using System; -using Api.Database.Context; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace Api.Migrations -{ - [DbContext(typeof(FlotillaDbContext))] - [Migration("20240829080813_RenameEchoProperties")] - partial class RenameEchoProperties - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AccessLevel") - .IsRequired() - .HasColumnType("text"); - - b.Property("InstallationId") - .HasColumnType("text"); - - b.Property("RoleName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.ToTable("AccessRoles"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DeckId") - .IsRequired() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DeckId"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("DefaultLocalizationPoseId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Decks"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("DockingEnabled") - .HasColumnType("boolean"); - - b.HasKey("Id"); - - b.ToTable("DefaultLocalizationPoses"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AnalysisType") - .HasColumnType("text"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarStepId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionTaskId") - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("MissionTaskId"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Finding") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionDate") - .HasColumnType("timestamp with time zone"); - - b.Property("InspectionId") - .HasColumnType("text"); - - b.Property("IsarStepId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("InspectionId"); - - b.ToTable("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.Installation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationCode") - .IsUnique(); - - b.ToTable("Installations"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionFrequency") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("LastSuccessfulRunId") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("Description") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.Property("DesiredStartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("EstimatedDuration") - .HasColumnType("bigint"); - - b.Property("InstallationCode") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsDeprecated") - .HasColumnType("boolean"); - - b.Property("IsarMissionId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("MissionRunType") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("StatusReason") - .HasMaxLength(450) - .HasColumnType("character varying(450)"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.HasIndex("RobotId"); - - b.ToTable("MissionRuns"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Description") - .HasMaxLength(500) - .HasColumnType("character varying(500)"); - - b.Property("EndTime") - .HasColumnType("timestamp with time zone"); - - b.Property("IsarTaskId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionRunId") - .HasColumnType("text"); - - b.Property("PoseId") - .HasColumnType("integer"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("TagId") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TagLink") - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("TaskOrder") - .HasColumnType("integer"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("MissionRunId"); - - b.ToTable("MissionTasks"); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("InstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("PlantCode") - .IsRequired() - .HasMaxLength(10) - .HasColumnType("character varying(10)"); - - b.HasKey("Id"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantCode") - .IsUnique(); - - b.ToTable("Plants"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("CurrentAreaId") - .HasColumnType("text"); - - b.Property("CurrentInstallationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CurrentMissionId") - .HasColumnType("text"); - - b.Property("Deprecated") - .HasColumnType("boolean"); - - b.Property("FlotillaStatus") - .IsRequired() - .HasColumnType("text"); - - b.Property("Host") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarConnected") - .HasColumnType("boolean"); - - b.Property("IsarId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("MissionQueueFrozen") - .HasColumnType("boolean"); - - b.Property("ModelId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Port") - .HasColumnType("integer"); - - b.Property("PressureLevel") - .HasColumnType("real"); - - b.Property("RobotCapabilities") - .HasColumnType("text"); - - b.Property("SerialNumber") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CurrentAreaId"); - - b.HasIndex("CurrentInstallationId"); - - b.HasIndex("ModelId"); - - b.ToTable("Robots"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotBatteryTimeseries", b => - { - b.Property("BatteryLevel") - .HasColumnType("real"); - - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotBatteryTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotModel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AverageDurationPerTag") - .HasColumnType("real"); - - b.Property("BatteryWarningThreshold") - .HasColumnType("real"); - - b.Property("LowerPressureWarningThreshold") - .HasColumnType("real"); - - b.Property("Type") - .IsRequired() - .HasColumnType("text"); - - b.Property("UpperPressureWarningThreshold") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.HasIndex("Type") - .IsUnique(); - - b.ToTable("RobotModels"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPoseTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("OrientationW") - .HasColumnType("real"); - - b.Property("OrientationX") - .HasColumnType("real"); - - b.Property("OrientationY") - .HasColumnType("real"); - - b.Property("OrientationZ") - .HasColumnType("real"); - - b.Property("PositionX") - .HasColumnType("real"); - - b.Property("PositionY") - .HasColumnType("real"); - - b.Property("PositionZ") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPoseTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.RobotPressureTimeseries", b => - { - b.Property("MissionId") - .HasColumnType("text"); - - b.Property("Pressure") - .HasColumnType("real"); - - b.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b.Property("Time") - .HasColumnType("timestamp with time zone"); - - b.ToTable("RobotPressureTimeseries"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("AreaId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("AreaId"); - - b.ToTable("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Source", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("CustomMissionTasks") - .HasColumnType("text"); - - b.Property("SourceId") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Sources"); - }); - - modelBuilder.Entity("Api.Database.Models.UserInfo", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b.Property("Oid") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("UserInfos"); - }); - - modelBuilder.Entity("Api.Database.Models.AccessRole", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId"); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.HasOne("Api.Database.Models.Deck", "Deck") - .WithMany() - .HasForeignKey("DeckId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "MapMetadata", b1 => - { - b1.Property("AreaId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("AreaId"); - - b1.ToTable("Areas"); - - b1.WithOwner() - .HasForeignKey("AreaId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataAreaId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataAreaId"); - - b2.ToTable("Areas"); - - b2.WithOwner() - .HasForeignKey("MapMetadataAreaId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Deck"); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.Deck", b => - { - b.HasOne("Api.Database.Models.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Api.Database.Models.Plant", "Plant") - .WithMany() - .HasForeignKey("PlantId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("DefaultLocalizationPose"); - - b.Navigation("Installation"); - - b.Navigation("Plant"); - }); - - modelBuilder.Entity("Api.Database.Models.DefaultLocalizationPose", b => - { - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b1.HasKey("DefaultLocalizationPoseId"); - - b1.ToTable("DefaultLocalizationPoses"); - - b1.WithOwner() - .HasForeignKey("DefaultLocalizationPoseId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseDefaultLocalizationPoseId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseDefaultLocalizationPoseId"); - - b2.ToTable("DefaultLocalizationPoses"); - - b2.WithOwner() - .HasForeignKey("PoseDefaultLocalizationPoseId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => - { - b1.Property("InspectionId") - .HasColumnType("text"); - - b1.Property("X") - .HasColumnType("real"); - - b1.Property("Y") - .HasColumnType("real"); - - b1.Property("Z") - .HasColumnType("real"); - - b1.HasKey("InspectionId"); - - b1.ToTable("Inspections"); - - b1.WithOwner() - .HasForeignKey("InspectionId"); - }); - - b.Navigation("InspectionTarget") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionFinding", b => - { - b.HasOne("Api.Database.Models.Inspection", null) - .WithMany("InspectionFindings") - .HasForeignKey("InspectionId"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionDefinition", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.MissionRun", "LastSuccessfulRun") - .WithMany() - .HasForeignKey("LastSuccessfulRunId"); - - b.HasOne("Api.Database.Models.Source", "Source") - .WithMany() - .HasForeignKey("SourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Area"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Area", "Area") - .WithMany() - .HasForeignKey("AreaId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionRunId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionRunId"); - - b1.ToTable("MissionRuns"); - - b1.WithOwner() - .HasForeignKey("MissionRunId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("X1") - .HasColumnType("double precision"); - - b2.Property("X2") - .HasColumnType("double precision"); - - b2.Property("Y1") - .HasColumnType("double precision"); - - b2.Property("Y2") - .HasColumnType("double precision"); - - b2.Property("Z1") - .HasColumnType("double precision"); - - b2.Property("Z2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionRunId") - .HasColumnType("text"); - - b2.Property("C1") - .HasColumnType("double precision"); - - b2.Property("C2") - .HasColumnType("double precision"); - - b2.Property("D1") - .HasColumnType("double precision"); - - b2.Property("D2") - .HasColumnType("double precision"); - - b2.HasKey("MapMetadataMissionRunId"); - - b2.ToTable("MissionRuns"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionRunId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("Area"); - - b.Navigation("Map"); - - b.Navigation("Robot"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Database.Models.Pose", "RobotPose", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.HasKey("MissionTaskId"); - - b1.ToTable("MissionTasks"); - - b1.WithOwner() - .HasForeignKey("MissionTaskId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseMissionTaskId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseMissionTaskId"); - - b2.ToTable("MissionTasks"); - - b2.WithOwner() - .HasForeignKey("PoseMissionTaskId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("RobotPose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Plant", b => - { - b.HasOne("Api.Database.Models.Installation", "Installation") - .WithMany() - .HasForeignKey("InstallationId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Installation"); - }); - - modelBuilder.Entity("Api.Database.Models.Robot", b => - { - b.HasOne("Api.Database.Models.Area", "CurrentArea") - .WithMany() - .HasForeignKey("CurrentAreaId"); - - b.HasOne("Api.Database.Models.Installation", "CurrentInstallation") - .WithMany() - .HasForeignKey("CurrentInstallationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Api.Database.Models.RobotModel", "Model") - .WithMany() - .HasForeignKey("ModelId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("RobotId") - .HasColumnType("text"); - - b1.HasKey("RobotId"); - - b1.ToTable("Robots"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseRobotId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseRobotId"); - - b2.ToTable("Robots"); - - b2.WithOwner() - .HasForeignKey("PoseRobotId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => - { - b1.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("text"); - - b1.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.Property("RobotId") - .IsRequired() - .HasColumnType("text"); - - b1.Property("ShouldRotate270Clockwise") - .HasColumnType("boolean"); - - b1.Property("Type") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); - - b1.Property("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("VideoStream"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - b.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.SafePosition", b => - { - b.HasOne("Api.Database.Models.Area", null) - .WithMany("SafePositions") - .HasForeignKey("AreaId"); - - b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => - { - b1.Property("SafePositionId") - .HasColumnType("text"); - - b1.HasKey("SafePositionId"); - - b1.ToTable("SafePositions"); - - b1.WithOwner() - .HasForeignKey("SafePositionId"); - - b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("W") - .HasColumnType("real"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => - { - b2.Property("PoseSafePositionId") - .HasColumnType("text"); - - b2.Property("X") - .HasColumnType("real"); - - b2.Property("Y") - .HasColumnType("real"); - - b2.Property("Z") - .HasColumnType("real"); - - b2.HasKey("PoseSafePositionId"); - - b2.ToTable("SafePositions"); - - b2.WithOwner() - .HasForeignKey("PoseSafePositionId"); - }); - - b1.Navigation("Orientation") - .IsRequired(); - - b1.Navigation("Position") - .IsRequired(); - }); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Database.Models.Area", b => - { - b.Navigation("SafePositions"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20240829080813_RenameEchoProperties.cs b/backend/api/Migrations/20240829080813_RenameEchoProperties.cs deleted file mode 100644 index 89f01a532..000000000 --- a/backend/api/Migrations/20240829080813_RenameEchoProperties.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RenameEchoProperties : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Type", - table: "Sources"); - - migrationBuilder.RenameColumn( - name: "EchoTagLink", - table: "MissionTasks", - newName: "TagLink"); - - migrationBuilder.RenameColumn( - name: "EchoPoseId", - table: "MissionTasks", - newName: "PoseId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "TagLink", - table: "MissionTasks", - newName: "EchoTagLink"); - - migrationBuilder.RenameColumn( - name: "PoseId", - table: "MissionTasks", - newName: "EchoPoseId"); - - migrationBuilder.AddColumn( - name: "Type", - table: "Sources", - type: "text", - nullable: false, - defaultValue: ""); - } - } -} diff --git a/backend/api/Migrations/20240910132840_AddDocumentationToRobot.cs b/backend/api/Migrations/20240910132840_AddDocumentationToRobot.cs deleted file mode 100644 index 1b7f2b49a..000000000 --- a/backend/api/Migrations/20240910132840_AddDocumentationToRobot.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddDocumentationToRobot : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "DocumentInfo", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - Url = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - RobotId = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DocumentInfo", x => x.Id); - table.ForeignKey( - name: "FK_DocumentInfo_Robots_RobotId", - column: x => x.RobotId, - principalTable: "Robots", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_DocumentInfo_RobotId", - table: "DocumentInfo", - column: "RobotId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "DocumentInfo"); - } - } -} diff --git a/backend/api/Migrations/20240910132840_AddDocumentationToRobot.Designer.cs b/backend/api/Migrations/20241017111347_AddMigrationsForNewDatabase.Designer.cs similarity index 98% rename from backend/api/Migrations/20240910132840_AddDocumentationToRobot.Designer.cs rename to backend/api/Migrations/20241017111347_AddMigrationsForNewDatabase.Designer.cs index b5fd5aed4..bbc75081f 100644 --- a/backend/api/Migrations/20240910132840_AddDocumentationToRobot.Designer.cs +++ b/backend/api/Migrations/20241017111347_AddMigrationsForNewDatabase.Designer.cs @@ -12,15 +12,15 @@ namespace Api.Migrations { [DbContext(typeof(FlotillaDbContext))] - [Migration("20240910132840_AddDocumentationToRobot")] - partial class AddDocumentationToRobot + [Migration("20241017111347_AddMigrationsForNewDatabase")] + partial class AddMigrationsForNewDatabase { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("ProductVersion", "8.0.7") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -155,14 +155,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .HasMaxLength(250) .HasColumnType("character varying(250)"); - b.Property("IsarStepId") + b.Property("IsarTaskId") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); - b.Property("MissionTaskId") - .HasColumnType("text"); - b.Property("StartTime") .HasColumnType("timestamp with time zone"); @@ -175,8 +172,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("MissionTaskId"); - b.ToTable("Inspections"); }); @@ -196,7 +191,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("InspectionId") .HasColumnType("text"); - b.Property("IsarStepId") + b.Property("IsarTaskId") .IsRequired() .HasColumnType("text"); @@ -366,6 +361,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("EndTime") .HasColumnType("timestamp with time zone"); + b.Property("InspectionId") + .HasColumnType("text"); + b.Property("IsarTaskId") .HasMaxLength(200) .HasColumnType("character varying(200)"); @@ -400,6 +398,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("InspectionId"); + b.HasIndex("MissionRunId"); b.ToTable("MissionTasks"); @@ -890,10 +890,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Api.Database.Models.Inspection", b => { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => { b1.Property("InspectionId") @@ -1055,6 +1051,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("Api.Database.Models.MissionTask", b => { + b.HasOne("Api.Database.Models.Inspection", "Inspection") + .WithMany() + .HasForeignKey("InspectionId"); + b.HasOne("Api.Database.Models.MissionRun", null) .WithMany("Tasks") .HasForeignKey("MissionRunId"); @@ -1125,6 +1125,8 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsRequired(); }); + b.Navigation("Inspection"); + b.Navigation("RobotPose") .IsRequired(); }); @@ -1396,11 +1398,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { b.Navigation("Tasks"); }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); #pragma warning restore 612, 618 } } diff --git a/backend/api/Migrations/20231002084005_InitialCreate.cs b/backend/api/Migrations/20241017111347_AddMigrationsForNewDatabase.cs similarity index 72% rename from backend/api/Migrations/20231002084005_InitialCreate.cs rename to backend/api/Migrations/20241017111347_AddMigrationsForNewDatabase.cs index 7364a7fee..302448b0d 100644 --- a/backend/api/Migrations/20231002084005_InitialCreate.cs +++ b/backend/api/Migrations/20241017111347_AddMigrationsForNewDatabase.cs @@ -1,11 +1,12 @@ -using Microsoft.EntityFrameworkCore.Migrations; +using System; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Api.Migrations { /// - public partial class InitialCreate : Migration + public partial class AddMigrationsForNewDatabase : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -15,6 +16,47 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.Sql("CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"); // + migrationBuilder.CreateTable( + name: "DefaultLocalizationPoses", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + Pose_Position_X = table.Column(type: "real", nullable: false), + Pose_Position_Y = table.Column(type: "real", nullable: false), + Pose_Position_Z = table.Column(type: "real", nullable: false), + Pose_Orientation_X = table.Column(type: "real", nullable: false), + Pose_Orientation_Y = table.Column(type: "real", nullable: false), + Pose_Orientation_Z = table.Column(type: "real", nullable: false), + Pose_Orientation_W = table.Column(type: "real", nullable: false), + DockingEnabled = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DefaultLocalizationPoses", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Inspections", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + IsarTaskId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + InspectionTarget_X = table.Column(type: "real", nullable: false), + InspectionTarget_Y = table.Column(type: "real", nullable: false), + InspectionTarget_Z = table.Column(type: "real", nullable: false), + Status = table.Column(type: "text", nullable: false), + InspectionType = table.Column(type: "text", nullable: false), + VideoDuration = table.Column(type: "real", nullable: true), + AnalysisType = table.Column(type: "text", nullable: true), + InspectionUrl = table.Column(type: "character varying(250)", maxLength: 250, nullable: true), + StartTime = table.Column(type: "timestamp with time zone", nullable: true), + EndTime = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Inspections", x => x.Id); + }); + migrationBuilder.CreateTable( name: "Installations", columns: table => new @@ -33,14 +75,13 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { BatteryLevel = table.Column(type: "real", nullable: false), - Time = table.Column(type: "timestamp with time zone", nullable: false), + Time = table.Column(type: "timestamp with time zone", nullable: false), RobotId = table.Column(type: "text", nullable: false), MissionId = table.Column(type: "text", nullable: true) }, constraints: table => { }); - migrationBuilder.Sql( "SELECT create_hypertable( '\"RobotBatteryTimeseries\"', 'Time');\n" ); @@ -72,32 +113,29 @@ protected override void Up(MigrationBuilder migrationBuilder) OrientationY = table.Column(type: "real", nullable: false), OrientationZ = table.Column(type: "real", nullable: false), OrientationW = table.Column(type: "real", nullable: false), - Time = table.Column(type: "timestamp with time zone", nullable: false), + Time = table.Column(type: "timestamp with time zone", nullable: false), RobotId = table.Column(type: "text", nullable: false), MissionId = table.Column(type: "text", nullable: true) }, constraints: table => { }); - migrationBuilder.Sql( "SELECT create_hypertable( '\"RobotPoseTimeseries\"', 'Time');\n" ); - migrationBuilder.CreateTable( name: "RobotPressureTimeseries", columns: table => new { Pressure = table.Column(type: "real", nullable: false), - Time = table.Column(type: "timestamp with time zone", nullable: false), + Time = table.Column(type: "timestamp with time zone", nullable: false), RobotId = table.Column(type: "text", nullable: false), MissionId = table.Column(type: "text", nullable: true) }, constraints: table => { }); - migrationBuilder.Sql( "SELECT create_hypertable( '\"RobotPressureTimeseries\"', 'Time');\n" ); @@ -108,13 +146,64 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "text", nullable: false), SourceId = table.Column(type: "text", nullable: false), - Type = table.Column(type: "text", nullable: false) + CustomMissionTasks = table.Column(type: "text", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Sources", x => x.Id); }); + migrationBuilder.CreateTable( + name: "UserInfos", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + Oid = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_UserInfos", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "InspectionFindings", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + InspectionDate = table.Column(type: "timestamp with time zone", nullable: false), + IsarTaskId = table.Column(type: "text", nullable: false), + Finding = table.Column(type: "text", nullable: false), + InspectionId = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_InspectionFindings", x => x.Id); + table.ForeignKey( + name: "FK_InspectionFindings_Inspections_InspectionId", + column: x => x.InspectionId, + principalTable: "Inspections", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "AccessRoles", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + InstallationId = table.Column(type: "text", nullable: true), + RoleName = table.Column(type: "text", nullable: false), + AccessLevel = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AccessRoles", x => x.Id); + table.ForeignKey( + name: "FK_AccessRoles_Installations_InstallationId", + column: x => x.InstallationId, + principalTable: "Installations", + principalColumn: "Id"); + }); + migrationBuilder.CreateTable( name: "Plants", columns: table => new @@ -142,11 +231,17 @@ protected override void Up(MigrationBuilder migrationBuilder) Id = table.Column(type: "text", nullable: false), PlantId = table.Column(type: "text", nullable: false), InstallationId = table.Column(type: "text", nullable: false), + DefaultLocalizationPoseId = table.Column(type: "text", nullable: true), Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) }, constraints: table => { table.PrimaryKey("PK_Decks", x => x.Id); + table.ForeignKey( + name: "FK_Decks_DefaultLocalizationPoses_DefaultLocalizationPoseId", + column: x => x.DefaultLocalizationPoseId, + principalTable: "DefaultLocalizationPoses", + principalColumn: "Id"); table.ForeignKey( name: "FK_Decks_Installations_InstallationId", column: x => x.InstallationId, @@ -166,7 +261,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "text", nullable: false), - DeckId = table.Column(type: "text", nullable: true), + DeckId = table.Column(type: "text", nullable: false), PlantId = table.Column(type: "text", nullable: false), InstallationId = table.Column(type: "text", nullable: false), Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), @@ -181,13 +276,7 @@ protected override void Up(MigrationBuilder migrationBuilder) MapMetadata_TransformationMatrices_C2 = table.Column(type: "double precision", nullable: false), MapMetadata_TransformationMatrices_D1 = table.Column(type: "double precision", nullable: false), MapMetadata_TransformationMatrices_D2 = table.Column(type: "double precision", nullable: false), - DefaultLocalizationPose_Position_X = table.Column(type: "real", nullable: false), - DefaultLocalizationPose_Position_Y = table.Column(type: "real", nullable: false), - DefaultLocalizationPose_Position_Z = table.Column(type: "real", nullable: false), - DefaultLocalizationPose_Orientation_X = table.Column(type: "real", nullable: false), - DefaultLocalizationPose_Orientation_Y = table.Column(type: "real", nullable: false), - DefaultLocalizationPose_Orientation_Z = table.Column(type: "real", nullable: false), - DefaultLocalizationPose_Orientation_W = table.Column(type: "real", nullable: false) + DefaultLocalizationPoseId = table.Column(type: "text", nullable: true) }, constraints: table => { @@ -198,6 +287,11 @@ protected override void Up(MigrationBuilder migrationBuilder) principalTable: "Decks", principalColumn: "Id", onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Areas_DefaultLocalizationPoses_DefaultLocalizationPoseId", + column: x => x.DefaultLocalizationPoseId, + principalTable: "DefaultLocalizationPoses", + principalColumn: "Id"); table.ForeignKey( name: "FK_Areas_Installations_InstallationId", column: x => x.InstallationId, @@ -221,14 +315,18 @@ protected override void Up(MigrationBuilder migrationBuilder) IsarId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), ModelId = table.Column(type: "text", nullable: false), SerialNumber = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - CurrentInstallation = table.Column(type: "text", nullable: false), + CurrentInstallationId = table.Column(type: "text", nullable: false), CurrentAreaId = table.Column(type: "text", nullable: true), BatteryLevel = table.Column(type: "real", nullable: false), PressureLevel = table.Column(type: "real", nullable: true), Host = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), Port = table.Column(type: "integer", nullable: false), - Enabled = table.Column(type: "boolean", nullable: false), + RobotCapabilities = table.Column(type: "text", nullable: true), + IsarConnected = table.Column(type: "boolean", nullable: false), + Deprecated = table.Column(type: "boolean", nullable: false), + MissionQueueFrozen = table.Column(type: "boolean", nullable: false), Status = table.Column(type: "text", nullable: false), + FlotillaStatus = table.Column(type: "text", nullable: false), Pose_Position_X = table.Column(type: "real", nullable: false), Pose_Position_Y = table.Column(type: "real", nullable: false), Pose_Position_Z = table.Column(type: "real", nullable: false), @@ -246,6 +344,12 @@ protected override void Up(MigrationBuilder migrationBuilder) column: x => x.CurrentAreaId, principalTable: "Areas", principalColumn: "Id"); + table.ForeignKey( + name: "FK_Robots_Installations_CurrentInstallationId", + column: x => x.CurrentInstallationId, + principalTable: "Installations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Robots_RobotModels_ModelId", column: x => x.ModelId, @@ -278,22 +382,42 @@ protected override void Up(MigrationBuilder migrationBuilder) principalColumn: "Id"); }); + migrationBuilder.CreateTable( + name: "DocumentInfo", + columns: table => new + { + Id = table.Column(type: "text", nullable: false), + Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + Url = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + RobotId = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DocumentInfo", x => x.Id); + table.ForeignKey( + name: "FK_DocumentInfo_Robots_RobotId", + column: x => x.RobotId, + principalTable: "Robots", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "MissionRuns", columns: table => new { Id = table.Column(type: "text", nullable: false), MissionId = table.Column(type: "text", nullable: true), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), Status = table.Column(type: "text", nullable: false), InstallationCode = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - DesiredStartTime = table.Column(type: "timestamp with time zone", nullable: false), + DesiredStartTime = table.Column(type: "timestamp with time zone", nullable: false), RobotId = table.Column(type: "text", nullable: false), + MissionRunType = table.Column(type: "text", nullable: false), IsarMissionId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), Description = table.Column(type: "character varying(450)", maxLength: 450, nullable: true), StatusReason = table.Column(type: "character varying(450)", maxLength: 450, nullable: true), Comment = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), - AreaId = table.Column(type: "text", nullable: true), + AreaId = table.Column(type: "text", nullable: false), Map_MapName = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), Map_Boundary_X1 = table.Column(type: "double precision", nullable: true), Map_Boundary_X2 = table.Column(type: "double precision", nullable: true), @@ -305,9 +429,11 @@ protected override void Up(MigrationBuilder migrationBuilder) Map_TransformationMatrices_C2 = table.Column(type: "double precision", nullable: true), Map_TransformationMatrices_D1 = table.Column(type: "double precision", nullable: true), Map_TransformationMatrices_D2 = table.Column(type: "double precision", nullable: true), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - EstimatedDuration = table.Column(type: "bigint", nullable: true) + StartTime = table.Column(type: "timestamp with time zone", nullable: true), + EndTime = table.Column(type: "timestamp with time zone", nullable: true), + EstimatedDuration = table.Column(type: "bigint", nullable: true), + Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + IsDeprecated = table.Column(type: "boolean", nullable: false) }, constraints: table => { @@ -316,7 +442,8 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK_MissionRuns_Areas_AreaId", column: x => x.AreaId, principalTable: "Areas", - principalColumn: "Id"); + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_MissionRuns_Robots_RobotId", column: x => x.RobotId, @@ -357,8 +484,8 @@ protected override void Up(MigrationBuilder migrationBuilder) InstallationCode = table.Column(type: "text", nullable: false), Comment = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), InspectionFrequency = table.Column(type: "bigint", nullable: true), - LastRunId = table.Column(type: "text", nullable: true), - AreaId = table.Column(type: "text", nullable: true), + LastSuccessfulRunId = table.Column(type: "text", nullable: true), + AreaId = table.Column(type: "text", nullable: false), IsDeprecated = table.Column(type: "boolean", nullable: false) }, constraints: table => @@ -368,10 +495,11 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "FK_MissionDefinitions_Areas_AreaId", column: x => x.AreaId, principalTable: "Areas", - principalColumn: "Id"); + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_MissionDefinitions_MissionRuns_LastRunId", - column: x => x.LastRunId, + name: "FK_MissionDefinitions_MissionRuns_LastSuccessfulRunId", + column: x => x.LastSuccessfulRunId, principalTable: "MissionRuns", principalColumn: "Id"); table.ForeignKey( @@ -383,18 +511,16 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "MissionTask", + name: "MissionTasks", columns: table => new { Id = table.Column(type: "text", nullable: false), IsarTaskId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), TaskOrder = table.Column(type: "integer", nullable: false), + Type = table.Column(type: "text", nullable: false), TagId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), - EchoTagLink = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - InspectionTarget_X = table.Column(type: "real", nullable: false), - InspectionTarget_Y = table.Column(type: "real", nullable: false), - InspectionTarget_Z = table.Column(type: "real", nullable: false), + TagLink = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), RobotPose_Position_X = table.Column(type: "real", nullable: false), RobotPose_Position_Y = table.Column(type: "real", nullable: false), RobotPose_Position_Z = table.Column(type: "real", nullable: false), @@ -402,54 +528,43 @@ protected override void Up(MigrationBuilder migrationBuilder) RobotPose_Orientation_Y = table.Column(type: "real", nullable: false), RobotPose_Orientation_Z = table.Column(type: "real", nullable: false), RobotPose_Orientation_W = table.Column(type: "real", nullable: false), - EchoPoseId = table.Column(type: "integer", nullable: true), + PoseId = table.Column(type: "integer", nullable: true), Status = table.Column(type: "text", nullable: false), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - MissionRunId = table.Column(type: "text", nullable: false) + StartTime = table.Column(type: "timestamp with time zone", nullable: true), + EndTime = table.Column(type: "timestamp with time zone", nullable: true), + InspectionId = table.Column(type: "text", nullable: true), + MissionRunId = table.Column(type: "text", nullable: true) }, constraints: table => { - table.PrimaryKey("PK_MissionTask", x => x.Id); + table.PrimaryKey("PK_MissionTasks", x => x.Id); table.ForeignKey( - name: "FK_MissionTask_MissionRuns_MissionRunId", + name: "FK_MissionTasks_Inspections_InspectionId", + column: x => x.InspectionId, + principalTable: "Inspections", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_MissionTasks_MissionRuns_MissionRunId", column: x => x.MissionRunId, principalTable: "MissionRuns", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); - migrationBuilder.CreateTable( - name: "Inspection", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - IsarStepId = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), - Status = table.Column(type: "text", nullable: false), - InspectionType = table.Column(type: "text", nullable: false), - VideoDuration = table.Column(type: "real", nullable: true), - AnalysisType = table.Column(type: "text", nullable: true), - InspectionUrl = table.Column(type: "character varying(250)", maxLength: 250, nullable: true), - StartTime = table.Column(type: "timestamp with time zone", nullable: true), - EndTime = table.Column(type: "timestamp with time zone", nullable: true), - MissionTaskId = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Inspection", x => x.Id); - table.ForeignKey( - name: "FK_Inspection_MissionTask_MissionTaskId", - column: x => x.MissionTaskId, - principalTable: "MissionTask", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); + migrationBuilder.CreateIndex( + name: "IX_AccessRoles_InstallationId", + table: "AccessRoles", + column: "InstallationId"); migrationBuilder.CreateIndex( name: "IX_Areas_DeckId", table: "Areas", column: "DeckId"); + migrationBuilder.CreateIndex( + name: "IX_Areas_DefaultLocalizationPoseId", + table: "Areas", + column: "DefaultLocalizationPoseId"); + migrationBuilder.CreateIndex( name: "IX_Areas_InstallationId", table: "Areas", @@ -460,6 +575,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Areas", column: "PlantId"); + migrationBuilder.CreateIndex( + name: "IX_Decks_DefaultLocalizationPoseId", + table: "Decks", + column: "DefaultLocalizationPoseId"); + migrationBuilder.CreateIndex( name: "IX_Decks_InstallationId", table: "Decks", @@ -471,9 +591,14 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "PlantId"); migrationBuilder.CreateIndex( - name: "IX_Inspection_MissionTaskId", - table: "Inspection", - column: "MissionTaskId"); + name: "IX_DocumentInfo_RobotId", + table: "DocumentInfo", + column: "RobotId"); + + migrationBuilder.CreateIndex( + name: "IX_InspectionFindings_InspectionId", + table: "InspectionFindings", + column: "InspectionId"); migrationBuilder.CreateIndex( name: "IX_Installations_InstallationCode", @@ -487,9 +612,9 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "AreaId"); migrationBuilder.CreateIndex( - name: "IX_MissionDefinitions_LastRunId", + name: "IX_MissionDefinitions_LastSuccessfulRunId", table: "MissionDefinitions", - column: "LastRunId"); + column: "LastSuccessfulRunId"); migrationBuilder.CreateIndex( name: "IX_MissionDefinitions_SourceId", @@ -507,8 +632,13 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "RobotId"); migrationBuilder.CreateIndex( - name: "IX_MissionTask_MissionRunId", - table: "MissionTask", + name: "IX_MissionTasks_InspectionId", + table: "MissionTasks", + column: "InspectionId"); + + migrationBuilder.CreateIndex( + name: "IX_MissionTasks_MissionRunId", + table: "MissionTasks", column: "MissionRunId"); migrationBuilder.CreateIndex( @@ -533,6 +663,11 @@ protected override void Up(MigrationBuilder migrationBuilder) table: "Robots", column: "CurrentAreaId"); + migrationBuilder.CreateIndex( + name: "IX_Robots_CurrentInstallationId", + table: "Robots", + column: "CurrentInstallationId"); + migrationBuilder.CreateIndex( name: "IX_Robots_ModelId", table: "Robots", @@ -553,11 +688,20 @@ protected override void Up(MigrationBuilder migrationBuilder) protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( - name: "Inspection"); + name: "AccessRoles"); + + migrationBuilder.DropTable( + name: "DocumentInfo"); + + migrationBuilder.DropTable( + name: "InspectionFindings"); migrationBuilder.DropTable( name: "MissionDefinitions"); + migrationBuilder.DropTable( + name: "MissionTasks"); + migrationBuilder.DropTable( name: "RobotBatteryTimeseries"); @@ -571,14 +715,17 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "SafePositions"); migrationBuilder.DropTable( - name: "VideoStream"); + name: "UserInfos"); migrationBuilder.DropTable( - name: "MissionTask"); + name: "VideoStream"); migrationBuilder.DropTable( name: "Sources"); + migrationBuilder.DropTable( + name: "Inspections"); + migrationBuilder.DropTable( name: "MissionRuns"); @@ -594,6 +741,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "Decks"); + migrationBuilder.DropTable( + name: "DefaultLocalizationPoses"); + migrationBuilder.DropTable( name: "Plants"); diff --git a/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs b/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs index e3972ee92..6b30116c7 100644 --- a/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs +++ b/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs @@ -152,14 +152,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(250) .HasColumnType("character varying(250)"); - b.Property("IsarStepId") + b.Property("IsarTaskId") .IsRequired() .HasMaxLength(200) .HasColumnType("character varying(200)"); - b.Property("MissionTaskId") - .HasColumnType("text"); - b.Property("StartTime") .HasColumnType("timestamp with time zone"); @@ -172,8 +169,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("MissionTaskId"); - b.ToTable("Inspections"); }); @@ -193,7 +188,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InspectionId") .HasColumnType("text"); - b.Property("IsarStepId") + b.Property("IsarTaskId") .IsRequired() .HasColumnType("text"); @@ -363,6 +358,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EndTime") .HasColumnType("timestamp with time zone"); + b.Property("InspectionId") + .HasColumnType("text"); + b.Property("IsarTaskId") .HasMaxLength(200) .HasColumnType("character varying(200)"); @@ -397,6 +395,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); + b.HasIndex("InspectionId"); + b.HasIndex("MissionRunId"); b.ToTable("MissionTasks"); @@ -887,10 +887,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Api.Database.Models.Inspection", b => { - b.HasOne("Api.Database.Models.MissionTask", null) - .WithMany("Inspections") - .HasForeignKey("MissionTaskId"); - b.OwnsOne("Api.Database.Models.Position", "InspectionTarget", b1 => { b1.Property("InspectionId") @@ -1052,6 +1048,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("Api.Database.Models.MissionTask", b => { + b.HasOne("Api.Database.Models.Inspection", "Inspection") + .WithMany() + .HasForeignKey("InspectionId"); + b.HasOne("Api.Database.Models.MissionRun", null) .WithMany("Tasks") .HasForeignKey("MissionRunId"); @@ -1122,6 +1122,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); + b.Navigation("Inspection"); + b.Navigation("RobotPose") .IsRequired(); }); @@ -1393,11 +1395,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Navigation("Tasks"); }); - - modelBuilder.Entity("Api.Database.Models.MissionTask", b => - { - b.Navigation("Inspections"); - }); #pragma warning restore 612, 618 } }