47 lines
1.8 KiB
C#
47 lines
1.8 KiB
C#
using PrivaPub.ClientModels.Resources;
|
|||
|
|
|
||
|
|
using System.ComponentModel.DataAnnotations;
|
||
|
|
|
||
|
|
namespace PrivaPub.ClientModels.Admin
|
||
|
|
{
|
||
|
|
// an announcement as the administrator's page shows it (/clientapi/admin/announcements/list): its Markdown and what it
|
||
|
|
// renders to, whether it is published and shown now, how many personas dismissed it and its reactions
|
||
|
|
public class ViewAnnouncement
|
||
|
|
{
|
||
|
|
public string Id { get; set; }
|
||
|
|
public string Text { get; set; }
|
||
|
|
public string Html { get; set; }
|
||
|
|
public DateTime? StartsAt { get; set; }
|
||
|
|
public DateTime? EndsAt { get; set; }
|
||
|
|
public bool AllDay { get; set; } = false;
|
||
|
|
public bool IsPublished { get; set; } = false;
|
||
|
|
public bool IsShown { get; set; } = false;//published and not ended
|
||
|
|
public DateTime? PublishedAt { get; set; }
|
||
|
|
public DateTime CreatedAt { get; set; }
|
||
|
|
public DateTime UpdatedAt { get; set; }
|
||
|
|
public long Reads { get; set; } = 0;
|
||
|
|
public List<ViewAnnouncementReaction> Reactions { get; set; } = [];
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ViewAnnouncementReaction
|
||
|
|
{
|
||
|
|
public string Name { get; set; }
|
||
|
|
public long Count { get; set; } = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
// insert (no Id) and update (its Id)
|
||
|
|
public class AnnouncementForm
|
||
|
|
{
|
||
|
|
[StringLength(64, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||
|
|
public string Id { get; set; }
|
||
|
|
|
||
|
|
[Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorsResource)),
|
||
|
|
StringLength(5000, ErrorMessageResourceName = "StringLength", ErrorMessageResourceType = typeof(ErrorsResource))]
|
||
|
|
public string Text { get; set; }//Markdown
|
||
|
|
|
||
|
|
public DateTime? StartsAt { get; set; }
|
||
|
|
public DateTime? EndsAt { get; set; }//once past, it is no longer shown
|
||
|
|
public bool AllDay { get; set; } = false;
|
||
|
|
public bool IsPublished { get; set; } = false;
|
||
|
|
}
|
||
|
|
}
|