This commit is contained in:
西街长安 2026-05-11 20:14:08 +08:00
commit e605b50367
24 changed files with 285 additions and 53 deletions

View File

@ -1,4 +1,6 @@
using FileService.Application.Ports;
using FileService.Domain.IReposities;
using IM.Application.Abstractions;
using IM.Commons.IntegrationEvents;
using MassTransit;
using System;
@ -12,18 +14,23 @@ namespace FileService.Application.EventHandler
public class UploadTaskCompleteEventHandler : IConsumer<UploadTaskCompleteEvent>
{
private readonly IObjectStorageRouter router;
private readonly IStorageRedisCache cache;
private readonly IUploadFileReposity uploadFile;
private readonly IUnitOfWork uwork;
private readonly IStorageRedisCache storageCache;
public UploadTaskCompleteEventHandler(IObjectStorageRouter router, IStorageRedisCache cache)
public UploadTaskCompleteEventHandler(IObjectStorageRouter router, IUploadFileReposity uploadFile, IUnitOfWork uwork, IStorageRedisCache storageCache)
{
this.router = router;
this.cache = cache;
this.uploadFile = uploadFile;
this.uwork = uwork;
this.storageCache = storageCache;
}
public async Task Consume(ConsumeContext<UploadTaskCompleteEvent> context)
{
var @event = context.Message;
var storage = router.Route(@event.ProviderCode);
var taskCache = await storageCache.GetAsync(@event.SessionId);
if(@event.ProviderCode == "Local")
{
await storage.CompleteUploadAsync(new StorageContracts.CompleteUploadCommand(
@ -39,6 +46,14 @@ namespace FileService.Application.EventHandler
Checksum: s.Checksum
)).ToList()
), context.CancellationToken);
uploadFile.Create(new Domain.Entities.UploadFile(
ownerId: @event.OperatorId,
fileName: @event.FileName,
fileSize: taskCache.FileSize,
contentType: @event.ContentType,
new Domain.ValueObjects.StorageLocation(taskCache.ProviderCode, taskCache.Bucket, taskCache.ObjectKey, taskCache.Region),
checkSum: new Domain.ValueObjects.CheckSum("md5", @event.CheckSun)
));
}
}
}

View File

@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\FileService.Domain\FileService.Domain.csproj" />
<ProjectReference Include="..\IM.Application\IM.Application.csproj" />
<ProjectReference Include="..\IM.Commons\IM.Commons.csproj" />
<ProjectReference Include="..\IM.InitCommon\IM.InitCommon.csproj" />
</ItemGroup>

View File

@ -1,4 +1,5 @@
using FileService.Application.UploadFile;
using FileService.Application.UploadFileTask;
using IM.Commons;
using Microsoft.Extensions.DependencyInjection;
@ -9,6 +10,7 @@ namespace FileService.Application
public void Initialize(IServiceCollection services)
{
services.AddScoped<UploadFileService>();
services.AddScoped<UploadFileTaskService>();
}
}
}

View File

