From 3530e6c8cf69ff7f32008c2e8583c8c5b8e8aadd Mon Sep 17 00:00:00 2001 From: daniel-hbn Date: Sat, 21 Jun 2025 14:52:39 +0200 Subject: [PATCH] =?UTF-8?q?Issue#32=20Database=20Update=20IsVerified=20in?= =?UTF-8?q?=20Server=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...te Issue#32 IsVerified-Servers.Designer.cs | 319 ++++++++++++++++++ ...7_DB-Update Issue#32 IsVerified-Servers.cs | 29 ++ .../Migrations/AppDbContextModelSnapshot.cs | 3 + Watcher/Models/Server.cs | 4 +- Watcher/persistence/watcher.db-shm | Bin 32768 -> 32768 bytes Watcher/persistence/watcher.db-wal | Bin 70072 -> 82432 bytes 6 files changed, 354 insertions(+), 1 deletion(-) create mode 100644 Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.Designer.cs create mode 100644 Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.cs diff --git a/Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.Designer.cs b/Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.Designer.cs new file mode 100644 index 0000000..feb5c2e --- /dev/null +++ b/Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.Designer.cs @@ -0,0 +1,319 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Watcher.Data; + +#nullable disable + +namespace Watcher.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20250621125157_DB-Update Issue#32 IsVerified-Servers")] + partial class DBUpdateIssue32IsVerifiedServers + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "8.0.6"); + + modelBuilder.Entity("Watcher.Models.Container", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Hostname") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("ImageId") + .HasColumnType("INTEGER"); + + b.Property("IsRunning") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Status") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("TagId") + .HasColumnType("INTEGER"); + + b.Property("Type") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.HasIndex("TagId"); + + b.ToTable("Containers"); + }); + + modelBuilder.Entity("Watcher.Models.Image", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.Property("Tag") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Images"); + }); + + modelBuilder.Entity("Watcher.Models.LogEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("ContainerId") + .HasColumnType("INTEGER"); + + b.Property("Level") + .HasColumnType("TEXT"); + + b.Property("Message") + .HasColumnType("TEXT"); + + b.Property("ServerId") + .HasColumnType("INTEGER"); + + b.Property("Timestamp") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("ContainerId"); + + b.HasIndex("ServerId"); + + b.ToTable("LogEvents"); + }); + + modelBuilder.Entity("Watcher.Models.Metric", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CPU_Load") + .HasColumnType("REAL"); + + b.Property("CPU_Temp") + .HasColumnType("REAL"); + + b.Property("DISK_Size") + .HasColumnType("REAL"); + + b.Property("DISK_Temp") + .HasColumnType("REAL"); + + b.Property("DISK_Usage") + .HasColumnType("REAL"); + + b.Property("GPU_Load") + .HasColumnType("REAL"); + + b.Property("GPU_Temp") + .HasColumnType("REAL"); + + b.Property("GPU_Vram_Size") + .HasColumnType("REAL"); + + b.Property("GPU_Vram_Usage") + .HasColumnType("REAL"); + + b.Property("NET_In") + .HasColumnType("REAL"); + + b.Property("NET_Out") + .HasColumnType("REAL"); + + b.Property("RAM_Load") + .HasColumnType("REAL"); + + b.Property("RAM_Size") + .HasColumnType("REAL"); + + b.Property("ServerId") + .HasColumnType("INTEGER"); + + b.Property("Timestamp") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Metrics"); + }); + + modelBuilder.Entity("Watcher.Models.Server", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("CpuCores") + .HasColumnType("INTEGER"); + + b.Property("CpuType") + .HasColumnType("TEXT"); + + b.Property("CreatedAt") + .HasColumnType("TEXT"); + + b.Property("Description") + .HasColumnType("TEXT"); + + b.Property("GpuType") + .HasColumnType("TEXT"); + + b.Property("IPAddress") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("IsOnline") + .HasColumnType("INTEGER"); + + b.Property("IsVerified") + .HasColumnType("INTEGER"); + + b.Property("LastSeen") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("RamSize") + .HasColumnType("REAL"); + + b.Property("TagId") + .HasColumnType("INTEGER"); + + b.Property("Type") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("TagId"); + + b.ToTable("Servers"); + }); + + modelBuilder.Entity("Watcher.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("Watcher.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Email") + .HasColumnType("TEXT"); + + b.Property("IdentityProvider") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("LastLogin") + .HasColumnType("TEXT"); + + b.Property("OIDC_Id") + .HasColumnType("TEXT"); + + b.Property("Password") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Username") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("Watcher.Models.Container", b => + { + b.HasOne("Watcher.Models.Image", "Image") + .WithMany("Containers") + .HasForeignKey("ImageId"); + + b.HasOne("Watcher.Models.Tag", null) + .WithMany("Containers") + .HasForeignKey("TagId"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("Watcher.Models.LogEvent", b => + { + b.HasOne("Watcher.Models.Container", "Container") + .WithMany() + .HasForeignKey("ContainerId"); + + b.HasOne("Watcher.Models.Server", "Server") + .WithMany() + .HasForeignKey("ServerId"); + + b.Navigation("Container"); + + b.Navigation("Server"); + }); + + modelBuilder.Entity("Watcher.Models.Server", b => + { + b.HasOne("Watcher.Models.Tag", null) + .WithMany("Servers") + .HasForeignKey("TagId"); + }); + + modelBuilder.Entity("Watcher.Models.Image", b => + { + b.Navigation("Containers"); + }); + + modelBuilder.Entity("Watcher.Models.Tag", b => + { + b.Navigation("Containers"); + + b.Navigation("Servers"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.cs b/Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.cs new file mode 100644 index 0000000..974f389 --- /dev/null +++ b/Watcher/Migrations/20250621125157_DB-Update Issue#32 IsVerified-Servers.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Watcher.Migrations +{ + /// + public partial class DBUpdateIssue32IsVerifiedServers : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "IsVerified", + table: "Servers", + type: "INTEGER", + nullable: false, + defaultValue: false); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "IsVerified", + table: "Servers"); + } + } +} diff --git a/Watcher/Migrations/AppDbContextModelSnapshot.cs b/Watcher/Migrations/AppDbContextModelSnapshot.cs index 1f76d39..11d908f 100644 --- a/Watcher/Migrations/AppDbContextModelSnapshot.cs +++ b/Watcher/Migrations/AppDbContextModelSnapshot.cs @@ -191,6 +191,9 @@ namespace Watcher.Migrations b.Property("IsOnline") .HasColumnType("INTEGER"); + b.Property("IsVerified") + .HasColumnType("INTEGER"); + b.Property("LastSeen") .HasColumnType("TEXT"); diff --git a/Watcher/Models/Server.cs b/Watcher/Models/Server.cs index b65fda6..83466a8 100644 --- a/Watcher/Models/Server.cs +++ b/Watcher/Models/Server.cs @@ -29,9 +29,11 @@ public class Server // Database public DateTime CreatedAt { get; set; } = DateTime.UtcNow; - + public Boolean IsOnline { get; set; } = false; public DateTime LastSeen { get; set; } + + public Boolean IsVerified { get; set; } = false; } diff --git a/Watcher/persistence/watcher.db-shm b/Watcher/persistence/watcher.db-shm index e67690b75729c115d6b74e02c23362a8a1caa1dd..f7da6f31f912c850023b628b3a70db618237dde2 100644 GIT binary patch delta 143 zcmZo@U}|V!N|1P@%K!qbK+MR%ARq#ym4G-Td}`0iaJHozE^XXyJ*QCE<>9a2iaSqF xAyxgvgd9f3jRy^#SeY0&8H6@o{K>>Dz#zQw;%_EqK?aeH7tgb7KI3a*1OPk0ET8}Y delta 138 zcmZo@U}|V!N|1P@%K!o_K+MR%ARq{&m4MhmD{A4(v(I@qT-vzZdQPFR!{5|C3%R>X sNL4>EA!p+aHK&Omc$k?OI5$50&BQ3M@!?-4M!}5_FS2Yt<7;9B0A8Xjz5oCK diff --git a/Watcher/persistence/watcher.db-wal b/Watcher/persistence/watcher.db-wal index 449efe8ec39fa895b16b794aac638fde6a1c5852..cd00959c0901bf5009275482628f7da2030e5be7 100644 GIT binary patch delta 376 zcmdn7n5ChGwP6e64nYY91_nkTX4r6P<96#gg~HVj@*^f%ad%G+5RevR0ZJ$VF((iU z0kP}k8UbT%76!evSG+(jKcfo+zXso3zHZ*Xj4nL<+$o&K95*W-0j7$y8 zj0_EpObt!V<6WF|Lkm(8OHvg)i;GKBm5q&n45+m!y1}VMWvNBQ7J3GHW>bGMZkOtr z8XmHgEqo;x*alMu{=57;`KR#b@tbZ8ROYv}U@m1O#{yPWW`D-1{}>ggdkZq=0suq9 BXej^y delta 11 ScmZo@VcoHqrC|%>4nY7M0R(3N