89 lines
2.5 KiB
C#
89 lines
2.5 KiB
C#
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
|
namespace BCards.Web.Models;
|
|
|
|
public class LivePage : IPageDisplay
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(BsonType.ObjectId)]
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
[BsonElement("originalPageId")]
|
|
[BsonRepresentation(BsonType.ObjectId)]
|
|
public string OriginalPageId { get; set; } = string.Empty;
|
|
|
|
[BsonElement("userId")]
|
|
[BsonRepresentation(BsonType.ObjectId)]
|
|
public string UserId { get; set; } = string.Empty;
|
|
|
|
[BsonElement("category")]
|
|
public string Category { get; set; } = string.Empty;
|
|
|
|
[BsonElement("slug")]
|
|
public string Slug { get; set; } = string.Empty;
|
|
|
|
[BsonElement("displayName")]
|
|
public string DisplayName { get; set; } = string.Empty;
|
|
|
|
[BsonElement("bio")]
|
|
public string Bio { get; set; } = string.Empty;
|
|
|
|
[BsonElement("profileImageId")]
|
|
public string? ProfileImageId { get; set; }
|
|
|
|
// Campo antigo - ignorar durante deserialização para compatibilidade
|
|
[BsonElement("profileImage")]
|
|
[BsonIgnoreIfDefault]
|
|
[BsonIgnore]
|
|
public string? ProfileImage { get; set; }
|
|
|
|
[BsonElement("businessType")]
|
|
public string BusinessType { get; set; } = string.Empty;
|
|
|
|
[BsonElement("theme")]
|
|
public PageTheme Theme { get; set; } = new();
|
|
|
|
[BsonElement("links")]
|
|
public List<LinkItem> Links { get; set; } = new();
|
|
|
|
[BsonElement("seoSettings")]
|
|
public SeoSettings SeoSettings { get; set; } = new();
|
|
|
|
[BsonElement("language")]
|
|
public string Language { get; set; } = "pt-BR";
|
|
|
|
[BsonElement("analytics")]
|
|
public LivePageAnalytics Analytics { get; set; } = new();
|
|
|
|
[BsonElement("publishedAt")]
|
|
public DateTime PublishedAt { get; set; }
|
|
|
|
[BsonElement("lastSyncAt")]
|
|
public DateTime LastSyncAt { get; set; }
|
|
|
|
[BsonElement("createdAt")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
public string FullUrl => $"page/{Category}/{Slug}";
|
|
|
|
/// <summary>
|
|
/// URL da imagem de perfil ou imagem padrão se não houver upload
|
|
/// </summary>
|
|
[BsonIgnore]
|
|
public string ProfileImageUrl => !string.IsNullOrEmpty(ProfileImageId)
|
|
? $"/api/image/{ProfileImageId}"
|
|
: "/images/default-avatar.svg";
|
|
}
|
|
|
|
public class LivePageAnalytics
|
|
{
|
|
[BsonElement("totalViews")]
|
|
public long TotalViews { get; set; }
|
|
|
|
[BsonElement("totalClicks")]
|
|
public long TotalClicks { get; set; }
|
|
|
|
[BsonElement("lastViewedAt")]
|
|
public DateTime? LastViewedAt { get; set; }
|
|
} |