@ -0,0 +1,10 @@
using FileService.Application.StorageContracts;
namespace FileService.Application.Ports
{
public interface ILocalChunkStorage
{
Task SavePartAsync(
SaveLocalPartCommand command);
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileService.Application.StorageContracts
{
public record SaveLocalPartCommand(
string UploadSessionId,
int PartNumber,
Stream Stream,
long ContentLength,
string? Checksum = null);
}

View File

@ -25,14 +25,14 @@ namespace FileService.Application.StorageContracts
public int TotalPartCount { get; init; }
public long UploadedBytes { get; private set; }
public long UploadedBytes { get; set; }
public DateTimeOffset CreatedAt { get; init; }
public DateTimeOffset ExpireAt { get; init; }
public Dictionary<int, UploadPart> Parts { get; init; } = new();
public UploadRuntimeCache() { }
public UploadRuntimeCache(string taskId, string providerCode,
string uploadSessionId, string bucket, string region,
string objectKey, long fileSize, int totalPartCount,

View File

@ -1,26 +1,19 @@
using AutoMapper;
using FileService.Application.Ports;
using FileService.Application.StorageContracts;
using FileService.Domain.Entities;
using FileService.Domain.IReposities;
using IM.Commons;
using IM.Commons.IntegrationEvents;
using IM.InitCommon;
using MassTransit;
using MassTransit.Internals;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileService.Application.UploadFileTask
{
public class UploadFileTaskService(IUploadTaskReposity reposity,
IMapper mapper, IObjectStorageRouter router,
IOptions<StorageOptions> options, IStorageRedisCache redis,
IPublishEndpoint endpoint
IPublishEndpoint endpoint, ILocalChunkStorage localChunkStorage
)
{
private readonly IUploadTaskReposity reposity = reposity;
@ -29,23 +22,24 @@ namespace FileService.Application.UploadFileTask
private readonly IOptions<StorageOptions> options = options;
private readonly IStorageRedisCache redis = redis;
private readonly IPublishEndpoint endpoint = endpoint;
private readonly ILocalChunkStorage localChunkStorage = localChunkStorage;
private readonly IObjectStoragePort storage = router.Route(options.Value.DefaultProviderCode);
public async Task<Result<TaskInitResponse>> InitTaskAsync(UploadTaskInitCommand command)
{
CancellationToken cancellationToken = CancellationToken.None;
var task = command.ToUploadTask();
var date = DateTime.Now;
var storageOption = options.Value.Providers[options.Value.DefaultProviderCode];
var storage = router.Route(storageOption.ProviderCode);
var initRes = await storage.InitUploadAsync(new StorageContracts.InitiateUploadCommand(
var initUpdateCommand = new StorageContracts.InitiateUploadCommand(
ProviderCode: storageOption.ProviderCode,
Bucket: storageOption.Bucket,
ObjectKey: storageOption.Endpoint,
ContentType:task.ContentType.Value,
ObjectKey: $"{storageOption.LocalRootPath}\\{date.Year}\\{date.Month}\\{date.Day}\\{command.FileName}",
ContentType: task.ContentType.Value,
ContentLength: command.FileSize,
null
), cancellationToken);
null);
var initRes = await storage.InitUploadAsync(initUpdateCommand, cancellationToken);
var res = mapper.Map<TaskInitResponse>(initRes);
res.TaskId = task.Id;
@ -59,7 +53,7 @@ namespace FileService.Application.UploadFileTask
uploadSessionId: res.UploadSessionId,
bucket: storageOption.Bucket,
region: storageOption.Region,
objectKey: storageOption.Endpoint,
objectKey: initUpdateCommand.ObjectKey,
fileSize: task.FileSize,
totalPartCount: (int)(task.FileSize % storageOption.DefaultPartSizeBytes > 0 ?
(task.FileSize / storageOption.DefaultPartSizeBytes) + 1 :
@ -78,6 +72,11 @@ namespace FileService.Application.UploadFileTask
return Result.Fail<PresignedUrl>(ResultCode.CHUNK_NOT_FOUND);
}
if(taskCache.TotalPartCount < partNum)
{
return Result.Fail<PresignedUrl>(ResultCode.CHUNK_NOT_FOUND);
}
var presignUrl = await storage.GenerateUploadUrlAsync(new GenerateUploadUrlCommand(
ProviderCode: taskCache.ProviderCode,
Bucket: taskCache.Bucket,
@ -99,6 +98,12 @@ namespace FileService.Application.UploadFileTask
return Result.Fail<UploadTaskResponse>(ResultCode.CHUNK_NOT_FOUND);
}
if(taskCache.Parts.Count < taskCache.TotalPartCount)
{
return Result.Fail<UploadTaskResponse>(ResultCode.CHUNK_COMBINE_FAIL);
}
var task = await reposity.FindByIdAsync(Guid.Parse(taskCache.TaskId));
//var res = await storage.CompleteUploadAsync(new CompleteUploadCommand(
// ProviderCode: taskCache.ProviderCode,
@ -116,6 +121,7 @@ namespace FileService.Application.UploadFileTask
await endpoint.Publish(new UploadTaskCompleteEvent()
{
OperatorId = command.userId,
Bucket = taskCache.Bucket,
FileName = task.FileName.ToString(),
ObjectKey = taskCache.ObjectKey,
@ -126,10 +132,39 @@ namespace FileService.Application.UploadFileTask
ProviderCode = taskCache.ProviderCode,
Region = taskCache.Region,
SessionId = command.UploadSessionId,
TaskId = task.Id
});
TaskId = task.Id,
FileSize = task.FileSize,
ContentType = task.ContentType.ToString(),
CheckSun = task.CheckSum.Value
}, cancellationToken);
return Result.Success(mapper.Map<UploadTaskResponse>(task));
}
public async Task<Result<CompleteUploadResult>> UploadPartAsync(UploadPartCommand command)
{
var taskCache = await redis.GetAsync(command.SessionId);
if(taskCache is null)
{
return Result.Fail<CompleteUploadResult>(ResultCode.CHUNK_NOT_FOUND);
}
await localChunkStorage.SavePartAsync(new SaveLocalPartCommand(
UploadSessionId: command.SessionId,
PartNumber: command.PartNum,
Stream: command.Stream,
ContentLength: command.ContentLength
));
taskCache.AddOrUpdatePart(new StorageContracts.UploadPart(command.PartNum, command.PartNum.ToString(), command.ContentLength));
await redis.SetAsync(taskCache);
var location = new Domain.ValueObjects.StorageLocation(
storageProvider: taskCache.ProviderCode,
bucket: taskCache.Bucket,
objectKey: taskCache.ObjectKey,
region: taskCache.Region
);
return Result.Success(new CompleteUploadResult(location, command.PartNum.ToString(), command.ContentLength));
}
}
}

View File

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FileService.Application.UploadFileTask
{
public record UploadPartCommand(Stream Stream, string SessionId, int PartNum, long ContentLength);
}

View File

@ -2,7 +2,9 @@
using FileService.Domain.IReposities;
using FileService.Infrastructure.Reposites;
using FileService.Infrastructure.Storage;
using IM.Application.Abstractions;
using IM.Commons;
using IM.Infrastructure.Efcore;
using Microsoft.Extensions.DependencyInjection;
namespace FileService.Infrastructure
@ -17,6 +19,8 @@ namespace FileService.Infrastructure
services.AddScoped<IRedisService, RedisCacheService>();
services.AddScoped<IObjectStorageRouter, ObjectStorageRouter>();
services.AddScoped<IStorageRedisCache,StorageCacheService>();
services.AddScoped<ILocalChunkStorage, LocalStorageAdapter>();
services.AddScoped<IUnitOfWork, EfUnitOfWork<FileDbContext>>();
}
}
}

