Tim Jones 1 місяць тому
батько
коміт
ca30fdd03f

+ 1 - 1
RackPeek.Domain/Helpers/ThrowIfInvalid.cs

@@ -22,7 +22,7 @@ public static class ThrowIfInvalid
             throw new ValidationException("Model name is too long.");
     }
 
-    public static void RamGb(int? value)
+    public static void RamGb(double? value)
     {
         if (value is null) throw new ValidationException("RAM value must be specified.");
 

+ 1 - 1
RackPeek.Domain/Resources/Desktops/DesktopHardwareReport.cs

@@ -11,7 +11,7 @@ public record DesktopHardwareRow(
     string CpuSummary,
     int TotalCores,
     int TotalThreads,
-    int RamGb,
+    double RamGb,
     int TotalStorageGb,
     int SsdStorageGb,
     int HddStorageGb,

+ 1 - 1
RackPeek.Domain/Resources/Desktops/UpdateDesktopUseCase.cs

@@ -9,7 +9,7 @@ public class UpdateDesktopUseCase(IResourceCollection repository) : IUseCase
     public async Task ExecuteAsync(
         string name,
         string? model = null,
-        int? ramGb = null,
+        double? ramGb = null,
         int? ramMts = null,
         string? notes = null
     )

+ 1 - 1
RackPeek.Domain/Resources/Laptops/LaptopHardwareReportUseCase.cs

@@ -63,7 +63,7 @@ public record LaptopHardwareRow(
     string CpuSummary,
     int TotalCores,
     int TotalThreads,
-    int RamGb,
+    double RamGb,
     int TotalStorageGb,
     int SsdStorageGb,
     int HddStorageGb,

+ 1 - 1
RackPeek.Domain/Resources/Laptops/UpdateLaptopUseCase.cs

@@ -9,7 +9,7 @@ public class UpdateLaptopUseCase(IResourceCollection repository) : IUseCase
     public async Task ExecuteAsync(
         string name,
         string? model = null,
-        int? ramGb = null,
+        double? ramGb = null,
         int? ramMts = null,
         string? notes = null
     )

+ 1 - 1
RackPeek.Domain/Resources/Servers/DescribeServerUseCase.cs

@@ -8,7 +8,7 @@ public record ServerDescription(
     string CpuSummary,
     int TotalCores,
     int TotalThreads,
-    int RamGb,
+    double RamGb,
     int TotalStorageGb,
     int NicPorts,
     bool Ipmi

+ 1 - 1
RackPeek.Domain/Resources/Servers/ServerHardwareReport.cs

@@ -11,7 +11,7 @@ public record ServerHardwareRow(
     string CpuSummary,
     int TotalCores,
     int TotalThreads,
-    int RamGb,
+    double RamGb,
     int TotalStorageGb,
     int SsdStorageGb,
     int HddStorageGb,

+ 1 - 1
RackPeek.Domain/Resources/Servers/UpdateServerUseCase.cs

@@ -8,7 +8,7 @@ public class UpdateServerUseCase(IResourceCollection repository) : IUseCase
 {
     public async Task ExecuteAsync(
         string name,
-        int? ramGb = null,
+        double? ramGb = null,
         int? ramMts = null,
         bool? ipmi = null,
         string? notes = null

+ 1 - 1
RackPeek.Domain/Resources/SubResources/Ram.cs

@@ -2,6 +2,6 @@ namespace RackPeek.Domain.Resources.SubResources;
 
 public class Ram
 {
-    public int? Size { get; set; }
+    public double? Size { get; set; }
     public int? Mts { get; set; }
 }

+ 1 - 1
RackPeek.Domain/Resources/SystemResources/SystemResource.cs

@@ -21,6 +21,6 @@ public class SystemResource : Resource, IDriveResource
     public string? Type { get; set; }
     public string? Os { get; set; }
     public int? Cores { get; set; }
-    public int? Ram { get; set; }
+    public double? Ram { get; set; }
     public List<Drive>? Drives { get; set; }
 }

+ 1 - 1
RackPeek.Domain/Resources/SystemResources/UseCases/DescribeSystemUseCase.cs

@@ -8,7 +8,7 @@ public record SystemDescription(
     string? Type,
     string? Os,
     int Cores,
-    int RamGb,
+    double RamGb,
     int TotalStorageGb,
     string? RunsOn
 );

+ 1 - 1
RackPeek.Domain/Resources/SystemResources/UseCases/SystemReportUseCase.cs

@@ -11,7 +11,7 @@ public record SystemReportRow(
     string? Type,
     string? Os,
     int Cores,
-    int RamGb,
+    double RamGb,
     int TotalStorageGb,
     string? RunsOn
 );

+ 1 - 1
RackPeek.Domain/Resources/SystemResources/UseCases/UpdateSystemUseCase.cs

@@ -10,7 +10,7 @@ public class UpdateSystemUseCase(IResourceCollection repository) : IUseCase
         string? type = null,
         string? os = null,
         int? cores = null,
-        int? ram = null,
+        double? ram = null,
         string? runsOn = null,
         string? notes = null
     )

+ 1 - 1
Shared.Rcl/Modals/RamModal.razor

@@ -153,7 +153,7 @@
 
     private class RamFormModel
     {
-        [Range(1, 1024)] public int? Size { get; set; }
+        [Range(0, 1024)] public double? Size { get; set; }
 
         [Range(1, 10000)] public int? Mts { get; set; }
     }

+ 1 - 1
Shared.Rcl/Systems/SystemEditModel.cs

@@ -8,7 +8,7 @@ public sealed class SystemEditModel
     public string? Type { get; set; }
     public string? Os { get; set; }
     public int? Cores { get; set; }
-    public int? Ram { get; set; }
+    public double? Ram { get; set; }
     public string? RunsOn { get; set; }
     public string? Notes { get; set; }
 

+ 2 - 2
Tests/Yaml/SystemDeserializationTests.cs

@@ -39,7 +39,7 @@ resources:
     name: home-virtualization-host
     os: proxmox     
     cores: 2
-    ram: 12gb
+    ram: 12.5gb
     drives:
         - size: 2Tb
         - size: 1tb   
@@ -59,7 +59,7 @@ resources:
         Assert.Equal("home-virtualization-host", system.Name);
         Assert.Equal("proxmox", system.Os);
         Assert.Equal(2, system.Cores);
-        Assert.Equal(12, system.Ram);
+        Assert.Equal(12.5, system.Ram);
 
         // Drives
         Assert.NotNull(system.Drives);