Api/Netina.Domain/Entities/Comments/Comment.cs

36 lines
1.3 KiB
C#
Raw Permalink Normal View History

2024-09-24 00:34:53 +03:30
namespace Netina.Domain.Entities.Comments;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Map | MapType.MapToTarget)]
[AdaptTo("[name]SDto", IgnoreAttributes = [typeof(AdaptIgnoreAttribute)], MapType = MapType.Projection)]
[GenerateMapper]
2024-09-24 00:34:53 +03:30
public partial class Comment : ApiEntity
2023-12-16 20:25:12 +03:30
{
2024-09-24 00:34:53 +03:30
public Comment()
{
2024-09-24 00:34:53 +03:30
}
2024-09-24 00:34:53 +03:30
public Comment(string title, string content, float rate, bool isAdmin, Guid userId)
{
Title = title;
2024-09-24 00:34:53 +03:30
Content = content;
Rate = rate;
2024-09-21 20:51:01 +03:30
IsAdmin = isAdmin;
2024-09-24 00:34:53 +03:30
IsRoot = true;
UserId = userId;
}
2023-12-16 20:25:12 +03:30
public string Title { get; internal set; } = string.Empty;
2024-09-24 00:34:53 +03:30
public string Content { get; internal set; } = string.Empty;
2023-12-16 20:25:12 +03:30
public float Rate { get; internal set; }
public bool IsConfirmed { get; internal set; }
2024-09-21 20:51:01 +03:30
public bool IsAdmin { get; internal set; }
2024-09-24 00:34:53 +03:30
public bool IsRoot { get; internal set; }
public Guid? ParentId { get; internal set; }
public Comment? Parent { get; internal set; }
2023-12-16 20:25:12 +03:30
public List<Comment> Children { get; internal set; } = [];
2023-12-16 20:25:12 +03:30
public Guid UserId { get; internal set; }
public ApplicationUser? User { get; internal set; }
}