erp-platform/api/src/Kurs.Platform.Domain/Entities/BlogPost.cs
2025-08-20 15:04:48 +03:00

78 lines
1.9 KiB
C#

using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace Kurs.Platform.Entities;
public class BlogPost : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public Guid? TenantId { get; set; }
public string Title { get; set; }
public string Slug { get; set; }
public string ContentTr { get; set; }
public string ContentEn { get; set; }
public string Summary { get; set; }
public string CoverImage { get; set; }
public string ReadTime { get; set; }
public Guid CategoryId { get; set; }
public virtual BlogCategory Category { get; set; }
public Guid AuthorId { get; set; }
public int ViewCount { get; set; }
public int LikeCount { get; set; }
public int CommentCount { get; set; }
public bool IsPublished { get; set; }
public DateTime? PublishedAt { get; set; }
protected BlogPost()
{
}
public BlogPost(
Guid id,
string title,
string slug,
string contentTr,
string contentEn,
string summary,
string readTime,
string coverImage,
Guid categoryId,
Guid authorId,
bool isPublished,
DateTime? publishedAt = null,
Guid? tenantId = null) : base(id)
{
Title = title;
Slug = slug;
ContentTr = contentTr;
ContentEn = contentEn;
Summary = summary;
ReadTime = readTime;
CoverImage = coverImage;
CategoryId = categoryId;
AuthorId = authorId;
IsPublished = isPublished;
PublishedAt = publishedAt;
TenantId = tenantId;
ViewCount = 0;
LikeCount = 0;
CommentCount = 0;
}
public void Publish()
{
IsPublished = true;
PublishedAt = DateTime.UtcNow;
}
public void Unpublish()
{
IsPublished = false;
PublishedAt = null;
}
}