Files: fix merge
This commit is contained in:
parent
978cf0e34e
commit
7862ed159d
@ -34,6 +34,7 @@ using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
using ASC.Api.Core;
|
||||
using ASC.Api.Utils;
|
||||
using ASC.Common;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Configuration;
|
||||
@ -184,7 +185,7 @@ namespace ASC.Api.Documents
|
||||
/// <category>Folders</category>
|
||||
/// <returns>My folder contents</returns>
|
||||
[Read("@my")]
|
||||
public FolderContentWrapper GetMyFolder(Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
public FolderContentWrapper<int> GetMyFolder(Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
{
|
||||
return ToFolderContentWrapper(GlobalFolderHelper.FolderMy, userIdOrGroupId, filterType, withsubfolders);
|
||||
}
|
||||
@ -227,7 +228,7 @@ namespace ASC.Api.Documents
|
||||
/// <category>Folders</category>
|
||||
/// <returns>Shared folder contents</returns>
|
||||
[Read("@share")]
|
||||
public FolderContentWrapper<int> GetShareFolder(Guid userIdOrGroupId, FilterType filterType, bool withsubfold)
|
||||
public FolderContentWrapper<int> GetShareFolder(Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
{
|
||||
return ToFolderContentWrapper(GlobalFolderHelper.FolderShare, userIdOrGroupId, filterType, withsubfolders);
|
||||
}
|
||||
@ -243,7 +244,7 @@ namespace ASC.Api.Documents
|
||||
[Read("@trash")]
|
||||
public FolderContentWrapper<int> GetTrashFolder(Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
{
|
||||
return ToFolderContentWrapper(Convert.ToInt32(GlobalFolderHelper.FolderTrash), userIdOrGroupId, filterType, withsubfold);
|
||||
return ToFolderContentWrapper(Convert.ToInt32(GlobalFolderHelper.FolderTrash), userIdOrGroupId, filterType, withsubfolders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -258,15 +259,15 @@ namespace ASC.Api.Documents
|
||||
/// <param name="filterType" optional="true" remark="Allowed values: None (0), FilesOnly (1), FoldersOnly (2), DocumentsOnly (3), PresentationsOnly (4), SpreadsheetsOnly (5) or ImagesOnly (7)">Filter type</param>
|
||||
/// <returns>Folder contents</returns>
|
||||
[Read("{folderId}", order: int.MaxValue)]
|
||||
public FolderContentWrapper GetFolder(string folderId, Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
public FolderContentWrapper<string> GetFolder(string folderId, Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
{
|
||||
return FilesControllerHelperString.GetFolder(folderId, userIdOrGroupId, filterType, withsubfolders).NotFoundIfNull
|
||||
return FilesControllerHelperString.GetFolder(folderId, userIdOrGroupId, filterType, withsubfolders).NotFoundIfNull();
|
||||
}
|
||||
|
||||
[Read("{folderId:int}", order: int.MaxValue)]
|
||||
public FolderContentWrapper<int> GetFolder(int folderId, Guid userIdOrGroupId, FilterType filterType)
|
||||
public FolderContentWrapper<int> GetFolder(int folderId, Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
{
|
||||
return FilesControllerHelperInt.GetFolder(folderId, userIdOrGroupId, filterType);
|
||||
return FilesControllerHelperInt.GetFolder(folderId, userIdOrGroupId, filterType, withsubfolders);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1487,7 +1488,7 @@ namespace ASC.Api.Documents
|
||||
startIndex);
|
||||
}
|
||||
|
||||
private FolderContentWrapper<int> ToFolderContentWrapper(int folderId, Guid userIdOrGroupId, FilterType filterType)
|
||||
private FolderContentWrapper<int> ToFolderContentWrapper(int folderId, Guid userIdOrGroupId, FilterType filterType, bool withsubfolders)
|
||||
{
|
||||
if (!Enum.TryParse(ApiContext.SortBy, true, out SortedByType sortBy))
|
||||
{
|
||||
|
@ -115,7 +115,6 @@ namespace ASC.Files.Core.Data
|
||||
|
||||
public Folder<int> GetRootFolder(int folderId)
|
||||
{
|
||||
var folderIdString = folderId.ToString();
|
||||
var id = FilesDbContext.Tree
|
||||
.Where(r => r.FolderId == folderId)
|
||||
.OrderByDescending(r => r.Level)
|
||||
@ -160,8 +159,7 @@ namespace ASC.Files.Core.Data
|
||||
|
||||
if (orderBy == null) orderBy = new OrderBy(SortedByType.DateAndTime, false);
|
||||
|
||||
var parentIdString = parentId.ToString();
|
||||
var q = GetFolderQuery(r => r.ParentId.ToString() == parentIdString);
|
||||
var q = GetFolderQuery(r => r.ParentId == parentId);
|
||||
|
||||
if (withSubfolders)
|
||||
{
|
||||
@ -342,18 +340,20 @@ namespace ASC.Files.Core.Data
|
||||
|
||||
//full path to root
|
||||
var oldTree = FilesDbContext.Tree
|
||||
.Where(r => r.FolderId == folder.ParentFolderID)
|
||||
.FirstOrDefault();
|
||||
.Where(r => r.FolderId == (int)folder.ParentFolderID);
|
||||
|
||||
foreach (var o in oldTree)
|
||||
{
|
||||
FolderId = folder.ID,
|
||||
ParentId = oldTree.ParentId,
|
||||
Level = oldTree.Level + 1
|
||||
};
|
||||
var treeToAdd = new DbFolderTree
|
||||
{
|
||||
FolderId = (int)folder.ID,
|
||||
ParentId = o.ParentId,
|
||||
Level = o.Level + 1
|
||||
};
|
||||
|
||||
FilesDbContext.Tree.Add(treeToAdd);
|
||||
}
|
||||
|
||||
FilesDbContext.SaveChanges();
|
||||
}
|
||||
|
||||
@ -605,7 +605,6 @@ namespace ASC.Files.Core.Data
|
||||
|
||||
private int GetFilesCount(int folderId)
|
||||
{
|
||||
var folderIdString = folderId.ToString();
|
||||
var count = Query(FilesDbContext.Files)
|
||||
.Distinct()
|
||||
.Where(r => FilesDbContext.Tree.Where(r => r.ParentId == folderId).Select(r => r.FolderId).Any(b => b == r.FolderId))
|
||||
|
@ -156,7 +156,7 @@ namespace ASC.Files.Thirdparty
|
||||
|
||||
if (!string.IsNullOrEmpty(searchText))
|
||||
{
|
||||
querySelect = querySelect.Where(r => BuildSearch(r, searchText, SearhTypeEnum.Any));
|
||||
querySelect = BuildSearch(querySelect, searchText, SearhTypeEnum.Any);
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -150,9 +150,9 @@ namespace ASC.Files.Helpers
|
||||
ProductEntryPoint = productEntryPoint;
|
||||
}
|
||||
|
||||
public FolderContentWrapper<T> GetFolder(T folderId, Guid userIdOrGroupId, FilterType filterType)
|
||||
public FolderContentWrapper<T> GetFolder(T folderId, Guid userIdOrGroupId, FilterType filterType, bool withSubFolders)
|
||||
{
|
||||
return ToFolderContentWrapper(folderId, userIdOrGroupId, filterType).NotFoundIfNull();
|
||||
return ToFolderContentWrapper(folderId, userIdOrGroupId, filterType, withSubFolders).NotFoundIfNull();
|
||||
}
|
||||
|
||||
public List<FileWrapper<T>> UploadFile(T folderId, UploadModel uploadModel)
|
||||
@ -766,7 +766,7 @@ namespace ASC.Files.Helpers
|
||||
}
|
||||
|
||||
|
||||
private FolderContentWrapper<T> ToFolderContentWrapper(T folderId, Guid userIdOrGroupId, FilterType filterType)
|
||||
private FolderContentWrapper<T> ToFolderContentWrapper(T folderId, Guid userIdOrGroupId, FilterType filterType, bool withSubFolders)
|
||||
{
|
||||
if (!Enum.TryParse(ApiContext.SortBy, true, out SortedByType sortBy))
|
||||
{
|
||||
@ -782,7 +782,7 @@ namespace ASC.Files.Helpers
|
||||
userIdOrGroupId.ToString(),
|
||||
ApiContext.FilterValue,
|
||||
false,
|
||||
false,
|
||||
withSubFolders,
|
||||
new OrderBy(sortBy, !ApiContext.SortDescending)),
|
||||
startIndex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user