Removed dialogs for editing equipment and points, and their related resources

This commit is contained in:
retr0volkov
2025-07-30 09:08:22 +03:00 Unverified
parent edae732fac
commit 08eaa30209
77 changed files with 1498 additions and 1543 deletions
+22 -7
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
@@ -7,28 +8,42 @@ namespace GazpromApp.Models;
public class Equipment
{
public Equipment()
{
LocalId = Id == Guid.Empty ? Guid.NewGuid() : Id;
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
public Guid Id { get; set; }
[JsonIgnore]
[NotMapped]
public Guid LocalId { get; set; }
[Required]
public string? Name { get; set; } = string.Empty;
public string? Description { get; set; } = string.Empty;
public DateTime CreationDate { get; set; }
// Foreign keys
[Required]
[JsonIgnore]
public int PointId { get; set; }
public Guid? PointId { get; set; }
[JsonIgnore]
public List<int> ImageIds { get; set; } = [];
public List<Guid> ImageIds { get; set; } = [];
[JsonIgnore]
public List<int> InspectionIds { get; set; } = [];
public List<Guid> InspectionIds { get; set; } = [];
[JsonIgnore]
public List<Guid> EquipmentIds { get; set; } = [];
public Guid? ParentEquipmentId { get; set; }
// Navigation Properties
public List<Image> Images { get; set; } = [];
[JsonIgnore]
public Point Point { get; set; } = null!;
public Point? Point { get; set; } = null!;
public List<Property> Properties { get; set; } = [];
public List<Inspection> Inspections { get; set; } = [];
public List<Equipment> Equipments { get; set; } = [];
public Equipment? ParentEquipment { get; set; }
}
+6 -4
View File
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
@@ -9,16 +10,17 @@ public class Image
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
public Guid Id { get; set; }
[Required]
public byte[] Bytes { get; set; } = [];
public DateTime CreationDate { get; set; }
// Foreign keys
[JsonIgnore]
public int? PointId { get; set; }
public Guid? PointId { get; set; }
[JsonIgnore]
public int? EquipmentId { get; set; }
public Guid? EquipmentId { get; set; }
// Navigation Properties
[JsonIgnore]
+3 -2
View File
@@ -10,10 +10,11 @@ public class Inspection
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
public Guid Id { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
public DateTime CreationDate { get; set; }
[Required]
public DateTimeOffset InspectionDate { get; set; }
[Required]
@@ -23,7 +24,7 @@ public class Inspection
// Foreign keys
[JsonIgnore]
public int EquipmentId { get; set; }
public Guid EquipmentId { get; set; }
// Navigation Properties
[JsonIgnore]
+4 -2
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
@@ -10,11 +11,12 @@ public class Point
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public string? Name { get; set; } = string.Empty;
public string? Description { get; set; } = string.Empty;
public DateTime CreationDate { get; set; }
public double Latitude { get; set; }
public double Longitude { get; set; }
// Navigation Properties
+7 -5
View File
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
@@ -10,27 +11,28 @@ public class Property
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
public Guid Id { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public DateTime CreationDate { get; set; }
// For self-referencing hierarchy (Property of a Property)
[JsonIgnore]
public int? ParentPropertyId { get; set; }
public Guid? ParentPropertyId { get; set; }
[JsonIgnore]
public Property? Parent { get; set; }
// For a Property of a Point
[JsonIgnore]
public int? PointId { get; set; }
public Guid? PointId { get; set; }
[JsonIgnore]
public Point? Point { get; set; }
// For a Property of an Equipment
[JsonIgnore]
public int? EquipmentId { get; set; }
public Guid? EquipmentId { get; set; }
[JsonIgnore]
public Equipment? Equipment { get; set; }