From 897b5cb2a768aec5f37ba0b654a33c4059168204 Mon Sep 17 00:00:00 2001 From: aestene Date: Fri, 17 Jan 2025 12:41:11 +0100 Subject: [PATCH 1/2] Remove timeseries from postgreSQL database This functionality has not been used and should thus be removed. In addition, it simplifies an upcoming implementation of postgreSQL database as part of tests. --- .../api/Controllers/TimeseriesController.cs | 111 -- .../api/Database/Context/FlotillaDbContext.cs | 7 - .../Database/Models/RobotBatteryTimeseries.cs | 12 - .../Database/Models/RobotPoseTimeseries.cs | 45 - .../Models/RobotPressureTimeseries.cs | 12 - backend/api/Database/Models/TimeseriesBase.cs | 17 - ...20241210093952_Reset-Structure.Designer.cs | 1310 ---------------- ..._AddInspectionTagMetadataTable.Designer.cs | 1369 ---------------- ...210115843_AddInspectionTagMetadataTable.cs | 54 - ...55_AddDescriptionToInspections.Designer.cs | 1372 ----------------- ...41210132255_AddDescriptionToInspections.cs | 28 - ...001_RemoveVideoStreamFromRobot.Designer.cs | 1332 ---------------- ...241211135001_RemoveVideoStreamFromRobot.cs | 48 - ...dIsarInspectionIdToInspections.Designer.cs | 1337 ---------------- ...081436_AddIsarInspectionIdToInspections.cs | 30 - ...eaInsteadOfAreaForLocalisation.Designer.cs | 1333 ---------------- ...pectionAreaInsteadOfAreaForLocalisation.cs | 408 ----- ...7085716_AddBatteryStateToRobot.Designer.cs | 1336 ---------------- .../20241217085716_AddBatteryStateToRobot.cs | 28 - ...253_RenameDeckToInspectionArea.Designer.cs | 1336 ---------------- ...241218142253_RenameDeckToInspectionArea.cs | 62 - ...8142700_RenameDeckTableToInspectionArea.cs | 238 --- ...093518_ResetDatabaseStructure.Designer.cs} | 76 +- ... 20250122093518_ResetDatabaseStructure.cs} | 226 +-- .../FlotillaDbContextModelSnapshot.cs | 72 - backend/api/Program.cs | 4 - backend/api/Services/TimeseriesService.cs | 340 ---- .../api/Services/TimeseriesServiceSqlLite.cs | 106 -- 28 files changed, 81 insertions(+), 12568 deletions(-) delete mode 100644 backend/api/Controllers/TimeseriesController.cs delete mode 100644 backend/api/Database/Models/RobotBatteryTimeseries.cs delete mode 100644 backend/api/Database/Models/RobotPoseTimeseries.cs delete mode 100644 backend/api/Database/Models/RobotPressureTimeseries.cs delete mode 100644 backend/api/Database/Models/TimeseriesBase.cs delete mode 100644 backend/api/Migrations/20241210093952_Reset-Structure.Designer.cs delete mode 100644 backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.Designer.cs delete mode 100644 backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.cs delete mode 100644 backend/api/Migrations/20241210132255_AddDescriptionToInspections.Designer.cs delete mode 100644 backend/api/Migrations/20241210132255_AddDescriptionToInspections.cs delete mode 100644 backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.Designer.cs delete mode 100644 backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.cs delete mode 100644 backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.Designer.cs delete mode 100644 backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.cs delete mode 100644 backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.Designer.cs delete mode 100644 backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.cs delete mode 100644 backend/api/Migrations/20241217085716_AddBatteryStateToRobot.Designer.cs delete mode 100644 backend/api/Migrations/20241217085716_AddBatteryStateToRobot.cs delete mode 100644 backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.Designer.cs delete mode 100644 backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.cs delete mode 100644 backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.cs rename backend/api/Migrations/{20241218142700_RenameDeckTableToInspectionArea.Designer.cs => 20250122093518_ResetDatabaseStructure.Designer.cs} (94%) rename backend/api/Migrations/{20241210093952_Reset-Structure.cs => 20250122093518_ResetDatabaseStructure.cs} (83%) delete mode 100644 backend/api/Services/TimeseriesService.cs delete mode 100644 backend/api/Services/TimeseriesServiceSqlLite.cs diff --git a/backend/api/Controllers/TimeseriesController.cs b/backend/api/Controllers/TimeseriesController.cs deleted file mode 100644 index c7ec9bb7d..000000000 --- a/backend/api/Controllers/TimeseriesController.cs +++ /dev/null @@ -1,111 +0,0 @@ -using Api.Controllers.Models; -using Api.Database.Models; -using Api.Services; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace Api.Controllers -{ - [ApiController] - [Route("timeseries")] - [Authorize(Roles = Role.Any)] - public class TimeseriesController( - ILogger logger, - ITimeseriesService timeseriesService - ) : ControllerBase - { - /// - /// Get pressure timeseries - /// - /// - /// This query gets a paginated response of entries of the pressure timeseries - /// - [HttpGet] - [Route("pressure")] - [Authorize(Roles = Role.Any)] - [ProducesResponseType(typeof(IList), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status401Unauthorized)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task>> GetPressureTimeseries( - [FromQuery] TimeseriesQueryStringParameters queryStringParameters - ) - { - try - { - var robotPressureTimeseries = - await timeseriesService.ReadAll(queryStringParameters); - return Ok(robotPressureTimeseries); - } - catch (Exception e) - { - logger.LogError(e, "Error during GET of robot pressure timeseries from database"); - throw; - } - } - - /// - /// Get battery timeseries - /// - /// - /// This query gets a paginated response of entries of the battery timeseries - /// - [HttpGet] - [Route("battery")] - [Authorize(Roles = Role.Any)] - [ProducesResponseType(typeof(IList), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status401Unauthorized)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task>> GetBatteryTimeseries( - [FromQuery] TimeseriesQueryStringParameters queryStringParameters - ) - { - try - { - var robotBatteryTimeseries = - await timeseriesService.ReadAll(queryStringParameters); - return Ok(robotBatteryTimeseries); - } - catch (Exception e) - { - logger.LogError(e, "Error during GET of robot battery timeseries from database"); - throw; - } - } - - /// - /// Get pose timeseries - /// - /// - /// This query gets a paginated response of entries of the pose timeseries - /// - [HttpGet] - [Route("pose")] - [Authorize(Roles = Role.Any)] - [ProducesResponseType(typeof(IList), StatusCodes.Status200OK)] - [ProducesResponseType(StatusCodes.Status400BadRequest)] - [ProducesResponseType(StatusCodes.Status401Unauthorized)] - [ProducesResponseType(StatusCodes.Status403Forbidden)] - [ProducesResponseType(StatusCodes.Status500InternalServerError)] - public async Task>> GetPoseTimeseries( - [FromQuery] TimeseriesQueryStringParameters queryStringParameters - ) - { - try - { - var robotPoseTimeseries = await timeseriesService.ReadAll( - queryStringParameters - ); - return Ok(robotPoseTimeseries); - } - catch (Exception e) - { - logger.LogError(e, "Error during GET of robot pose timeseries from database"); - throw; - } - } - } -} diff --git a/backend/api/Database/Context/FlotillaDbContext.cs b/backend/api/Database/Context/FlotillaDbContext.cs index c938a0699..802b376c1 100644 --- a/backend/api/Database/Context/FlotillaDbContext.cs +++ b/backend/api/Database/Context/FlotillaDbContext.cs @@ -33,13 +33,6 @@ public FlotillaDbContext(DbContextOptions options) public DbSet UserInfos => Set(); public DbSet TagInspectionMetadata => Set(); - // Timeseries: - public DbSet RobotPressureTimeseries => - Set(); - public DbSet RobotBatteryTimeseries => - Set(); - public DbSet RobotPoseTimeseries => Set(); - protected override void OnModelCreating(ModelBuilder modelBuilder) { bool isSqlLite = Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite"; diff --git a/backend/api/Database/Models/RobotBatteryTimeseries.cs b/backend/api/Database/Models/RobotBatteryTimeseries.cs deleted file mode 100644 index dff849623..000000000 --- a/backend/api/Database/Models/RobotBatteryTimeseries.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; - -namespace Api.Database.Models -{ - [Keyless] - public class RobotBatteryTimeseries : TimeseriesBase - { - [Required] - public float BatteryLevel { get; set; } - } -} diff --git a/backend/api/Database/Models/RobotPoseTimeseries.cs b/backend/api/Database/Models/RobotPoseTimeseries.cs deleted file mode 100644 index 0c659459a..000000000 --- a/backend/api/Database/Models/RobotPoseTimeseries.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; - -namespace Api.Database.Models -{ - // Cannot use Pose as owned entity in keyless entity - // https://learn.microsoft.com/en-us/ef/core/modeling/keyless-entity-types?tabs=data-annotations - [Keyless] - public class RobotPoseTimeseries : TimeseriesBase - { - [Required] - public float PositionX { get; set; } - - [Required] - public float PositionY { get; set; } - - [Required] - public float PositionZ { get; set; } - - [Required] - public float OrientationX { get; set; } - - [Required] - public float OrientationY { get; set; } - - [Required] - public float OrientationZ { get; set; } - - [Required] - public float OrientationW { get; set; } - - public RobotPoseTimeseries(Pose pose) - { - PositionX = pose.Position.X; - PositionY = pose.Position.Y; - PositionZ = pose.Position.Z; - OrientationX = pose.Orientation.X; - OrientationY = pose.Orientation.Y; - OrientationZ = pose.Orientation.Z; - OrientationW = pose.Orientation.W; - } - - public RobotPoseTimeseries() { } - } -} diff --git a/backend/api/Database/Models/RobotPressureTimeseries.cs b/backend/api/Database/Models/RobotPressureTimeseries.cs deleted file mode 100644 index 034d05747..000000000 --- a/backend/api/Database/Models/RobotPressureTimeseries.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; - -namespace Api.Database.Models -{ - [Keyless] - public class RobotPressureTimeseries : TimeseriesBase - { - [Required] - public float Pressure { get; set; } - } -} diff --git a/backend/api/Database/Models/TimeseriesBase.cs b/backend/api/Database/Models/TimeseriesBase.cs deleted file mode 100644 index 3adcdbbdb..000000000 --- a/backend/api/Database/Models/TimeseriesBase.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -#pragma warning disable CS8618 -namespace Api.Database.Models -{ - public class TimeseriesBase - { - [Required] - public DateTime Time { get; set; } - - [Required] - [ForeignKey(nameof(Robot))] - public string RobotId { get; set; } - - public string? MissionId { get; set; } - } -} diff --git a/backend/api/Migrations/20241210093952_Reset-Structure.Designer.cs b/backend/api/Migrations/20241210093952_Reset-Structure.Designer.cs deleted file mode 100644 index d68089023..000000000 --- a/backend/api/Migrations/20241210093952_Reset-Structure.Designer.cs +++ /dev/null @@ -1,1310 +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("20241210093952_Reset-Structure")] - partial class ResetStructure - { - /// - 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("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryMissionStartThreshold") - .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.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.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.Inspection", "Inspection") - .WithMany() - .HasForeignKey("InspectionId"); - - 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("Inspection"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.Designer.cs b/backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.Designer.cs deleted file mode 100644 index e08418de0..000000000 --- a/backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.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("20241210115843_AddInspectionTagMetadataTable")] - partial class AddInspectionTagMetadataTable - { - /// - 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("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.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.Inspection", "Inspection") - .WithMany() - .HasForeignKey("InspectionId"); - - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.cs b/backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.cs deleted file mode 100644 index cb9143a16..000000000 --- a/backend/api/Migrations/20241210115843_AddInspectionTagMetadataTable.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddInspectionTagMetadataTable : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IsarZoomDescription_ObjectHeight", - table: "MissionTasks", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "IsarZoomDescription_ObjectWidth", - table: "MissionTasks", - type: "double precision", - nullable: true); - - migrationBuilder.CreateTable( - name: "TagInspectionMetadata", - columns: table => new - { - TagId = table.Column(type: "text", nullable: false), - ZoomDescription_ObjectWidth = table.Column(type: "double precision", nullable: true), - ZoomDescription_ObjectHeight = table.Column(type: "double precision", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_TagInspectionMetadata", x => x.TagId); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "TagInspectionMetadata"); - - migrationBuilder.DropColumn( - name: "IsarZoomDescription_ObjectHeight", - table: "MissionTasks"); - - migrationBuilder.DropColumn( - name: "IsarZoomDescription_ObjectWidth", - table: "MissionTasks"); - } - } -} diff --git a/backend/api/Migrations/20241210132255_AddDescriptionToInspections.Designer.cs b/backend/api/Migrations/20241210132255_AddDescriptionToInspections.Designer.cs deleted file mode 100644 index a4975f720..000000000 --- a/backend/api/Migrations/20241210132255_AddDescriptionToInspections.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("20241210132255_AddDescriptionToInspections")] - partial class AddDescriptionToInspections - { - /// - 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("InspectionTargetName") - .HasColumnType("text"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.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.Inspection", "Inspection") - .WithMany() - .HasForeignKey("InspectionId"); - - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - - b.Navigation("VideoStreams"); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241210132255_AddDescriptionToInspections.cs b/backend/api/Migrations/20241210132255_AddDescriptionToInspections.cs deleted file mode 100644 index c5474a6dc..000000000 --- a/backend/api/Migrations/20241210132255_AddDescriptionToInspections.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddDescriptionToInspections : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "InspectionTargetName", - table: "Inspections", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "InspectionTargetName", - table: "Inspections"); - } - } -} diff --git a/backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.Designer.cs b/backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.Designer.cs deleted file mode 100644 index 6459d38ab..000000000 --- a/backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.Designer.cs +++ /dev/null @@ -1,1332 +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("20241211135001_RemoveVideoStreamFromRobot")] - partial class RemoveVideoStreamFromRobot - { - /// - 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("InspectionTargetName") - .HasColumnType("text"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.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.Inspection", "Inspection") - .WithMany() - .HasForeignKey("InspectionId"); - - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.cs b/backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.cs deleted file mode 100644 index ceec7a235..000000000 --- a/backend/api/Migrations/20241211135001_RemoveVideoStreamFromRobot.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RemoveVideoStreamFromRobot : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "VideoStream"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "VideoStream", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - Name = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), - RobotId = table.Column(type: "text", nullable: false), - ShouldRotate270Clockwise = table.Column(type: "boolean", nullable: false), - Type = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - Url = table.Column(type: "character varying(200)", maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_VideoStream", x => x.Id); - table.ForeignKey( - name: "FK_VideoStream_Robots_RobotId", - column: x => x.RobotId, - principalTable: "Robots", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_VideoStream_RobotId", - table: "VideoStream", - column: "RobotId"); - } - } -} diff --git a/backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.Designer.cs b/backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.Designer.cs deleted file mode 100644 index 7f32d0061..000000000 --- a/backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.Designer.cs +++ /dev/null @@ -1,1337 +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("20241213081436_AddIsarInspectionIdToInspections")] - partial class AddIsarInspectionIdToInspections - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .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("InspectionTargetName") - .HasColumnType("text"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarInspectionId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.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.Inspection", "Inspection") - .WithMany() - .HasForeignKey("InspectionId"); - - b.HasOne("Api.Database.Models.MissionRun", null) - .WithMany("Tasks") - .HasForeignKey("MissionRunId"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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.Navigation("CurrentArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.cs b/backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.cs deleted file mode 100644 index ad9c91025..000000000 --- a/backend/api/Migrations/20241213081436_AddIsarInspectionIdToInspections.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddIsarInspectionIdToInspections : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "IsarInspectionId", - table: "Inspections", - type: "character varying(200)", - maxLength: 200, - nullable: false, - defaultValue: ""); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "IsarInspectionId", - table: "Inspections"); - } - } -} diff --git a/backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.Designer.cs b/backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.Designer.cs deleted file mode 100644 index 1de4fe8ce..000000000 --- a/backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.Designer.cs +++ /dev/null @@ -1,1333 +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("20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation")] - partial class UseInspectionAreaInsteadOfAreaForLocalisation - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .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("InspectionTargetName") - .HasColumnType("text"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarInspectionId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionAreaId") - .HasColumnType("text"); - - 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("InspectionAreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .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("InspectionAreaId") - .HasColumnType("text"); - - 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("InspectionAreaId"); - - 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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("CurrentInspectionAreaId") - .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("CurrentInspectionAreaId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.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.Deck", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict); - - 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.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionDefinitionId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionDefinitionId"); - - b1.ToTable("MissionDefinitions"); - - b1.WithOwner() - .HasForeignKey("MissionDefinitionId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionDefinitionId") - .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("MapMetadataMissionDefinitionId"); - - b2.ToTable("MissionDefinitions"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionDefinitionId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionDefinitionId") - .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("MapMetadataMissionDefinitionId"); - - b2.ToTable("MissionDefinitions"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionDefinitionId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("InspectionArea"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Map"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Deck", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("InspectionArea"); - - b.Navigation("Robot"); - }); - - 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"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.Deck", "CurrentInspectionArea") - .WithMany() - .HasForeignKey("CurrentInspectionAreaId"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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.Navigation("CurrentInspectionArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.cs b/backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.cs deleted file mode 100644 index 145f7ffa7..000000000 --- a/backend/api/Migrations/20241216130006_UseInspectionAreaInsteadOfAreaForLocalisation.cs +++ /dev/null @@ -1,408 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class UseInspectionAreaInsteadOfAreaForLocalisation : 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.DropForeignKey( - name: "FK_Robots_Areas_CurrentAreaId", - table: "Robots"); - - migrationBuilder.DropIndex( - name: "IX_MissionRuns_AreaId", - table: "MissionRuns"); - - migrationBuilder.DropIndex( - name: "IX_MissionDefinitions_AreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "AreaId", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_X1", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_X2", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Y1", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Y2", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Z1", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Z2", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_MapName", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_C1", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_C2", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_D1", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_D2", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "AreaId", - table: "MissionDefinitions"); - - migrationBuilder.RenameColumn( - name: "CurrentAreaId", - table: "Robots", - newName: "CurrentInspectionAreaId"); - - migrationBuilder.RenameIndex( - name: "IX_Robots_CurrentAreaId", - table: "Robots", - newName: "IX_Robots_CurrentInspectionAreaId"); - - migrationBuilder.AddColumn( - name: "InspectionAreaId", - table: "MissionRuns", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "InspectionAreaId", - table: "MissionDefinitions", - type: "text", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_X1", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_X2", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Y1", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Y2", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Z1", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Z2", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_MapName", - table: "MissionDefinitions", - type: "character varying(200)", - maxLength: 200, - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_C1", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_C2", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_D1", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_D2", - table: "MissionDefinitions", - type: "double precision", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_MissionRuns_InspectionAreaId", - table: "MissionRuns", - column: "InspectionAreaId"); - - migrationBuilder.CreateIndex( - name: "IX_MissionDefinitions_InspectionAreaId", - table: "MissionDefinitions", - column: "InspectionAreaId"); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_Decks_InspectionAreaId", - table: "MissionDefinitions", - column: "InspectionAreaId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_MissionRuns_Decks_InspectionAreaId", - table: "MissionRuns", - column: "InspectionAreaId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_Decks_CurrentInspectionAreaId", - table: "Robots", - column: "CurrentInspectionAreaId", - principalTable: "Decks", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_Decks_InspectionAreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionRuns_Decks_InspectionAreaId", - table: "MissionRuns"); - - migrationBuilder.DropForeignKey( - name: "FK_Robots_Decks_CurrentInspectionAreaId", - table: "Robots"); - - migrationBuilder.DropIndex( - name: "IX_MissionRuns_InspectionAreaId", - table: "MissionRuns"); - - migrationBuilder.DropIndex( - name: "IX_MissionDefinitions_InspectionAreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "InspectionAreaId", - table: "MissionRuns"); - - migrationBuilder.DropColumn( - name: "InspectionAreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_X1", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_X2", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Y1", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Y2", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Z1", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_Boundary_Z2", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_MapName", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_C1", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_C2", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_D1", - table: "MissionDefinitions"); - - migrationBuilder.DropColumn( - name: "Map_TransformationMatrices_D2", - table: "MissionDefinitions"); - - migrationBuilder.RenameColumn( - name: "CurrentInspectionAreaId", - table: "Robots", - newName: "CurrentAreaId"); - - migrationBuilder.RenameIndex( - name: "IX_Robots_CurrentInspectionAreaId", - table: "Robots", - newName: "IX_Robots_CurrentAreaId"); - - migrationBuilder.AddColumn( - name: "AreaId", - table: "MissionRuns", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.AddColumn( - name: "Map_Boundary_X1", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_X2", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Y1", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Y2", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Z1", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_Boundary_Z2", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_MapName", - table: "MissionRuns", - type: "character varying(200)", - maxLength: 200, - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_C1", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_C2", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_D1", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "Map_TransformationMatrices_D2", - table: "MissionRuns", - type: "double precision", - nullable: true); - - migrationBuilder.AddColumn( - name: "AreaId", - table: "MissionDefinitions", - type: "text", - nullable: false, - defaultValue: ""); - - migrationBuilder.CreateIndex( - name: "IX_MissionRuns_AreaId", - table: "MissionRuns", - column: "AreaId"); - - migrationBuilder.CreateIndex( - name: "IX_MissionDefinitions_AreaId", - table: "MissionDefinitions", - column: "AreaId"); - - 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); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_Areas_CurrentAreaId", - table: "Robots", - column: "CurrentAreaId", - principalTable: "Areas", - principalColumn: "Id"); - } - } -} diff --git a/backend/api/Migrations/20241217085716_AddBatteryStateToRobot.Designer.cs b/backend/api/Migrations/20241217085716_AddBatteryStateToRobot.Designer.cs deleted file mode 100644 index 196fb7ad4..000000000 --- a/backend/api/Migrations/20241217085716_AddBatteryStateToRobot.Designer.cs +++ /dev/null @@ -1,1336 +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("20241217085716_AddBatteryStateToRobot")] - partial class AddBatteryStateToRobot - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .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("InspectionTargetName") - .HasColumnType("text"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarInspectionId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - 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("IsarTaskId") - .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("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionAreaId") - .HasColumnType("text"); - - 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("InspectionAreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .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("InspectionAreaId") - .HasColumnType("text"); - - 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("InspectionAreaId"); - - 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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryState") - .HasColumnType("text"); - - b.Property("CurrentInspectionAreaId") - .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("CurrentInspectionAreaId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.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.Deck", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict); - - 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.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionDefinitionId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionDefinitionId"); - - b1.ToTable("MissionDefinitions"); - - b1.WithOwner() - .HasForeignKey("MissionDefinitionId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionDefinitionId") - .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("MapMetadataMissionDefinitionId"); - - b2.ToTable("MissionDefinitions"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionDefinitionId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionDefinitionId") - .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("MapMetadataMissionDefinitionId"); - - b2.ToTable("MissionDefinitions"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionDefinitionId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("InspectionArea"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Map"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.Deck", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("InspectionArea"); - - b.Navigation("Robot"); - }); - - 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"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.Deck", "CurrentInspectionArea") - .WithMany() - .HasForeignKey("CurrentInspectionAreaId"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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.Navigation("CurrentInspectionArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241217085716_AddBatteryStateToRobot.cs b/backend/api/Migrations/20241217085716_AddBatteryStateToRobot.cs deleted file mode 100644 index 4e5e8ff66..000000000 --- a/backend/api/Migrations/20241217085716_AddBatteryStateToRobot.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class AddBatteryStateToRobot : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "BatteryState", - table: "Robots", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "BatteryState", - table: "Robots"); - } - } -} diff --git a/backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.Designer.cs b/backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.Designer.cs deleted file mode 100644 index bd4dc09f5..000000000 --- a/backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.Designer.cs +++ /dev/null @@ -1,1336 +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("20241218142253_RenameDeckToInspectionArea")] - partial class RenameDeckToInspectionArea - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "8.0.11") - .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("DefaultLocalizationPoseId") - .HasColumnType("text"); - - b.Property("InspectionAreaId") - .IsRequired() - .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("InspectionAreaId"); - - b.HasIndex("InstallationId"); - - b.HasIndex("PlantId"); - - b.ToTable("Areas"); - }); - - 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("InspectionTargetName") - .HasColumnType("text"); - - b.Property("InspectionType") - .IsRequired() - .HasColumnType("text"); - - b.Property("InspectionUrl") - .HasMaxLength(250) - .HasColumnType("character varying(250)"); - - b.Property("IsarInspectionId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("IsarTaskId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b.Property("StartTime") - .HasColumnType("timestamp with time zone"); - - b.Property("Status") - .IsRequired() - .HasColumnType("text"); - - b.Property("VideoDuration") - .HasColumnType("real"); - - b.HasKey("Id"); - - b.ToTable("Inspections"); - }); - - modelBuilder.Entity("Api.Database.Models.InspectionArea", 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.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("IsarTaskId") - .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("Comment") - .HasMaxLength(1000) - .HasColumnType("character varying(1000)"); - - b.Property("InspectionAreaId") - .HasColumnType("text"); - - 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("InspectionAreaId"); - - b.HasIndex("LastSuccessfulRunId"); - - b.HasIndex("SourceId"); - - b.ToTable("MissionDefinitions"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .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("InspectionAreaId") - .HasColumnType("text"); - - 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("InspectionAreaId"); - - 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("InspectionId") - .HasColumnType("text"); - - 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("InspectionId"); - - 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("BatteryState") - .HasColumnType("text"); - - b.Property("CurrentInspectionAreaId") - .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("CurrentInspectionAreaId"); - - 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("BatteryMissionStartThreshold") - .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.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.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.Property("TagId") - .HasColumnType("text"); - - b.HasKey("TagId"); - - b.ToTable("TagInspectionMetadata"); - }); - - 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.DefaultLocalizationPose", "DefaultLocalizationPose") - .WithMany() - .HasForeignKey("DefaultLocalizationPoseId"); - - b.HasOne("Api.Database.Models.InspectionArea", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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("DefaultLocalizationPose"); - - b.Navigation("InspectionArea"); - - b.Navigation("Installation"); - - b.Navigation("MapMetadata") - .IsRequired(); - - 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.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.InspectionArea", 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.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.InspectionArea", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict); - - 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.OwnsOne("Api.Database.Models.MapMetadata", "Map", b1 => - { - b1.Property("MissionDefinitionId") - .HasColumnType("text"); - - b1.Property("MapName") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("MissionDefinitionId"); - - b1.ToTable("MissionDefinitions"); - - b1.WithOwner() - .HasForeignKey("MissionDefinitionId"); - - b1.OwnsOne("Api.Database.Models.Boundary", "Boundary", b2 => - { - b2.Property("MapMetadataMissionDefinitionId") - .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("MapMetadataMissionDefinitionId"); - - b2.ToTable("MissionDefinitions"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionDefinitionId"); - }); - - b1.OwnsOne("Api.Database.Models.TransformationMatrices", "TransformationMatrices", b2 => - { - b2.Property("MapMetadataMissionDefinitionId") - .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("MapMetadataMissionDefinitionId"); - - b2.ToTable("MissionDefinitions"); - - b2.WithOwner() - .HasForeignKey("MapMetadataMissionDefinitionId"); - }); - - b1.Navigation("Boundary") - .IsRequired(); - - b1.Navigation("TransformationMatrices") - .IsRequired(); - }); - - b.Navigation("InspectionArea"); - - b.Navigation("LastSuccessfulRun"); - - b.Navigation("Map"); - - b.Navigation("Source"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.HasOne("Api.Database.Models.InspectionArea", "InspectionArea") - .WithMany() - .HasForeignKey("InspectionAreaId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Api.Database.Models.Robot", "Robot") - .WithMany() - .HasForeignKey("RobotId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("InspectionArea"); - - b.Navigation("Robot"); - }); - - 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"); - - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "IsarZoomDescription", b1 => - { - b1.Property("MissionTaskId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - 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("Inspection"); - - b.Navigation("IsarZoomDescription"); - - 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.InspectionArea", "CurrentInspectionArea") - .WithMany() - .HasForeignKey("CurrentInspectionAreaId"); - - 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.OwnsMany("Api.Database.Models.DocumentInfo", "Documentation", 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("Url") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("character varying(200)"); - - b1.HasKey("Id"); - - b1.HasIndex("RobotId"); - - b1.ToTable("DocumentInfo"); - - b1.WithOwner() - .HasForeignKey("RobotId"); - }); - - 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.Navigation("CurrentInspectionArea"); - - b.Navigation("CurrentInstallation"); - - b.Navigation("Documentation"); - - b.Navigation("Model"); - - b.Navigation("Pose") - .IsRequired(); - }); - - modelBuilder.Entity("Api.Services.MissionLoaders.TagInspectionMetadata", b => - { - b.OwnsOne("Api.Services.Models.IsarZoomDescription", "ZoomDescription", b1 => - { - b1.Property("TagInspectionMetadataTagId") - .HasColumnType("text"); - - b1.Property("ObjectHeight") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectHeight"); - - b1.Property("ObjectWidth") - .HasColumnType("double precision") - .HasAnnotation("Relational:JsonPropertyName", "objectWidth"); - - b1.HasKey("TagInspectionMetadataTagId"); - - b1.ToTable("TagInspectionMetadata"); - - b1.WithOwner() - .HasForeignKey("TagInspectionMetadataTagId"); - }); - - b.Navigation("ZoomDescription"); - }); - - modelBuilder.Entity("Api.Database.Models.Inspection", b => - { - b.Navigation("InspectionFindings"); - }); - - modelBuilder.Entity("Api.Database.Models.MissionRun", b => - { - b.Navigation("Tasks"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.cs b/backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.cs deleted file mode 100644 index 8abbafd22..000000000 --- a/backend/api/Migrations/20241218142253_RenameDeckToInspectionArea.cs +++ /dev/null @@ -1,62 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RenameDeckToInspectionArea : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Areas_Decks_DeckId", - table: "Areas"); - - migrationBuilder.RenameColumn( - name: "DeckId", - table: "Areas", - newName: "InspectionAreaId"); - - migrationBuilder.RenameIndex( - name: "IX_Areas_DeckId", - table: "Areas", - newName: "IX_Areas_InspectionAreaId"); - - migrationBuilder.AddForeignKey( - name: "FK_Areas_Decks_InspectionAreaId", - table: "Areas", - column: "InspectionAreaId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Areas_Decks_InspectionAreaId", - table: "Areas"); - - migrationBuilder.RenameColumn( - name: "InspectionAreaId", - table: "Areas", - newName: "DeckId"); - - migrationBuilder.RenameIndex( - name: "IX_Areas_InspectionAreaId", - table: "Areas", - newName: "IX_Areas_DeckId"); - - migrationBuilder.AddForeignKey( - name: "FK_Areas_Decks_DeckId", - table: "Areas", - column: "DeckId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.cs b/backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.cs deleted file mode 100644 index 764884be0..000000000 --- a/backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.cs +++ /dev/null @@ -1,238 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Api.Migrations -{ - /// - public partial class RenameDeckTableToInspectionArea : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Areas_Decks_InspectionAreaId", - table: "Areas"); - - migrationBuilder.DropForeignKey( - name: "FK_Decks_DefaultLocalizationPoses_DefaultLocalizationPoseId", - table: "Decks"); - - migrationBuilder.DropForeignKey( - name: "FK_Decks_Installations_InstallationId", - table: "Decks"); - - migrationBuilder.DropForeignKey( - name: "FK_Decks_Plants_PlantId", - table: "Decks"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_Decks_InspectionAreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionRuns_Decks_InspectionAreaId", - table: "MissionRuns"); - - migrationBuilder.DropForeignKey( - name: "FK_Robots_Decks_CurrentInspectionAreaId", - table: "Robots"); - - migrationBuilder.DropPrimaryKey( - name: "PK_Decks", - table: "Decks"); - - migrationBuilder.RenameTable( - name: "Decks", - newName: "InspectionAreas"); - - migrationBuilder.RenameIndex( - name: "IX_Decks_PlantId", - table: "InspectionAreas", - newName: "IX_InspectionAreas_PlantId"); - - migrationBuilder.RenameIndex( - name: "IX_Decks_InstallationId", - table: "InspectionAreas", - newName: "IX_InspectionAreas_InstallationId"); - - migrationBuilder.RenameIndex( - name: "IX_Decks_DefaultLocalizationPoseId", - table: "InspectionAreas", - newName: "IX_InspectionAreas_DefaultLocalizationPoseId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_InspectionAreas", - table: "InspectionAreas", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Areas_InspectionAreas_InspectionAreaId", - table: "Areas", - column: "InspectionAreaId", - principalTable: "InspectionAreas", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_InspectionAreas_DefaultLocalizationPoses_DefaultLocalizatio~", - table: "InspectionAreas", - column: "DefaultLocalizationPoseId", - principalTable: "DefaultLocalizationPoses", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_InspectionAreas_Installations_InstallationId", - table: "InspectionAreas", - column: "InstallationId", - principalTable: "Installations", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_InspectionAreas_Plants_PlantId", - table: "InspectionAreas", - column: "PlantId", - principalTable: "Plants", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_InspectionAreas_InspectionAreaId", - table: "MissionDefinitions", - column: "InspectionAreaId", - principalTable: "InspectionAreas", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_MissionRuns_InspectionAreas_InspectionAreaId", - table: "MissionRuns", - column: "InspectionAreaId", - principalTable: "InspectionAreas", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_InspectionAreas_CurrentInspectionAreaId", - table: "Robots", - column: "CurrentInspectionAreaId", - principalTable: "InspectionAreas", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Areas_InspectionAreas_InspectionAreaId", - table: "Areas"); - - migrationBuilder.DropForeignKey( - name: "FK_InspectionAreas_DefaultLocalizationPoses_DefaultLocalizatio~", - table: "InspectionAreas"); - - migrationBuilder.DropForeignKey( - name: "FK_InspectionAreas_Installations_InstallationId", - table: "InspectionAreas"); - - migrationBuilder.DropForeignKey( - name: "FK_InspectionAreas_Plants_PlantId", - table: "InspectionAreas"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionDefinitions_InspectionAreas_InspectionAreaId", - table: "MissionDefinitions"); - - migrationBuilder.DropForeignKey( - name: "FK_MissionRuns_InspectionAreas_InspectionAreaId", - table: "MissionRuns"); - - migrationBuilder.DropForeignKey( - name: "FK_Robots_InspectionAreas_CurrentInspectionAreaId", - table: "Robots"); - - migrationBuilder.DropPrimaryKey( - name: "PK_InspectionAreas", - table: "InspectionAreas"); - - migrationBuilder.RenameTable( - name: "InspectionAreas", - newName: "Decks"); - - migrationBuilder.RenameIndex( - name: "IX_InspectionAreas_PlantId", - table: "Decks", - newName: "IX_Decks_PlantId"); - - migrationBuilder.RenameIndex( - name: "IX_InspectionAreas_InstallationId", - table: "Decks", - newName: "IX_Decks_InstallationId"); - - migrationBuilder.RenameIndex( - name: "IX_InspectionAreas_DefaultLocalizationPoseId", - table: "Decks", - newName: "IX_Decks_DefaultLocalizationPoseId"); - - migrationBuilder.AddPrimaryKey( - name: "PK_Decks", - table: "Decks", - column: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Areas_Decks_InspectionAreaId", - table: "Areas", - column: "InspectionAreaId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Decks_DefaultLocalizationPoses_DefaultLocalizationPoseId", - table: "Decks", - column: "DefaultLocalizationPoseId", - principalTable: "DefaultLocalizationPoses", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Decks_Installations_InstallationId", - table: "Decks", - column: "InstallationId", - principalTable: "Installations", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Decks_Plants_PlantId", - table: "Decks", - column: "PlantId", - principalTable: "Plants", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_MissionDefinitions_Decks_InspectionAreaId", - table: "MissionDefinitions", - column: "InspectionAreaId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_MissionRuns_Decks_InspectionAreaId", - table: "MissionRuns", - column: "InspectionAreaId", - principalTable: "Decks", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Robots_Decks_CurrentInspectionAreaId", - table: "Robots", - column: "CurrentInspectionAreaId", - principalTable: "Decks", - principalColumn: "Id"); - } - } -} diff --git a/backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.Designer.cs b/backend/api/Migrations/20250122093518_ResetDatabaseStructure.Designer.cs similarity index 94% rename from backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.Designer.cs rename to backend/api/Migrations/20250122093518_ResetDatabaseStructure.Designer.cs index abe7472bd..5b82025e2 100644 --- a/backend/api/Migrations/20241218142700_RenameDeckTableToInspectionArea.Designer.cs +++ b/backend/api/Migrations/20250122093518_ResetDatabaseStructure.Designer.cs @@ -12,8 +12,8 @@ namespace Api.Migrations { [DbContext(typeof(FlotillaDbContext))] - [Migration("20241218142700_RenameDeckTableToInspectionArea")] - partial class RenameDeckTableToInspectionArea + [Migration("20250122093518_ResetDatabaseStructure")] + partial class ResetDatabaseStructure { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -524,24 +524,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) 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") @@ -575,60 +557,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) 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.Source", b => { b.Property("Id") diff --git a/backend/api/Migrations/20241210093952_Reset-Structure.cs b/backend/api/Migrations/20250122093518_ResetDatabaseStructure.cs similarity index 83% rename from backend/api/Migrations/20241210093952_Reset-Structure.cs rename to backend/api/Migrations/20250122093518_ResetDatabaseStructure.cs index 7349f2699..31b730b6b 100644 --- a/backend/api/Migrations/20241210093952_Reset-Structure.cs +++ b/backend/api/Migrations/20250122093518_ResetDatabaseStructure.cs @@ -6,16 +6,11 @@ namespace Api.Migrations { /// - public partial class ResetStructure : Migration + public partial class ResetDatabaseStructure : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { - // MANUALLY ADDED: - // Adding timescale extension to the database - migrationBuilder.Sql("CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;"); - // - migrationBuilder.CreateTable( name: "DefaultLocalizationPoses", columns: table => new @@ -41,9 +36,11 @@ protected override void Up(MigrationBuilder migrationBuilder) { Id = table.Column(type: "text", nullable: false), IsarTaskId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + IsarInspectionId = 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), + InspectionTargetName = table.Column(type: "text", nullable: true), Status = table.Column(type: "text", nullable: false), InspectionType = table.Column(type: "text", nullable: false), VideoDuration = table.Column(type: "real", nullable: true), @@ -70,19 +67,6 @@ protected override void Up(MigrationBuilder migrationBuilder) table.PrimaryKey("PK_Installations", x => x.Id); }); - migrationBuilder.CreateTable( - name: "RobotBatteryTimeseries", - columns: table => new - { - BatteryLevel = table.Column(type: "real", 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.CreateTable( name: "RobotModels", columns: table => new @@ -101,48 +85,29 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "RobotPoseTimeseries", + name: "Sources", columns: table => new { - PositionX = table.Column(type: "real", nullable: false), - PositionY = table.Column(type: "real", nullable: false), - PositionZ = table.Column(type: "real", nullable: false), - OrientationX = table.Column(type: "real", nullable: false), - 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), - RobotId = table.Column(type: "text", nullable: false), - MissionId = table.Column(type: "text", nullable: true) + Id = table.Column(type: "text", nullable: false), + SourceId = 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: "RobotPressureTimeseries", + name: "TagInspectionMetadata", columns: table => new { - Pressure = table.Column(type: "real", 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) + TagId = table.Column(type: "text", nullable: false), + ZoomDescription_ObjectWidth = table.Column(type: "double precision", nullable: true), + ZoomDescription_ObjectHeight = table.Column(type: "double precision", nullable: true) }, constraints: table => { - }); - - migrationBuilder.CreateTable( - name: "Sources", - columns: table => new - { - Id = table.Column(type: "text", nullable: false), - SourceId = table.Column(type: "text", nullable: false), - CustomMissionTasks = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Sources", x => x.Id); + table.PrimaryKey("PK_TagInspectionMetadata", x => x.TagId); }); migrationBuilder.CreateTable( @@ -217,7 +182,7 @@ protected override void Up(MigrationBuilder migrationBuilder) }); migrationBuilder.CreateTable( - name: "Decks", + name: "InspectionAreas", columns: table => new { Id = table.Column(type: "text", nullable: false), @@ -228,20 +193,20 @@ protected override void Up(MigrationBuilder migrationBuilder) }, constraints: table => { - table.PrimaryKey("PK_Decks", x => x.Id); + table.PrimaryKey("PK_InspectionAreas", x => x.Id); table.ForeignKey( - name: "FK_Decks_DefaultLocalizationPoses_DefaultLocalizationPoseId", + name: "FK_InspectionAreas_DefaultLocalizationPoses_DefaultLocalizatio~", column: x => x.DefaultLocalizationPoseId, principalTable: "DefaultLocalizationPoses", principalColumn: "Id"); table.ForeignKey( - name: "FK_Decks_Installations_InstallationId", + name: "FK_InspectionAreas_Installations_InstallationId", column: x => x.InstallationId, principalTable: "Installations", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( - name: "FK_Decks_Plants_PlantId", + name: "FK_InspectionAreas_Plants_PlantId", column: x => x.PlantId, principalTable: "Plants", principalColumn: "Id", @@ -253,7 +218,7 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "text", nullable: false), - DeckId = table.Column(type: "text", nullable: false), + InspectionAreaId = 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), @@ -273,17 +238,17 @@ protected override void Up(MigrationBuilder migrationBuilder) constraints: table => { table.PrimaryKey("PK_Areas", x => x.Id); - table.ForeignKey( - name: "FK_Areas_Decks_DeckId", - column: x => x.DeckId, - 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_InspectionAreas_InspectionAreaId", + column: x => x.InspectionAreaId, + principalTable: "InspectionAreas", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Areas_Installations_InstallationId", column: x => x.InstallationId, @@ -308,8 +273,9 @@ protected override void Up(MigrationBuilder migrationBuilder) ModelId = table.Column(type: "text", nullable: false), SerialNumber = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), CurrentInstallationId = table.Column(type: "text", nullable: false), - CurrentAreaId = table.Column(type: "text", nullable: true), + CurrentInspectionAreaId = table.Column(type: "text", nullable: true), BatteryLevel = table.Column(type: "real", nullable: false), + BatteryState = table.Column(type: "text", nullable: true), 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), @@ -332,9 +298,9 @@ protected override void Up(MigrationBuilder migrationBuilder) { table.PrimaryKey("PK_Robots", x => x.Id); table.ForeignKey( - name: "FK_Robots_Areas_CurrentAreaId", - column: x => x.CurrentAreaId, - principalTable: "Areas", + name: "FK_Robots_InspectionAreas_CurrentInspectionAreaId", + column: x => x.CurrentInspectionAreaId, + principalTable: "InspectionAreas", principalColumn: "Id"); table.ForeignKey( name: "FK_Robots_Installations_CurrentInstallationId", @@ -385,18 +351,7 @@ protected override void Up(MigrationBuilder migrationBuilder) 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: 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), - Map_Boundary_Y1 = table.Column(type: "double precision", nullable: true), - Map_Boundary_Y2 = table.Column(type: "double precision", nullable: true), - Map_Boundary_Z1 = table.Column(type: "double precision", nullable: true), - Map_Boundary_Z2 = table.Column(type: "double precision", nullable: true), - Map_TransformationMatrices_C1 = table.Column(type: "double precision", nullable: true), - 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), + InspectionAreaId = table.Column(type: "text", 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), @@ -407,11 +362,11 @@ protected override void Up(MigrationBuilder migrationBuilder) { table.PrimaryKey("PK_MissionRuns", x => x.Id); table.ForeignKey( - name: "FK_MissionRuns_Areas_AreaId", - column: x => x.AreaId, - principalTable: "Areas", + name: "FK_MissionRuns_InspectionAreas_InspectionAreaId", + column: x => x.InspectionAreaId, + principalTable: "InspectionAreas", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_MissionRuns_Robots_RobotId", column: x => x.RobotId, @@ -420,28 +375,6 @@ protected override void Up(MigrationBuilder migrationBuilder) onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "VideoStream", - 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), - Type = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - ShouldRotate270Clockwise = table.Column(type: "boolean", nullable: false), - RobotId = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_VideoStream", x => x.Id); - table.ForeignKey( - name: "FK_VideoStream_Robots_RobotId", - column: x => x.RobotId, - principalTable: "Robots", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "MissionDefinitions", columns: table => new @@ -453,18 +386,29 @@ protected override void Up(MigrationBuilder migrationBuilder) Comment = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), InspectionFrequency = table.Column(type: "bigint", nullable: true), LastSuccessfulRunId = table.Column(type: "text", nullable: true), - AreaId = table.Column(type: "text", nullable: false), + InspectionAreaId = table.Column(type: "text", nullable: true), + 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), + Map_Boundary_Y1 = table.Column(type: "double precision", nullable: true), + Map_Boundary_Y2 = table.Column(type: "double precision", nullable: true), + Map_Boundary_Z1 = table.Column(type: "double precision", nullable: true), + Map_Boundary_Z2 = table.Column(type: "double precision", nullable: true), + Map_TransformationMatrices_C1 = table.Column(type: "double precision", nullable: true), + 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), IsDeprecated = table.Column(type: "boolean", nullable: false) }, constraints: table => { table.PrimaryKey("PK_MissionDefinitions", x => x.Id); table.ForeignKey( - name: "FK_MissionDefinitions_Areas_AreaId", - column: x => x.AreaId, - principalTable: "Areas", + name: "FK_MissionDefinitions_InspectionAreas_InspectionAreaId", + column: x => x.InspectionAreaId, + principalTable: "InspectionAreas", principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_MissionDefinitions_MissionRuns_LastSuccessfulRunId", column: x => x.LastSuccessfulRunId, @@ -500,6 +444,8 @@ protected override void Up(MigrationBuilder migrationBuilder) 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), + IsarZoomDescription_ObjectWidth = table.Column(type: "double precision", nullable: true), + IsarZoomDescription_ObjectHeight = table.Column(type: "double precision", nullable: true), InspectionId = table.Column(type: "text", nullable: true), MissionRunId = table.Column(type: "text", nullable: true) }, @@ -524,14 +470,14 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "InstallationId"); migrationBuilder.CreateIndex( - name: "IX_Areas_DeckId", + name: "IX_Areas_DefaultLocalizationPoseId", table: "Areas", - column: "DeckId"); + column: "DefaultLocalizationPoseId"); migrationBuilder.CreateIndex( - name: "IX_Areas_DefaultLocalizationPoseId", + name: "IX_Areas_InspectionAreaId", table: "Areas", - column: "DefaultLocalizationPoseId"); + column: "InspectionAreaId"); migrationBuilder.CreateIndex( name: "IX_Areas_InstallationId", @@ -544,25 +490,25 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "PlantId"); migrationBuilder.CreateIndex( - name: "IX_Decks_DefaultLocalizationPoseId", - table: "Decks", + name: "IX_DocumentInfo_RobotId", + table: "DocumentInfo", + column: "RobotId"); + + migrationBuilder.CreateIndex( + name: "IX_InspectionAreas_DefaultLocalizationPoseId", + table: "InspectionAreas", column: "DefaultLocalizationPoseId"); migrationBuilder.CreateIndex( - name: "IX_Decks_InstallationId", - table: "Decks", + name: "IX_InspectionAreas_InstallationId", + table: "InspectionAreas", column: "InstallationId"); migrationBuilder.CreateIndex( - name: "IX_Decks_PlantId", - table: "Decks", + name: "IX_InspectionAreas_PlantId", + table: "InspectionAreas", column: "PlantId"); - migrationBuilder.CreateIndex( - name: "IX_DocumentInfo_RobotId", - table: "DocumentInfo", - column: "RobotId"); - migrationBuilder.CreateIndex( name: "IX_InspectionFindings_InspectionId", table: "InspectionFindings", @@ -575,9 +521,9 @@ protected override void Up(MigrationBuilder migrationBuilder) unique: true); migrationBuilder.CreateIndex( - name: "IX_MissionDefinitions_AreaId", + name: "IX_MissionDefinitions_InspectionAreaId", table: "MissionDefinitions", - column: "AreaId"); + column: "InspectionAreaId"); migrationBuilder.CreateIndex( name: "IX_MissionDefinitions_LastSuccessfulRunId", @@ -590,9 +536,9 @@ protected override void Up(MigrationBuilder migrationBuilder) column: "SourceId"); migrationBuilder.CreateIndex( - name: "IX_MissionRuns_AreaId", + name: "IX_MissionRuns_InspectionAreaId", table: "MissionRuns", - column: "AreaId"); + column: "InspectionAreaId"); migrationBuilder.CreateIndex( name: "IX_MissionRuns_RobotId", @@ -627,9 +573,9 @@ protected override void Up(MigrationBuilder migrationBuilder) unique: true); migrationBuilder.CreateIndex( - name: "IX_Robots_CurrentAreaId", + name: "IX_Robots_CurrentInspectionAreaId", table: "Robots", - column: "CurrentAreaId"); + column: "CurrentInspectionAreaId"); migrationBuilder.CreateIndex( name: "IX_Robots_CurrentInstallationId", @@ -640,11 +586,6 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "IX_Robots_ModelId", table: "Robots", column: "ModelId"); - - migrationBuilder.CreateIndex( - name: "IX_VideoStream_RobotId", - table: "VideoStream", - column: "RobotId"); } /// @@ -653,6 +594,9 @@ protected override void Down(MigrationBuilder migrationBuilder) migrationBuilder.DropTable( name: "AccessRoles"); + migrationBuilder.DropTable( + name: "Areas"); + migrationBuilder.DropTable( name: "DocumentInfo"); @@ -666,20 +610,11 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "MissionTasks"); migrationBuilder.DropTable( - name: "RobotBatteryTimeseries"); - - migrationBuilder.DropTable( - name: "RobotPoseTimeseries"); - - migrationBuilder.DropTable( - name: "RobotPressureTimeseries"); + name: "TagInspectionMetadata"); migrationBuilder.DropTable( name: "UserInfos"); - migrationBuilder.DropTable( - name: "VideoStream"); - migrationBuilder.DropTable( name: "Sources"); @@ -693,14 +628,11 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "Robots"); migrationBuilder.DropTable( - name: "Areas"); + name: "InspectionAreas"); migrationBuilder.DropTable( name: "RobotModels"); - migrationBuilder.DropTable( - name: "Decks"); - migrationBuilder.DropTable( name: "DefaultLocalizationPoses"); diff --git a/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs b/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs index 65ef9475a..4b19e493b 100644 --- a/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs +++ b/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs @@ -521,24 +521,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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") @@ -572,60 +554,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) 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.Source", b => { b.Property("Id") diff --git a/backend/api/Program.cs b/backend/api/Program.cs index ef0182c74..89e8300fd 100644 --- a/backend/api/Program.cs +++ b/backend/api/Program.cs @@ -98,10 +98,6 @@ .Configuration.GetSection("Database") .GetValue("UseInMemoryDatabase"); -if (useInMemoryDatabase) - builder.Services.AddScoped(); -else - builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); diff --git a/backend/api/Services/TimeseriesService.cs b/backend/api/Services/TimeseriesService.cs deleted file mode 100644 index 3f58f589d..000000000 --- a/backend/api/Services/TimeseriesService.cs +++ /dev/null @@ -1,340 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using Api.Controllers.Models; -using Api.Database.Context; -using Api.Database.Models; -using Api.Utilities; -using Microsoft.EntityFrameworkCore; -using Npgsql; - -namespace Api.Services -{ - public interface ITimeseriesService - { - public Task> ReadAll( - TimeseriesQueryStringParameters queryStringParameters - ) - where T : TimeseriesBase; - - public Task AddBatteryEntry(string currentMissionId, float batteryLevel, string robotId); - public Task AddPressureEntry(string currentMissionId, float pressureLevel, string robotId); - public Task AddPoseEntry(string currentMissionId, Pose robotPose, string robotId); - public Task Create(T newTimeseries) - where T : TimeseriesBase; - } - - [SuppressMessage( - "Globalization", - "CA1309:Use ordinal StringComparison", - Justification = "EF Core refrains from translating string comparison overloads to SQL" - )] - public class TimeseriesService : ITimeseriesService - { - private readonly FlotillaDbContext _context; - private readonly ILogger _logger; - private readonly NpgsqlDataSource _dataSource; - - public TimeseriesService(FlotillaDbContext context, ILogger logger) - { - string? connectionString = - context.Database.GetConnectionString() - ?? throw new NotSupportedException( - "Could not get connection string from EF core Database context - Cannot connect to Timeseries" - ); - var dataSourceBuilder = new NpgsqlDataSourceBuilder(connectionString); - _dataSource = dataSourceBuilder.Build(); - _logger = logger; - _context = context; - } - - public async Task AddBatteryEntry( - string currentMissionId, - float batteryLevel, - string robotId - ) - { - try - { - await Create( - new RobotBatteryTimeseries - { - MissionId = currentMissionId, - BatteryLevel = batteryLevel, - RobotId = robotId, - Time = DateTime.UtcNow, - } - ); - } - catch (NpgsqlException e) - { - _logger.LogError( - e, - "An error occurred setting battery level while connecting to the timeseries database" - ); - } - } - - public async Task AddPressureEntry( - string currentMissionId, - float pressureLevel, - string robotId - ) - { - try - { - await Create( - new RobotPressureTimeseries - { - MissionId = currentMissionId, - Pressure = pressureLevel, - RobotId = robotId, - Time = DateTime.UtcNow, - } - ); - } - catch (NpgsqlException e) - { - _logger.LogError( - e, - "An error occurred setting pressure level while connecting to the timeseries database" - ); - } - } - - public async Task AddPoseEntry(string currentMissionId, Pose robotPose, string robotId) - { - try - { - await Create( - new RobotPoseTimeseries(robotPose) - { - MissionId = currentMissionId, - RobotId = robotId, - Time = DateTime.UtcNow, - } - ); - } - catch (NpgsqlException e) - { - _logger.LogError( - e, - "An error occurred setting pose while connecting to the timeseries database" - ); - } - } - - public async Task> ReadAll( - TimeseriesQueryStringParameters queryStringParameters - ) - where T : TimeseriesBase - { - var query = _context.Set().AsQueryable(); - var filter = ConstructFilter(queryStringParameters); - - query = query.Where(filter); - query = query.OrderByDescending(timeseries => timeseries.Time); - - return await PagedList.ToPagedListAsync( - query.OrderByDescending(timeseries => timeseries.Time), - queryStringParameters.PageNumber, - queryStringParameters.PageSize - ); - } - - // Cannot use Entity framework to insert keyless entities into the timeseries database - // https://gibinfrancis.medium.com/timescale-db-with-ef-core-94c948829608 - // https://github.com/npgsql/npgsql - // Unfortunately need to use npgsql framework with heavy statements for this. - public async Task Create(T newTimeseries) - where T : TimeseriesBase - { - await using var connection = await _dataSource.OpenConnectionAsync(); - - string tableName = - _context.Set().EntityType.GetTableName() - ?? throw new NotImplementedException( - $"Class '{nameof(T)}' is not mapped to a table" - ); - - await using var command = new NpgsqlCommand(); - command.Connection = connection; - if (newTimeseries.MissionId is not null) - { - command.CommandText = - $"INSERT INTO \"{tableName}\"" - + $"(\"{nameof(newTimeseries.Time)}\"," - + GetColumnNames(newTimeseries) - + $"\"{nameof(newTimeseries.RobotId)}\"," - + $"\"{nameof(newTimeseries.MissionId)}\") " - + "VALUES " - + $"(@{nameof(newTimeseries.Time)}, " - + GetValueNames(newTimeseries) - + $"@{nameof(newTimeseries.RobotId)}, " - + $"@{nameof(newTimeseries.MissionId)})"; - - command.Parameters.AddWithValue( - nameof(newTimeseries.MissionId), - newTimeseries.MissionId - ); - } - else - { - command.CommandText = - $"INSERT INTO \"{tableName}\"" - + $"(\"{nameof(newTimeseries.Time)}\"," - + GetColumnNames(newTimeseries) - + $"\"{nameof(newTimeseries.RobotId)}\") " - + "VALUES " - + $"(@{nameof(newTimeseries.Time)}, " - + GetValueNames(newTimeseries) - + $"@{nameof(newTimeseries.RobotId)})"; - } - - command.Parameters.AddWithValue(nameof(newTimeseries.RobotId), newTimeseries.RobotId); - command.Parameters.AddWithValue(nameof(newTimeseries.Time), newTimeseries.Time); - - AddParameterValues(command.Parameters, newTimeseries); - - await command.ExecuteNonQueryAsync(); - - await connection.CloseAsync(); - - return newTimeseries; - } - - private static Expression> ConstructFilter( - TimeseriesQueryStringParameters parameters - ) - where T : TimeseriesBase - { - Expression> robotIdFilter = parameters.RobotId is null - ? timeseries => true - : timeseries => timeseries.RobotId.Equals(parameters.RobotId); - - Expression> missionIdFilter = parameters.MissionId is null - ? timeseries => true - : timeseries => - timeseries.MissionId == null - || timeseries.MissionId.Equals(parameters.MissionId); - - var minStartTime = DateTimeUtilities.UnixTimeStampToDateTime(parameters.MinTime); - var maxStartTime = DateTimeUtilities.UnixTimeStampToDateTime(parameters.MaxTime); - Expression> timeFilter = timeseries => - DateTime.Compare(timeseries.Time, minStartTime) >= 0 - && DateTime.Compare(timeseries.Time, maxStartTime) <= 0; - - // The parameter of the filter expression - var timeseries = Expression.Parameter(typeof(T)); - - // Combining the body of the filters to create the combined filter, using invoke to force parameter substitution - Expression body = Expression.AndAlso( - Expression.Invoke(robotIdFilter, timeseries), - Expression.AndAlso( - Expression.Invoke(missionIdFilter, timeseries), - Expression.Invoke(timeFilter, timeseries) - ) - ); - - // Constructing the resulting lambda expression by combining parameter and body - return Expression.Lambda>(body, timeseries); - } - - private static void AddParameterValues(NpgsqlParameterCollection parameters, T entity) - { - if (entity is RobotPressureTimeseries robotPressureTimeseries) - { - parameters.AddWithValue( - nameof(robotPressureTimeseries.Pressure), - robotPressureTimeseries.Pressure - ); - } - else if (entity is RobotBatteryTimeseries robotBatteryTimeseries) - { - parameters.AddWithValue( - nameof(robotBatteryTimeseries.BatteryLevel), - robotBatteryTimeseries.BatteryLevel - ); - } - else if (entity is RobotPoseTimeseries robotPoseTimeseries) - { - // Position - parameters.AddWithValue( - nameof(robotPoseTimeseries.PositionX), - robotPoseTimeseries.PositionX - ); - parameters.AddWithValue( - nameof(robotPoseTimeseries.PositionY), - robotPoseTimeseries.PositionY - ); - parameters.AddWithValue( - nameof(robotPoseTimeseries.PositionZ), - robotPoseTimeseries.PositionZ - ); - - // Orientation - parameters.AddWithValue( - nameof(robotPoseTimeseries.OrientationX), - robotPoseTimeseries.OrientationX - ); - parameters.AddWithValue( - nameof(robotPoseTimeseries.OrientationY), - robotPoseTimeseries.OrientationY - ); - parameters.AddWithValue( - nameof(robotPoseTimeseries.OrientationZ), - robotPoseTimeseries.OrientationZ - ); - parameters.AddWithValue( - nameof(robotPoseTimeseries.OrientationW), - robotPoseTimeseries.OrientationW - ); - } - else - { - throw new NotImplementedException( - $"No parameter values defined for timeseries type '{nameof(T)}'" - ); - } - } - - private static string GetColumnNames(T entity) - where T : TimeseriesBase - { - return GetContentNames(entity, "\"", "\""); - } - - private static string GetValueNames(T entity) - where T : TimeseriesBase - { - return GetContentNames(entity, "@"); - } - - private static string GetContentNames( - T entity, - string namePrefix = "", - string namePostfix = "" - ) - where T : TimeseriesBase - { - if (entity is RobotPressureTimeseries robotPressureTimeseries) - { - return $"{namePrefix}{nameof(robotPressureTimeseries.Pressure)}{namePostfix},"; - } - - if (entity is RobotBatteryTimeseries robotBatteryTimeseries) - { - return $"{namePrefix}{nameof(robotBatteryTimeseries.BatteryLevel)}{namePostfix},"; - } - - if (entity is RobotPoseTimeseries robotPoseTimeseries) - { - return $"{namePrefix}{nameof(robotPoseTimeseries.PositionX)}{namePostfix},{namePrefix}{nameof(robotPoseTimeseries.PositionY)}{namePostfix},{namePrefix}{nameof(robotPoseTimeseries.PositionZ)}{namePostfix}," - + $"{namePrefix}{nameof(robotPoseTimeseries.OrientationX)}{namePostfix},{namePrefix}{nameof(robotPoseTimeseries.OrientationY)}{namePostfix},{namePrefix}{nameof(robotPoseTimeseries.OrientationZ)}{namePostfix},{namePrefix}{nameof(robotPoseTimeseries.OrientationW)}{namePostfix},"; - } - - throw new NotImplementedException( - $"No content names defined for timeseries type '{nameof(T)}'" - ); - } - } -} diff --git a/backend/api/Services/TimeseriesServiceSqlLite.cs b/backend/api/Services/TimeseriesServiceSqlLite.cs deleted file mode 100644 index 99224cae5..000000000 --- a/backend/api/Services/TimeseriesServiceSqlLite.cs +++ /dev/null @@ -1,106 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using System.Linq.Expressions; -using Api.Controllers.Models; -using Api.Database.Context; -using Api.Database.Models; -using Api.Utilities; - -namespace Api.Services -{ - /// - /// Uses only dotnet ef core, instead of the Npgsql package needed for the PostgreSql database - /// Cannot insert because it is a keyless entity - /// - [SuppressMessage( - "Globalization", - "CA1309:Use ordinal StringComparison", - Justification = "EF Core refrains from translating string comparison overloads to SQL" - )] - public class TimeseriesServiceSqlLite(FlotillaDbContext context) : ITimeseriesService - { - public async Task> ReadAll( - TimeseriesQueryStringParameters queryStringParameters - ) - where T : TimeseriesBase - { - var query = context.Set().AsQueryable(); - var filter = ConstructFilter(queryStringParameters); - - query = query.Where(filter); - query = query.OrderByDescending(timeseries => timeseries.Time); - - return await PagedList.ToPagedListAsync( - query.OrderByDescending(timeseries => timeseries.Time), - queryStringParameters.PageNumber, - queryStringParameters.PageSize - ); - } - - public async Task AddBatteryEntry( - string currentMissionId, - float batteryLevel, - string robotId - ) - { - await Task.CompletedTask; - } - - public async Task AddPressureEntry( - string currentMissionId, - float pressureLevel, - string robotId - ) - { - await Task.CompletedTask; - } - - public async Task AddPoseEntry(string currentMissionId, Pose robotPose, string robotId) - { - await Task.CompletedTask; - } - - public async Task Create(T newTimeseries) - where T : TimeseriesBase - { - await Task.CompletedTask; - return newTimeseries; - } - - private static Expression> ConstructFilter( - TimeseriesQueryStringParameters parameters - ) - where T : TimeseriesBase - { - Expression> robotIdFilter = parameters.RobotId is null - ? timeseries => true - : timeseries => timeseries.RobotId.Equals(parameters.RobotId); - - Expression> missionIdFilter = parameters.MissionId is null - ? timeseries => true - : timeseries => - timeseries.MissionId == null - || timeseries.MissionId.Equals(parameters.MissionId); - - var minStartTime = DateTimeUtilities.UnixTimeStampToDateTime(parameters.MinTime); - var maxStartTime = DateTimeUtilities.UnixTimeStampToDateTime(parameters.MaxTime); - Expression> timeFilter = timeseries => - DateTime.Compare(timeseries.Time, minStartTime) >= 0 - && DateTime.Compare(timeseries.Time, maxStartTime) <= 0; - - // The parameter of the filter expression - var timeseries = Expression.Parameter(typeof(T)); - - // Combining the body of the filters to create the combined filter, using invoke to force parameter substitution - Expression body = Expression.AndAlso( - Expression.Invoke(robotIdFilter, timeseries), - Expression.AndAlso( - Expression.Invoke(missionIdFilter, timeseries), - Expression.Invoke(timeFilter, timeseries) - ) - ); - - // Constructing the resulting lambda expression by combining parameter and body - return Expression.Lambda>(body, timeseries); - } - } -} From 7d7f5ffb05eaa7b586846c29b5420b6d1e1d57f1 Mon Sep 17 00:00:00 2001 From: aestene Date: Wed, 22 Jan 2025 10:58:56 +0100 Subject: [PATCH 2/2] Upgrade dependency to remove vulnerability --- backend/api/Services/MissionRunService.cs | 1 - backend/api/Services/RobotService.cs | 1 - backend/api/api.csproj | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/backend/api/Services/MissionRunService.cs b/backend/api/Services/MissionRunService.cs index dfb889e5d..287b9d1aa 100644 --- a/backend/api/Services/MissionRunService.cs +++ b/backend/api/Services/MissionRunService.cs @@ -1,6 +1,5 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Linq.Dynamic.Core; using System.Linq.Expressions; using Api.Controllers.Models; using Api.Database.Context; diff --git a/backend/api/Services/RobotService.cs b/backend/api/Services/RobotService.cs index 6d13b85c6..b3264e5f4 100644 --- a/backend/api/Services/RobotService.cs +++ b/backend/api/Services/RobotService.cs @@ -1,6 +1,5 @@ using System.Diagnostics.CodeAnalysis; using System.Globalization; -using System.Linq.Dynamic.Core; using Api.Controllers.Models; using Api.Database.Context; using Api.Database.Models; diff --git a/backend/api/api.csproj b/backend/api/api.csproj index ce196cc33..9a085ec91 100644 --- a/backend/api/api.csproj +++ b/backend/api/api.csproj @@ -30,7 +30,7 @@ - +