View File

@ -8,10 +8,11 @@ using StackExchange.Redis;
namespace FileService.Infrastructure.Storage
{
public class LocalStorageAdapter(IStorageRedisCache redis, IOptions<StorageOptions> options) : IObjectStoragePort
public class LocalStorageAdapter(IStorageRedisCache redis, IOptions<StorageOptions> options) : IObjectStoragePort, ILocalChunkStorage
{
private readonly IStorageRedisCache redis = redis;
private readonly IOptions<StorageOptions> options = options;
private readonly StorageProviderOptions providerOptions = options.Value.Providers[options.Value.DefaultProviderCode];
public string ProviderCode => "Local";
@ -28,7 +29,7 @@ namespace FileService.Infrastructure.Storage
public async Task<Result<object>> MergeAsync(string sessionId, string objectKey, IReadOnlyList<UploadPart> parts)
{
var rootPath = options.Value.Providers[options.Value.DefaultProviderCode].LocalRootPath;
var tempPath = Path.Combine(rootPath, "temp"); // 项目根目录下 uploads // 最终文件存储路径(这里可以用你之前 ObjectNameGenerator 生成的名字)
var tempPath = Path.Combine(rootPath, sessionId, "parts"); // 项目根目录下 uploads // 最终文件存储路径(这里可以用你之前 ObjectNameGenerator 生成的名字)
var finalPath = Path.Combine(rootPath, objectKey);
var finalDir = Path.GetDirectoryName(finalPath);
Directory.CreateDirectory(finalDir);
@ -50,7 +51,7 @@ namespace FileService.Infrastructure.Storage
// new("progress", progress.ToString("F2"))
//});
}
var chunkPath = Path.Combine(tempPath, $"{i}.part.tmp");
var chunkPath = Path.Combine(tempPath, $"{i}.part");
if (!File.Exists(chunkPath))
return Result.Fail(ResultCode.CHUNK_NOT_FOUND);
using (var chunkStream = new FileStream(chunkPath, FileMode.Open))
@ -76,7 +77,7 @@ namespace FileService.Infrastructure.Storage
{
var baseUrl = options.Value.Providers[options.Value.DefaultProviderCode].LocalUploadApiBaseUrl;
return new PresignedUrl(
baseUrl + $"?partNumber={command.PartNumber}",
baseUrl + $"local/parts/upload?sessionId={command.UploadSessionId}&partNumber={command.PartNumber}",
new Dictionary<string, string>(),
ExpiresAt: DateTimeOffset.Now.Add(options.Value.Providers[options.Value.DefaultProviderCode].UploadUrlExpiresIn)
);
@ -88,5 +89,31 @@ namespace FileService.Infrastructure.Storage
var location = new StorageLocation();
return new InitiateUploadResult(sessionId.ToString(),location);
}
public async Task SavePartAsync(SaveLocalPartCommand command)
{
var path = BuildPartPath(
command.UploadSessionId,
command.PartNumber);
Directory.CreateDirectory(
Path.GetDirectoryName(path)!);
await using var fs = File.Create(path);
await command.Stream.CopyToAsync(fs);
await fs.FlushAsync();
}
private string BuildPartPath(
string uploadSessionId,
int partNumber)
{
return Path.Combine(
providerOptions.LocalRootPath,
uploadSessionId,
"parts",
$"{partNumber}.part");
}
}
}

