🗑️ Clean up the cloud file table unused fields

This commit is contained in:
2026-01-11 23:58:37 +08:00
parent de1175bdc7
commit 6d5303f99c
9 changed files with 26 additions and 11 deletions

View File

@@ -20,14 +20,14 @@ public class SnCloudFile : ModelBase, ICloudFile, IIdentifiedResource
[NotMapped]
[Column(TypeName = "jsonb")]
public Dictionary<string, object?> FileMeta => Object!.Meta ?? [];
[NotMapped] [MaxLength(256)] public string? MimeType => Object!.MimeType;
[NotMapped] [MaxLength(256)] public string? Hash => Object!.Hash;
public Dictionary<string, object?> FileMeta => Object?.Meta ?? [];
[NotMapped] [MaxLength(256)] public string? MimeType => Object?.MimeType;
[NotMapped] [MaxLength(256)] public string? Hash => Object?.Hash;
public Instant? ExpiredAt { get; set; }
[NotMapped] public long Size => Object!.Size;
[NotMapped] public long Size => Object?.Size ?? 0;
public Instant? UploadedAt { get; set; }
[NotMapped] public bool HasCompression => Object!.HasCompression;
[NotMapped] public bool HasThumbnail => Object!.HasThumbnail;
[NotMapped] public bool HasCompression => Object?.HasCompression ?? false;
[NotMapped] public bool HasThumbnail => Object?.HasThumbnail ?? false;
[MaxLength(32)] public string? ObjectId { get; set; }
public SnFileObject? Object { get; set; }

View File

@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace DysonNetwork.Shared.Models;
@@ -33,7 +34,7 @@ public class SnFileReplica : ModelBase
public Guid Id { get; set; }
[MaxLength(32)] public string ObjectId { get; set; }
public SnFileObject Object { get; set; } = null!;
[JsonIgnore] public SnFileObject Object { get; set; } = null!;
public Guid? PoolId { get; set; }
public FilePool? Pool { get; set; } = null!;