JSON export added

This commit is contained in:
retr0volkov
2025-07-10 10:57:42 +03:00 Unverified
parent 915c7a7c5e
commit fe8bfe7ef0
13 changed files with 112 additions and 8 deletions
+7
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace GazpromApp.Models;
@@ -8,18 +9,24 @@ public class Equipment
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
[Required]
public string? Name { get; set; } = string.Empty;
[Required]
public string? Description { get; set; } = string.Empty;
[Required]
[JsonIgnore]
public int PointId { get; set; }
[JsonIgnore]
public int ImageId { get; set; }
[JsonIgnore]
public List<int> InspectionIds { get; set; } = [];
// EF stuff
public Image? Image { get; set; }
[JsonIgnore]
public Point? Point { get; set; }
public List<Property> Properties { get; set; } = [];
public List<Inspection> Inspections { get; set; } = [];
+4
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace GazpromApp.Models;
public class Image
@@ -8,10 +9,13 @@ public class Image
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
[Required]
public byte[] Bytes { get; set; } = [];
// EF stuff
[JsonIgnore]
public List<Point> Points { get; set; } = [];
[JsonIgnore]
public List<Equipment> Equipment { get; set; } = [];
}
+4
View File
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace GazpromApp.Models;
@@ -8,6 +9,7 @@ public class Inspection
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
@@ -18,8 +20,10 @@ public class Inspection
[Required]
public float PeriodValue { get; set; }
[JsonIgnore]
public int EquipmentId { get; set; }
// EF stuff
[JsonIgnore]
public Equipment? Equipment { get; } = new();
}
+2
View File
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace GazpromApp.Models;
@@ -8,6 +9,7 @@ public class Point
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
[Required]
public string? Name { get; set; } = string.Empty;
+8 -1
View File
@@ -1,6 +1,8 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace GazpromApp.Models;
@@ -8,14 +10,19 @@ public class Property
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[JsonIgnore]
public int Id { get; set; }
[JsonIgnore]
public int ParentId { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
// EF stuff
[JsonIgnore]
public Property? Parent { get; set; }
public List<Property> Properties{ get; set; } = [];
[JsonIgnore]
public List<Point> Points { get; set; } = [];
[JsonIgnore]
public List<Equipment> Equipment { get; } = [];
}