View File

@ -0,0 +1,23 @@
using FileService.Application.StorageContracts;
using FluentValidation;
namespace FileService.WebApi.Controllers.FileTask
{
public class CompleteTaskRequest
{
public string SessionId { get; set; }
public List<UploadPart> Parts { get; set; }
}
public class CompleteTaskRequestValidator : AbstractValidator<CompleteTaskRequest>
{
public CompleteTaskRequestValidator()
{
RuleFor(x => x.SessionId).NotEmpty()
.NotNull();
RuleFor(x => x.Parts)
.NotNull();
}
}
}

View File

@ -36,10 +36,29 @@ namespace FileService.WebApi.Controllers.FileTask
return Ok(res);
}
//[HttpPost]
//public async Task<IActionResult> GetUploadUrl()
//{
[HttpGet("Getuploadurl")]
public async Task<IActionResult> GetUploadUrl(string sessionId, int partNum)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var res = await service.GenerateUrlAsync(sessionId, partNum, Guid.Parse(userId));
return Ok(res);
}
//}
[HttpPost("complete")]
public async Task<IActionResult> Complete([FromBody] CompleteTaskRequest request)
{
var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var res = await service.CompleteTaskAsync(new UploadTaskCompleteCommand(request.SessionId, Guid.Parse(userId), request.Parts));
return Ok(res);
}
[HttpPost("local/parts/upload")]
public async Task<IActionResult> LocalUpload(string sessionId, int partNumber, IFormFile file)
{
//var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);
var stream = file.OpenReadStream();
var res = await service.UploadPartAsync(new UploadPartCommand(stream, sessionId, partNumber, file.Length));
return Ok(res);
}
}
}

View File

