♻️ File organize system v2

This commit is contained in:
2026-01-10 14:34:53 +08:00
parent cb04e53b7e
commit 8177bda232
7 changed files with 139 additions and 22 deletions

View File

@@ -26,7 +26,10 @@ public class SnCloudFile : ModelBase, ICloudFile, IIdentifiedResource
public bool HasCompression { get; set; } = false;
public bool HasThumbnail { get; set; } = false;
public bool IsEncrypted { get; set; } = false;
[MaxLength(32)] public string? ObjectId { get; set; }
public SnFileObject? Object { get; set; }
public FilePool? Pool { get; set; }
public Guid? PoolId { get; set; }
[JsonIgnore] public SnFileBundle? Bundle { get; set; }

View File

@@ -0,0 +1,67 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace DysonNetwork.Shared.Models;
public class SnFileObject : ModelBase
{
[MaxLength(32)] public string Id { get; set; }
public long Size { get; set; }
[Column(TypeName = "jsonb")] public Dictionary<string, object?>? Meta { get; set; }
[MaxLength(256)] public string? MimeType { get; set; }
[MaxLength(256)] public string? Hash { get; set; }
public bool HasCompression { get; set; } = false;
public bool HasThumbnail { get; set; } = false;
public List<SnFileReplica> FileReplicas { get; set; } = [];
}
public enum SnFileReplicaStatus
{
Pending,
Uploading,
Available,
Failed,
Deprecated
}
public class SnFileReplica : ModelBase
{
public Guid Id { get; set; }
[MaxLength(32)] public string ObjectId { get; set; }
public SnFileObject Object { get; set; } = null!;
public Guid PoolId { get; set; }
public FilePool Pool { get; set; } = null!;
[MaxLength(128)]
public string StorageId { get; set; } = null!;
public SnFileReplicaStatus Status { get; set; } = SnFileReplicaStatus.Pending;
public bool IsPrimary { get; set; } = false;
}
public enum SnFilePermissionType
{
Someone,
Anyone
}
public enum SnFilePermissionLevel
{
Read,
Write
}
public class SnFilePermission : ModelBase
{
public Guid Id { get; set; }
public string FileId { get; set; } = null!;
public SnFilePermissionType SubjectType { get; set; } = SnFilePermissionType.Someone;
public string SubjectId { get; set; } = null!;
public SnFilePermissionLevel Permission { get; set; } = SnFilePermissionLevel.Read;
}