Add news feature with CRUD operations and real-time notifications
- Implemented news management functionality, allowing admins to create, read, update, and delete news posts. - Introduced a new SignalR event for broadcasting news updates to all connected clients. - Updated API documentation to include new endpoints for news management. - Enhanced frontend with a dedicated news page and admin interface for managing news posts. - Added necessary localization for news-related terms in both Russian and English.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using PnvPanel.Domain.Common;
|
||||
|
||||
namespace PnvPanel.Domain.News;
|
||||
|
||||
/// <summary>Новость, которую публикует админ. Публикация мгновенная — нет статуса черновик/опубликовано.</summary>
|
||||
public sealed class NewsPost : Entity
|
||||
{
|
||||
public string Title { get; private set; } = string.Empty;
|
||||
public string Body { get; private set; } = string.Empty;
|
||||
public DateTimeOffset CreatedAt { get; private set; }
|
||||
public DateTimeOffset? UpdatedAt { get; private set; }
|
||||
|
||||
private NewsPost()
|
||||
{
|
||||
}
|
||||
|
||||
public static NewsPost Create(string title, string body)
|
||||
{
|
||||
return new NewsPost
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Title = title,
|
||||
Body = body,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(string title, string body)
|
||||
{
|
||||
Title = title;
|
||||
Body = body;
|
||||
UpdatedAt = DateTimeOffset.UtcNow;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user