File index

This commit is contained in:
2025-11-12 22:09:13 +08:00
parent ce715cd6b0
commit e2b2bdd262
19 changed files with 2189 additions and 62 deletions

View File

@@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace DysonNetwork.Shared.Models;
[Index(nameof(Path), nameof(AccountId))]
public class SnCloudFileIndex : ModelBase
{
public Guid Id { get; init; } = Guid.NewGuid();
/// <summary>
/// The path of the file,
/// only store the parent folder.
/// With the trailing slash.
///
/// Like /hello/here/ not /hello/here/text.txt or /hello/here
/// Or the user home folder files, store as /
///
/// Besides, the folder name should be all query-safe, not contains % or
/// other special characters that will mess up the pgsql query
/// </summary>
[MaxLength(8192)]
public string Path { get; init; } = null!;
[MaxLength(32)] public string FileId { get; init; } = null!;
public SnCloudFile File { get; init; } = null!;
public Guid AccountId { get; init; }
[NotMapped] public SnAccount? Account { get; init; }
}