Code refactor finished

This commit is contained in:
Michał Zieliski
2024-06-18 22:02:19 +02:00
parent 7e8406dc9b
commit 763b4a8c4d
19 changed files with 1105 additions and 1228 deletions

View File

@@ -1,44 +1,42 @@
using System.ComponentModel.DataAnnotations;
namespace WebAPI.Models
namespace WebAPI.Models;
public enum LayerType
{
public enum LayerType
{
import,
processed,
administration,
}
public class Layer
{
#region Properties
[Key]
public Guid Id { get; set; }
[Required]
public int Number { get; set; }
[Required]
public string? Source { get; set; }
[Required]
public string? Name { get; set; }
[Required]
public LayerType Type { get; set; }
[Required]
public DateTime CreatedAt { get; set; }
[Required]
public DateTime ModifiedAt { get; set; }
[Required]
public bool IsDeleted { get; set; }
#endregion
#region Relations
public ICollection<Record>? Records { get; set; }
public ICollection<ProcessSource>? Sources { get; set; }
[Required]
public Guid CreatedById { get; set; }
public User? CreatedBy { get; set; }
[Required]
public Guid ModifiedById { get; set; }
public User? ModifiedBy { get; set; }
public Guid? ParentId { get; set; }
public Layer? Parent { get; set; }
#endregion
}
Import,
Processed,
Administration
}
public class Layer
{
#region Properties
[Key]
public Guid Id { get; init; }
[Required]
public int Number { get; init; }
[Required]
[MaxLength(50)]
public string? Name { get; set; }
[Required]
public LayerType Type { get; init; }
[Required]
public DateTime CreatedAt { get; set; }
[Required]
public DateTime ModifiedAt { get; set; }
[Required]
public bool IsDeleted { get; init; }
#endregion
#region Relations
public ICollection<Record>? Records { get; init; }
[Required]
public Guid CreatedById { get; set; }
public User? CreatedBy { get; init; }
[Required]
public Guid ModifiedById { get; set; }
public User? ModifiedBy { get; init; }
public Guid? ParentId { get; init; }
public Layer? Parent { get; init; }
#endregion
}

View File

@@ -1,25 +1,22 @@
using System.ComponentModel.DataAnnotations;
namespace WebAPI.Models;
namespace WebAPI.Models
public enum LogEntryType
{
public enum LogEntryType
{
info,
warning,
error,
}
public enum LogType {
import,
backup,
process,
powerBI
}
public class LogEntry
{
public LogType LogType { get; set; }
public LogEntryType Type { get; set; }
public string? Message { get; set; }
public string? Title {get; set;}
public DateTime CreatedAt { get; set; }
}
Info,
Warning,
Error
}
public enum LogType {
Import,
Backup,
Process,
PowerBi
}
public class LogEntry
{
public LogType LogType { get; init; }
public LogEntryType Type { get; init; }
public string? Message { get; init; }
public string? Title {get; init;}
public DateTime CreatedAt { get; init; }
}

View File

@@ -1,15 +1,14 @@
using System.ComponentModel.DataAnnotations;
namespace WebAPI.Models
namespace WebAPI.Models;
public class ProcessSource
{
public class ProcessSource
{
#region Relations
[Required]
public Guid LayerId { get; set; }
[Required]
public Guid SourceId { get; set; }
public Layer? Source { get; set; }
#endregion
}
}
#region Relations
[Required]
public Guid LayerId { get; init; }
[Required]
public Guid SourceId { get; init; }
public Layer? Source { get; init; }
#endregion
}

View File

@@ -6,10 +6,10 @@ public class Record
{
#region Properties
[Key]
public Guid Id { get; set; }
public Guid Id { get; init; }
[Required]
[StringLength(50)]
public string? Code { get; set; }
public string? Code { get; init; }
public double? Value1 { get; set; }
public double? Value2 { get; set; }
public double? Value3 { get; set; }
@@ -44,15 +44,15 @@ public class Record
public double? Value32 { get; set; }
//Description fields
[StringLength(50)]
public string? Desc1 { get; set; }
public string? Desc1 { get; init; }
[StringLength(50)]
public string? Desc2 { get; set; }
public string? Desc2 { get; init; }
[StringLength(50)]
public string? Desc3 { get; set; }
public string? Desc3 { get; init; }
[StringLength(50)]
public string? Desc4 { get; set; }
public string? Desc4 { get; init; }
[StringLength(50)]
public string? Desc5 { get; set; }
public string? Desc5 { get; init; }
[StringLength(50)]
public DateTime CreatedAt { get; set; }
public DateTime ModifiedAt { get; set; }