Add project files.

This commit is contained in:
Sergio Matias Urquin
2025-04-29 18:42:29 -06:00
parent 9c1958d351
commit 83fc1878c4
67 changed files with 4586 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Core.Blueprint.SQLServer.Entities
{
/// <summary>
/// Represents the base class for SQL Server entities, providing common properties for auditing and state management.
/// </summary>
public abstract class BaseSQLAdapter : IBaseSQLAdapter
{
/// <summary>
/// Gets or sets the identifier for the entity.
/// </summary>
[Key]
[JsonPropertyName("id")]
public int Id { get; init; }
/// <summary>
/// Gets or sets the unique identifier for the entity.
/// </summary>
[JsonPropertyName("guid")]
public string Guid { get; init; }
/// <summary>
/// Gets or sets the timestamp when the entity was created.
/// Default value is the current UTC time at the moment of instantiation.
/// </summary>
[JsonPropertyName("createdAt")]
public DateTime? CreatedAt { get; init; }
/// <summary>
/// Gets or sets the identifier of the user or system that created the entity.
/// </summary>
[JsonPropertyName("createdBy")]
public string? CreatedBy { get; set; }
/// <summary>
/// Gets or sets the timestamp when the entity was last updated.
/// Null if the entity has not been updated.
/// </summary>
[JsonPropertyName("updatedAt")]
public DateTime? UpdatedAt { get; set; }
/// <summary>
/// Gets or sets the identifier of the user or system that last updated the entity.
/// Null if the entity has not been updated.
/// </summary>
[JsonPropertyName("updatedBy")]
public string? UpdatedBy { get; set; }
/// <summary>
/// Gets or sets the status of the entity, indicating whether it is active, inactive, or in another state.
/// Default value is <see cref="StatusEnum.Active"/>.
/// </summary>
[JsonPropertyName("status")]
[JsonConverter(typeof(JsonStringEnumConverter))]
public StatusEnum Status { get; set; }
protected BaseSQLAdapter()
{
Guid = System.Guid.NewGuid().ToString();
CreatedAt = DateTime.UtcNow;
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Text.Json.Serialization;
namespace Core.Blueprint.SQLServer.Entities
{
/// <summary>
/// Defines the possible statuses for entities in the system.
/// Used to track the state of an entity, such as whether it is active, inactive, or deleted.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum StatusEnum
{
/// <summary>
/// Indicates that the entity is currently active and operational.
/// </summary>
Active = 0,
/// <summary>
/// Indicates that the entity is currently inactive but still exists in the system.
/// Typically used for temporary deactivation or soft-offline states.
/// </summary>
Inactive = 1,
/// <summary>
/// Indicates that the entity has been deleted and is no longer accessible.
/// Often used in soft-delete scenarios where the entity is retained for archival or audit purposes.
/// </summary>
Deleted = 2
}
}