feat(storage): implement storage management API and enhance storage mode handling

This commit is contained in:
shiyu
2025-06-09 12:12:15 +08:00
parent 4ef4b2056b
commit 0a6fe70537
43 changed files with 2449 additions and 907 deletions

View File

@@ -35,7 +35,9 @@ public class Picture : BaseModel
set => ExifInfoJson = value != null ? JsonSerializer.Serialize(value) : null;
}
public StorageType StorageType { get; set; } = StorageType.Local;
public int StorageModeId { get; set; }
[ForeignKey("StorageModeId")]
public StorageMode? StorageMode { get; set; } = null!;
public ICollection<Tag>? Tags { get; set; }
public int? UserId { get; set; }

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Foxel.Services.Attributes;
namespace Foxel.Models.DataBase;
public class StorageMode : BaseModel
{
[Required]
[StringLength(100)]
public string Name { get; set; } = string.Empty;
public bool IsEnabled { get; set; } = true;
public StorageType StorageType { get; set; } = StorageType.Local;
[Column(TypeName = "jsonb")] public string? ConfigurationJson { get; set; }
}