2025-06-23 21:22:11 +00:00
|
|
|
using System;
|
|
|
|
|
using Volo.Abp.Domain.Entities.Auditing;
|
2025-08-20 12:04:48 +00:00
|
|
|
using Volo.Abp.MultiTenancy;
|
2025-06-23 21:22:11 +00:00
|
|
|
|
|
|
|
|
namespace Kurs.Platform.Entities;
|
|
|
|
|
|
2025-08-20 12:04:48 +00:00
|
|
|
public class BlogPost : FullAuditedAggregateRoot<Guid>, IMultiTenant
|
2025-06-23 21:22:11 +00:00
|
|
|
{
|
|
|
|
|
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,
|
2025-06-27 15:00:47 +00:00
|
|
|
bool isPublished,
|
|
|
|
|
DateTime? publishedAt = null,
|
2025-06-23 21:22:11 +00:00
|
|
|
Guid? tenantId = null) : base(id)
|
|
|
|
|
{
|
|
|
|
|
Title = title;
|
|
|
|
|
Slug = slug;
|
|
|
|
|
ContentTr = contentTr;
|
|
|
|
|
ContentEn = contentEn;
|
|
|
|
|
Summary = summary;
|
|
|
|
|
ReadTime = readTime;
|
|
|
|
|
CoverImage = coverImage;
|
|
|
|
|
CategoryId = categoryId;
|
|
|
|
|
AuthorId = authorId;
|
2025-06-27 15:00:47 +00:00
|
|
|
IsPublished = isPublished;
|
|
|
|
|
PublishedAt = publishedAt;
|
2025-06-23 21:22:11 +00:00
|
|
|
TenantId = tenantId;
|
|
|
|
|
|
|
|
|
|
ViewCount = 0;
|
|
|
|
|
LikeCount = 0;
|
|
|
|
|
CommentCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Publish()
|
|
|
|
|
{
|
|
|
|
|
IsPublished = true;
|
|
|
|
|
PublishedAt = DateTime.UtcNow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Unpublish()
|
|
|
|
|
{
|
|
|
|
|
IsPublished = false;
|
|
|
|
|
PublishedAt = null;
|
|
|
|
|
}
|
|
|
|
|
}
|