Merge branch 'master' of https://gitea.nxsir.cn/nanxun/IM_NEW
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
using FileService.Application.StorageContracts;
|
||||
using FileService.Domain.ValueObjects;
|
||||
using IM.Commons;
|
||||
using IM.InitCommon;
|
||||
using MassTransit;
|
||||
using MassTransit.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -11,14 +14,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace FileService.Infrastructure.Storage
|
||||
{
|
||||
public class LocalStorageAdapter : IObjectStoragePort
|
||||
public class LocalStorageAdapter(IRedisService redis, IOptions<StorageOptions> options) : IObjectStoragePort
|
||||
{
|
||||
private readonly IRedisService redis;
|
||||
|
||||
public LocalStorageAdapter(IRedisService redis)
|
||||
{
|
||||
this.redis = redis;
|
||||
}
|
||||
private readonly IRedisService redis = redis;
|
||||
private readonly IOptions<StorageOptions> options = options;
|
||||
|
||||
public string ProviderCode => "Local";
|
||||
|
||||
@@ -27,9 +26,14 @@ namespace FileService.Infrastructure.Storage
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<PresignedUrl> GenerateUploadUrlAsync(GenerateUploadUrlCommand command, CancellationToken token)
|
||||
public async Task<PresignedUrl> GenerateUploadUrlAsync(GenerateUploadUrlCommand command, CancellationToken token)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var baseUrl = options.Value.Providers[options.Value.DefaultProviderCode].LocalUploadApiBaseUrl;
|
||||
return new PresignedUrl(
|
||||
baseUrl + $"?partNumber={command.PartNumber}",
|
||||
new Dictionary<string, string>(),
|
||||
ExpiresAt: DateTimeOffset.Now.Add(options.Value.Providers[options.Value.DefaultProviderCode].UploadUrlExpiresIn)
|
||||
);
|
||||
}
|
||||
|
||||
public async Task<InitiateUploadResult> InitUploadAsync(InitiateUploadCommand command, CancellationToken token)
|
||||
|
||||
Reference in New Issue
Block a user