fix: align backend APIs and upload flow
This commit is contained in:
@@ -5,14 +5,30 @@ namespace FileService.WebApi.Controllers.FileTask
|
||||
public class FileTaskInitRequest
|
||||
{
|
||||
public Guid ConversationId { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public string? ChatType { get; set; }
|
||||
public Guid? TargetId { get; set; }
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
public long FileSize { get; set; }
|
||||
public string ContentType { get; set; }
|
||||
public string CheckSum { get; set; }
|
||||
public string ContentType { get; set; } = string.Empty;
|
||||
public string CheckSum { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
public class FileTaskInitRequestValidator: AbstractValidator<FileTaskInitRequest>
|
||||
{
|
||||
|
||||
public FileTaskInitRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.FileName).NotEmpty().MaximumLength(255);
|
||||
RuleFor(x => x.FileSize).GreaterThan(0);
|
||||
RuleFor(x => x.ContentType).NotEmpty().MaximumLength(255);
|
||||
RuleFor(x => x.CheckSum).NotEmpty().MaximumLength(128);
|
||||
RuleFor(x => x.ChatType)
|
||||
.Must(value => string.IsNullOrWhiteSpace(value) ||
|
||||
value.Equals("PRIVATE", StringComparison.OrdinalIgnoreCase) ||
|
||||
value.Equals("GROUP", StringComparison.OrdinalIgnoreCase))
|
||||
.WithMessage("chatType 必须为 PRIVATE 或 GROUP");
|
||||
RuleFor(x => x.TargetId)
|
||||
.NotEmpty()
|
||||
.When(x => !string.IsNullOrWhiteSpace(x.ChatType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user