Files
Swarm/DysonNetwork.Drive/Models/Post.cs

51 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace DysonNetwork.Drive.Models;
public class Post : ModelBase
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
[MaxLength(1024)]
public string Title { get; set; } = null!;
public string Content { get; set; } = string.Empty;
public Guid AuthorId { get; set; }
public virtual Account? Author { get; set; }
public bool IsPublished { get; set; } = false;
public bool IsDeleted { get; set; } = false;
// Navigation properties
public virtual ICollection<PostViewInfo> Views { get; set; } = new List<PostViewInfo>();
public virtual ICollection<CloudFileReference> Attachments { get; set; } = new List<CloudFileReference>();
}
public class PostViewInfo
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
public Guid PostId { get; set; }
public virtual Post? Post { get; set; }
public string? UserAgent { get; set; }
public string? IpAddress { get; set; }
public string? Referrer { get; set; }
public string? ViewerId { get; set; }
public DateTimeOffset ViewedAt { get; set; } = DateTimeOffset.UtcNow;
// Additional metadata
public string? CountryCode { get; set; }
public string? DeviceType { get; set; }
public string? Platform { get; set; }
public string? Browser { get; set; }
}