2024-07-01 23:19:37 +00:00
|
|
|
|
using System.Text.Json;
|
2024-06-05 12:41:08 +00:00
|
|
|
|
using System.Text.Json.Serialization;
|
|
|
|
|
|
2024-07-01 23:19:37 +00:00
|
|
|
|
namespace Neighbourhood.omg.lol.Models
|
|
|
|
|
{
|
|
|
|
|
public class Pic {
|
2024-07-02 00:29:50 +00:00
|
|
|
|
public string Id { get; set; } = string.Empty;
|
|
|
|
|
public string Url { get; set; } = string.Empty;
|
|
|
|
|
public string Address { get; set; } = string.Empty;
|
2024-06-05 12:41:08 +00:00
|
|
|
|
public long Created { get; set; }
|
|
|
|
|
public long Size { get; set; }
|
2024-07-02 00:29:50 +00:00
|
|
|
|
public string Mime { get; set; } = string.Empty;
|
|
|
|
|
public string Description { get; set; } = string.Empty;
|
2024-06-14 07:20:04 +00:00
|
|
|
|
public string DescriptionHtml { get => Description == null ? string.Empty : Utilities.MdToHtml(Description); }
|
2024-06-05 12:41:08 +00:00
|
|
|
|
|
2024-06-28 07:08:12 +00:00
|
|
|
|
public DateTimeOffset CreatedTime { get => DateTimeOffset.UnixEpoch.AddSeconds(Created); }
|
|
|
|
|
|
2024-06-05 12:41:08 +00:00
|
|
|
|
[JsonPropertyName("exif")]
|
2024-06-06 05:20:09 +00:00
|
|
|
|
public JsonElement ExifJson { get; set; }
|
2024-06-05 12:41:08 +00:00
|
|
|
|
|
|
|
|
|
public string RelativeTime {
|
|
|
|
|
get {
|
2024-06-28 07:08:12 +00:00
|
|
|
|
TimeSpan offset = DateTimeOffset.UtcNow - CreatedTime;
|
2024-06-05 12:41:08 +00:00
|
|
|
|
|
|
|
|
|
var offsetString = string.Empty;
|
|
|
|
|
if (offset.TotalDays >= 1) offsetString = $"{Math.Floor(offset.TotalDays)} days ago";
|
|
|
|
|
else if (offset.TotalHours >= 1) offsetString = $"{Math.Floor(offset.TotalHours)} hours, {offset.Minutes} minutes ago";
|
|
|
|
|
else if (offset.TotalMinutes >= 1) offsetString = $"{Math.Floor(offset.TotalMinutes)} minutes ago";
|
|
|
|
|
else offsetString = $"{Math.Floor(offset.TotalSeconds)} seconds ago";
|
|
|
|
|
|
|
|
|
|
return offsetString;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|