更新
This commit is contained in:
2026-02-23 18:52:32 +08:00
parent d429560511
commit 123fa6a7aa
81 changed files with 5952 additions and 407 deletions
+13
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using IM_API.Models.Upload;
using Microsoft.EntityFrameworkCore;
namespace IM_API.Models;
@@ -18,6 +19,7 @@ public partial class ImContext : DbContext
public virtual DbSet<Device> Devices { get; set; }
public virtual DbSet<File> Files { get; set; }
public virtual DbSet<UploadTask> UploadTasks { get; set; }
public virtual DbSet<Friend> Friends { get; set; }
@@ -208,6 +210,17 @@ public partial class ImContext : DbContext
.HasConstraintName("files_ibfk_1");
});
modelBuilder.Entity<UploadTask>(entity =>
{
entity.HasKey(e => e.Id).HasName("PRIMARY");
entity
.ToTable("upload_tasks")
.HasCharSet("utf8mb4")
.UseCollation("utf8mb4_general_ci");
});
modelBuilder.Entity<Friend>(entity =>
{
entity.HasKey(e => e.Id).HasName("PRIMARY");
@@ -0,0 +1,10 @@
namespace IM_API.Models.Upload
{
public enum UploadStatus
{
Created,
Uploading,
Completed,
Aborted
}
}
@@ -0,0 +1,24 @@
namespace IM_API.Models.Upload
{
public class UploadTask
{
public Guid Id { get; set; }
public string FileName { get; set; } = default!;
public long FileSize { get; set; }
public string FileHash { get; set; }
public string ContentType { get; set; } = default!;
public int ChunkSize { get; set; }
public int TotalChunks { get; set; }
public UploadStatus Status { get; set; }
public string StorageProvider { get; set; } = default!;
public string ObjectName { get; set; } = default!;
public string? ProviderUploadId { get; set; } // OSS/S3 UploadId
public DateTimeOffset CreatedAt { get; set; }
}
}