119 lines
3.9 KiB
C#
119 lines
3.9 KiB
C#
// ***********************************************************************
|
|
// <copyright file="ModuleAdapter.cs">
|
|
// Heath
|
|
// </copyright>
|
|
// ***********************************************************************
|
|
|
|
using Core.Cerberos.Adapters.Common.Enums;
|
|
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace Core.Cerberos.Adapters
|
|
{
|
|
/// <summary>
|
|
/// Adapter for representing a module.
|
|
/// </summary>
|
|
public class ModuleAdapter
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the ID of the module.
|
|
/// </summary>
|
|
[BsonId]
|
|
[BsonElement("_id")]
|
|
[BsonRepresentation(BsonType.ObjectId)]
|
|
[JsonPropertyName("id")]
|
|
public string Id { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the name of the module.
|
|
/// </summary>
|
|
[BsonElement("name")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("name")]
|
|
public string Name { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the description of the module.
|
|
/// </summary>
|
|
[BsonElement("description")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("description")]
|
|
public string? Description { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the description of the module.
|
|
/// </summary>
|
|
[BsonElement("icon")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("icon")]
|
|
public string? Icon { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the description of the module.
|
|
/// </summary>
|
|
[BsonElement("route")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("route")]
|
|
public string Route { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the order of the module.
|
|
/// </summary>
|
|
[BsonElement("order")]
|
|
[BsonRepresentation(BsonType.Int32)]
|
|
[JsonPropertyName("order")]
|
|
public int? Order { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the application of the module.
|
|
/// </summary>
|
|
[BsonElement("application")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("application")]
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
public ApplicationsEnum? Application { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the date and time when the module was created.
|
|
/// </summary>
|
|
[BsonElement("createdAt")]
|
|
[BsonRepresentation(BsonType.DateTime)]
|
|
[JsonPropertyName("createdAt")]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the user who created the module.
|
|
/// </summary>
|
|
[BsonElement("createdBy")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("createdBy")]
|
|
public string? CreatedBy { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the date and time when the module was last updated.
|
|
/// </summary>
|
|
[BsonElement("updatedAt")]
|
|
[BsonRepresentation(BsonType.DateTime)]
|
|
[JsonPropertyName("updatedAt")]
|
|
public DateTime? UpdatedAt { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the user who last updated the module.
|
|
/// </summary>
|
|
[BsonElement("updatedBy")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("updatedBy")]
|
|
public string? UpdatedBy { get; set; } = null;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the status of the module.
|
|
/// </summary>
|
|
[BsonElement("status")]
|
|
[BsonRepresentation(BsonType.String)]
|
|
[JsonPropertyName("status")]
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
public StatusEnum Status { get; set; } = StatusEnum.Active;
|
|
}
|
|
}
|