Merge branch 'develop' into feature/fix-hide/show-header

This commit is contained in:
TatianaLopaeva 2021-01-25 14:54:59 +03:00
commit bb8c1962fb
2 changed files with 9 additions and 41 deletions

View File

@ -1,10 +1,11 @@
using System.IO;

using Microsoft.AspNetCore.Http;
namespace ASC.Files.Core.Model
{
public class InsertFileModel
{
public Stream File { get; set; }
public IFormFile File { get; set; }
public string Title { get; set; }
public bool? CreateNewIfExist { get; set; }
public bool KeepConvertStatus { get; set; }

View File

@ -509,14 +509,7 @@ namespace ASC.Api.Documents
/// <category>Uploads</category>
/// <returns></returns>
[Create("@my/insert")]
public FileWrapper<int> InsertFileToMyFromBody([FromBody]InsertFileModel model)
{
return InsertFile(GlobalFolderHelper.FolderMy, model);
}
[Create("@my/insert")]
[Consumes("application/x-www-form-urlencoded")]
public FileWrapper<int> InsertFileToMyFromForm([FromForm]InsertFileModel model)
public FileWrapper<int> InsertFileToMyFromBody([FromForm] InsertFileModel model)
{
return InsertFile(GlobalFolderHelper.FolderMy, model);
}
@ -531,14 +524,7 @@ namespace ASC.Api.Documents
/// <category>Uploads</category>
/// <returns></returns>
[Create("@common/insert")]
public FileWrapper<int> InsertFileToCommonFromBody([FromBody]InsertFileModel model)
{
return InsertFile(GlobalFolderHelper.FolderCommon, model);
}
[Create("@common/insert")]
[Consumes("application/x-www-form-urlencoded")]
public FileWrapper<int> InsertFileToCommonFromForm([FromForm]InsertFileModel model)
public FileWrapper<int> InsertFileToCommonFromBody([FromForm] InsertFileModel model)
{
return InsertFile(GlobalFolderHelper.FolderCommon, model);
}
@ -554,31 +540,12 @@ namespace ASC.Api.Documents
/// <category>Uploads</category>
/// <returns></returns>
[Create("{folderId}/insert", order: int.MaxValue, DisableFormat = true)]
public FileWrapper<string> InsertFileFromBody(string folderId, [FromBody]InsertFileModel model)
public FileWrapper<string> InsertFile(string folderId, [FromForm] InsertFileModel model)
{
return InsertFile(folderId, model);
}
[Create("{folderId}/insert", order: int.MaxValue, DisableFormat = true)]
[Consumes("application/x-www-form-urlencoded")]
public FileWrapper<string> InsertFileFromForm(string folderId, [FromForm]InsertFileModel model)
{
return InsertFile(folderId, model);
}
private FileWrapper<string> InsertFile(string folderId, InsertFileModel model)
{
return FilesControllerHelperString.InsertFile(folderId, model.File, model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
return FilesControllerHelperString.InsertFile(folderId, model.File.OpenReadStream(), model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
}
[Create("{folderId:int}/insert", order: int.MaxValue - 1)]
public FileWrapper<int> InsertFileFromBody(int folderId, [FromBody]InsertFileModel model)
{
return InsertFile(folderId, model);
}
[Create("{folderId:int}/insert", order: int.MaxValue - 1)]
[Consumes("application/x-www-form-urlencoded")]
public FileWrapper<int> InsertFileFromForm(int folderId, [FromForm]InsertFileModel model)
{
return InsertFile(folderId, model);
@ -586,7 +553,7 @@ namespace ASC.Api.Documents
private FileWrapper<int> InsertFile(int folderId, InsertFileModel model)
{
return FilesControllerHelperInt.InsertFile(folderId, model.File, model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
return FilesControllerHelperInt.InsertFile(folderId, model.File.OpenReadStream(), model.Title, model.CreateNewIfExist, model.KeepConvertStatus);
}
/// <summary>