@ -1,33 +1,25 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55412",
"sslPort": 44396
}
},
{
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5220",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5220"
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7007;http://localhost:5220",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
"ASPNETCORE_ENVIRONMENT": "Development",
"CONSUL_URL": "http://192.168.5.100:8501"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7007;http://localhost:5220"
},
"IIS Express": {
"commandName": "IISExpress",
@ -37,5 +29,14 @@
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55412",
"sslPort": 44396
}
}
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IM.Application.Abstractions
{
public interface IUnitOfWork
{
Task SaveChangesAsync(
CancellationToken cancellationToken = default);
}
}

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -8,6 +8,7 @@ namespace IM.Commons.IntegrationEvents
{
public class UploadTaskCompleteEvent
{
public Guid OperatorId { get; set;}
public Guid TaskId { get; set; }
public string SessionId { get; set; }
public string FileName { get; set; }
@ -15,6 +16,9 @@ namespace IM.Commons.IntegrationEvents
public string Bucket { get; set; }
public string Region { get; set; }
public string ObjectKey { get; set; }
public long FileSize { get; set; }
public string ContentType { get; set; }
public string CheckSun { get; set; }
public IReadOnlyList<UploadPart> Parts { get; set; }
}
public sealed record UploadPart(

View File

@ -42,8 +42,8 @@ namespace IM.InitCommon
public long MaxObjectSizeBytes { get; init; } = 1024L * 1024 * 1024;
public int MinPartSizeBytes { get; init; } = 5 * 1024 * 1024;
public int DefaultPartSizeBytes { get; init; } = 5 * 1024 * 1024;
public long MinPartSizeBytes { get; init; } = 5 * 1024 * 1024;
public long DefaultPartSizeBytes { get; init; } = 5 * 1024 * 1024;
public int MaxPartCount { get; init; } = 10_000;
}

View File

@ -65,6 +65,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileService.WebApi", "FileS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileService.Application", "FileService.Application\FileService.Application.csproj", "{A05B43F3-3391-4ACC-A8BD-B9B7AEABC90B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IM.Application", "IM.Application\IM.Application.csproj", "{3B7CAE97-DE5A-48B9-87BC-A44E04BC9A36}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -167,6 +169,10 @@ Global
{A05B43F3-3391-4ACC-A8BD-B9B7AEABC90B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A05B43F3-3391-4ACC-A8BD-B9B7AEABC90B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A05B43F3-3391-4ACC-A8BD-B9B7AEABC90B}.Release|Any CPU.Build.0 = Release|Any CPU
{3B7CAE97-DE5A-48B9-87BC-A44E04BC9A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B7CAE97-DE5A-48B9-87BC-A44E04BC9A36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B7CAE97-DE5A-48B9-87BC-A44E04BC9A36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B7CAE97-DE5A-48B9-87BC-A44E04BC9A36}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -196,6 +202,7 @@ Global
{6827DF98-EC6C-4854-8E5A-D3FCC66E0A6D} = {136DC96D-82FC-4F77-91A7-B7D91298A323}
{83C58EFA-00FB-443D-8311-2D4664A3FAB7} = {136DC96D-82FC-4F77-91A7-B7D91298A323}
{A05B43F3-3391-4ACC-A8BD-B9B7AEABC90B} = {136DC96D-82FC-4F77-91A7-B7D91298A323}
{3B7CAE97-DE5A-48B9-87BC-A44E04BC9A36} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67902CF1-7322-4BD9-B1BD-10391EC03A00}

View File

@ -0,0 +1,25 @@
using IM.Application.Abstractions;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IM.Infrastructure.Efcore
{
public sealed class EfUnitOfWork<TDbContext> : IUnitOfWork where TDbContext : DbContext
{
private readonly TDbContext dbContext;
public EfUnitOfWork(TDbContext dbContext)
{
this.dbContext = dbContext;
}
public Task SaveChangesAsync(CancellationToken cancellationToken = default)
{
return dbContext.SaveChangesAsync(cancellationToken);
}
}
}

View File

@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\DomainCommons\IM.DomainCommons.csproj" />
<ProjectReference Include="..\IM.Application\IM.Application.csproj" />
</ItemGroup>
</Project>

View File

@ -8,6 +8,7 @@ namespace MessageService.WebApi.Application.Conversation
public ConversationMapperConfig()
{
CreateMap<Domain.Entities.Conversation, ConversationResponse>()
.ForMember(dest => dest.DateTime, opt => opt.MapFrom(src => src.ModificationTime))
;
}
}

View File

@ -31,5 +31,6 @@ namespace MessageService.WebApi.Application.Dtos
/// 最后一条最新消息
/// </summary>
public string LastMessage { get; set; }
public DateTime DateTime { get; set; }
}
}

View File

@ -44,7 +44,7 @@ namespace IdentityService.WebApi.Applications.Auth
}
var token = await BuildTokenAsync(user);
var refreshToken = await tokenService.CreateRefreshTokenAsync(user.Id);
return Result<LoginResponse>.Success(new LoginResponse(user.Id, token, refreshToken, null));
return Result<LoginResponse>.Success(new LoginResponse(user.Id, token, refreshToken, null, user.UserName, user.NickName,user.Avatar, user.CreationTime));
}
public async Task<Result<UserResponse?>> RegisterAsync(string userName, string password, string nickName)
{
@ -80,7 +80,7 @@ namespace IdentityService.WebApi.Applications.Auth
var token = await BuildTokenAsync(user);
return Result<LoginResponse>.Success(new LoginResponse(user.Id, token, refreshToken, null));
return Result<LoginResponse>.Success(new LoginResponse(user.Id, token, refreshToken, null, user.UserName, user.NickName, user.Avatar, user.CreationTime));
}
private async Task<string> BuildTokenAsync(Domain.Entities.User user)
{

View File

@ -6,13 +6,21 @@
public string Token { get; init; }
public string RefreshToken { get; init; }
public DateTime? Expired { get; init; }
public string UserName { get; set; }
public string NickName { get; set; }
public string? Avatar { get; set; }
public DateTimeOffset CreationTime { get; set; }
public LoginResponse(Guid userId, string token, string refreshToken, DateTime? expired)
public LoginResponse(Guid userId, string token, string refreshToken, DateTime? expired, string userName, string nickName, string? avatar, DateTimeOffset creationTime)
{
UserId = userId;
Token = token;
RefreshToken = refreshToken;
Expired = expired;
UserName = userName;
NickName = nickName;
Avatar = avatar;
CreationTime = creationTime;
}
}
}