2023-07-29 15:03:45 +03:00
|
|
|
// This file is a part of RSS Bot for Telegram.
|
|
|
|
|
// License: MIT
|
|
|
|
|
// Author: CrazyHackGUT aka Kruzya (Sergey Gut) <kruzefag@gmail.com>
|
|
|
|
|
//
|
2020-03-02 00:00:52 +04:00
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
|
|
|
|
|
namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents a feed in database.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Feed : RepresentableEntity
|
|
|
|
|
{
|
|
|
|
|
#region RepresentableEntity
|
|
|
|
|
protected override string ViewableText
|
|
|
|
|
{
|
|
|
|
|
get => Title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string ViewableUrl
|
|
|
|
|
{
|
|
|
|
|
get => HomePage;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The unique feed id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Key]
|
|
|
|
|
public Guid FeedId { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The feed URL.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
public string Url { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The home page for this feed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
public string HomePage { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Feed title.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[MaxLength(256)]
|
|
|
|
|
[Required]
|
|
|
|
|
public string Title { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// DateTime when feed fetched successfully in last time.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
public DateTime UpdatedAt { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This flag indicates, bot should monitor changes in post date, or not.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Required]
|
|
|
|
|
[DefaultValue(false)]
|
|
|
|
|
public bool WatchPostDate { get; set; }
|
2022-11-02 11:02:41 +02:00
|
|
|
|
|
|
|
|
[Required]
|
|
|
|
|
[DefaultValue(false)]
|
|
|
|
|
public bool IsPrivate { get; set; }
|
|
|
|
|
|
2020-03-02 00:00:52 +04:00
|
|
|
public Feed()
|
|
|
|
|
{
|
|
|
|
|
FeedId = new Guid();
|
|
|
|
|
UpdatedAt = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// All posts from this feed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual ICollection<Post> Posts { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// All exists subscriber for this feed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public virtual ICollection<Subscriber> Subscribers { get; set; }
|
2022-04-21 14:26:35 +03:00
|
|
|
|
|
|
|
|
public override string ToString() => Title;
|
2020-03-02 00:00:52 +04:00
|
|
|
}
|
|
|
|
|
}
|