96 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			96 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| // ***********************************************************************
 | |
| // <copyright file="PermissionAdapter.cs">
 | |
| //     AgileWebs
 | |
| // </copyright>
 | |
| // ***********************************************************************
 | |
| 
 | |
| using Core.Cerberos.Adapters.Common.Constants;
 | |
| 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 permission.
 | |
|     /// </summary>
 | |
|     public class PermissionAdapter
 | |
|     {
 | |
|         /// <summary>
 | |
|         /// Gets or sets the ID of the entity.
 | |
|         /// </summary>
 | |
|         [BsonId]
 | |
|         [BsonElement("_id")]
 | |
|         [BsonRepresentation(BsonType.ObjectId)]
 | |
|         [JsonPropertyName("id")]
 | |
|         public string Id { get; set; } = null!;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Gets or sets the name of the entity.
 | |
|         /// </summary>
 | |
|         [BsonElement("name")]
 | |
|         [BsonRepresentation(BsonType.String)]
 | |
|         [JsonPropertyName("name")]
 | |
|         public string Name { get; set; } = null!;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Gets or sets the description of the entity.
 | |
|         /// </summary>
 | |
|         [BsonElement("description")]
 | |
|         [BsonRepresentation(BsonType.String)]
 | |
|         [JsonPropertyName("description")]
 | |
|         public string? Description { get; set; }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Gets or sets the status of the entity object.
 | |
|         /// </summary>
 | |
|         [BsonElement("accessLevel")]
 | |
|         [BsonRepresentation(BsonType.String)]
 | |
|         [JsonPropertyName("accessLevel")]
 | |
|         [JsonConverter(typeof(JsonStringEnumConverter))]
 | |
|         public AccessLevelEnum? AccessLevel { get; set; } = null!;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Gets or sets the date and time when the entity 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 entity.
 | |
|         /// </summary>
 | |
|         [BsonElement("createdBy")]
 | |
|         [BsonRepresentation(BsonType.String)]
 | |
|         [JsonPropertyName("createdBy")]
 | |
|         public string? CreatedBy { get; set; }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Gets or sets the date and time when the entity 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 entity.
 | |
|         /// </summary>
 | |
|         [BsonElement("updatedBy")]
 | |
|         [BsonRepresentation(BsonType.String)]
 | |
|         [JsonPropertyName("updatedBy")]
 | |
|         public string? UpdatedBy { get; set; } = null;
 | |
| 
 | |
|         /// <summary>
 | |
|         /// Gets or sets the status of the entity.
 | |
|         /// </summary>
 | |
|         [BsonElement("status")]
 | |
|         [BsonRepresentation(BsonType.String)]
 | |
|         [JsonPropertyName("status")]
 | |
|         [JsonConverter(typeof(JsonStringEnumConverter))]
 | |
|         public StatusEnum Status { get; set; } = StatusEnum.Active;
 | |
|     }
 | |
| }
 | 
