Files: added HasLogo
This commit is contained in:
parent
01d1d14788
commit
8b009551fb
@ -35,6 +35,7 @@ public interface IProviderDao
|
||||
IAsyncEnumerable<IProviderInfo> GetProvidersInfoAsync(Guid userId);
|
||||
Task<int> SaveProviderInfoAsync(string providerKey, string customerTitle, AuthData authData, FolderType folderType);
|
||||
Task<bool> UpdateProviderInfoAsync(int linkId, FolderType rootFolderType);
|
||||
Task<bool> UpdateProviderInfoAsync(int linkId, bool hasLogo);
|
||||
Task<bool> UpdateProviderInfoAsync(int linkId, string folderId, FolderType folderType, bool @private);
|
||||
Task<int> UpdateProviderInfoAsync(int linkId, string customerTitle, AuthData authData, FolderType folderType, Guid? userId = null);
|
||||
Task<int> UpdateBackupProviderInfoAsync(string providerKey, string customerTitle, AuthData authData);
|
||||
|
@ -446,6 +446,7 @@ internal class FolderDao : AbstractDao, IFolderDao<int>
|
||||
toUpdate.CreateBy = folder.CreateBy;
|
||||
toUpdate.ModifiedOn = _tenantUtil.DateTimeToUtc(folder.ModifiedOn);
|
||||
toUpdate.ModifiedBy = folder.ModifiedBy;
|
||||
toUpdate.HasLogo = folder.HasLogo;
|
||||
|
||||
await filesDbContext.SaveChangesAsync();
|
||||
|
||||
|
@ -42,6 +42,7 @@ public class DbFilesThirdpartyAccount : BaseEntity, IDbFile, IDbSearch
|
||||
public int TenantId { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
public override object[] GetKeys()
|
||||
{
|
||||
@ -137,6 +138,8 @@ public static class DbFilesThirdpartyAccountExtension
|
||||
.UseCollation("utf8_general_ci");
|
||||
|
||||
entity.Property(e => e.Private).HasColumnName("private");
|
||||
|
||||
entity.Property(e => e.HasLogo).HasColumnName("has_logo");
|
||||
});
|
||||
}
|
||||
public static void PgSqlAddDbFilesThirdpartyAccount(this ModelBuilder modelBuilder)
|
||||
@ -188,7 +191,9 @@ public static class DbFilesThirdpartyAccountExtension
|
||||
|
||||
entity.Property(e => e.FolderId).HasColumnName("folder_id");
|
||||
|
||||
entity.Property(e => e.Private).HasColumnName("private");
|
||||
entity.Property(e => e.Private).HasColumnName("private");
|
||||
|
||||
entity.Property(e => e.HasLogo).HasColumnName("has_logo");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ public class DbFolder : IDbFile, IDbSearch, ISearchItem
|
||||
public int FoldersCount { get; set; }
|
||||
public int FilesCount { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
[Ignore]
|
||||
public string IndexName => Tables.Folder;
|
||||
@ -130,6 +131,8 @@ public static class DbFolderExtension
|
||||
.UseCollation("utf8_general_ci");
|
||||
|
||||
entity.Property(e => e.Private).HasColumnName("private");
|
||||
|
||||
entity.Property(e => e.HasLogo).HasColumnName("has_logo");
|
||||
});
|
||||
}
|
||||
public static void PgSqlAddDbFolder(this ModelBuilder modelBuilder)
|
||||
@ -178,6 +181,8 @@ public static class DbFolderExtension
|
||||
.HasMaxLength(400);
|
||||
|
||||
entity.Property(e => e.Private).HasColumnName("private");
|
||||
|
||||
entity.Property(e => e.HasLogo).HasColumnName("has_logo");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ public class Folder<T> : FileEntry<T>, IFolder
|
||||
public string FolderUrl { get; set; }
|
||||
public bool Pinned { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
public override bool IsNew
|
||||
{
|
||||
get => Convert.ToBoolean(NewForMe);
|
||||
|
@ -124,6 +124,7 @@ internal abstract class BoxDaoBase : ThirdPartyProviderDao<BoxProviderInfo>
|
||||
folder.FilesCount = boxFolder.ItemCollection != null ? boxFolder.ItemCollection.Entries.Count(item => item is BoxFile) : 0;
|
||||
folder.FoldersCount = boxFolder.ItemCollection != null ? boxFolder.ItemCollection.Entries.Count(item => item is BoxFolder) : 0;
|
||||
folder.Private = ProviderInfo.Private;
|
||||
folder.HasLogo = ProviderInfo.HasLogo;
|
||||
SetFolderType(folder, isRoot);
|
||||
|
||||
if (folder.CreateOn != DateTime.MinValue && folder.CreateOn.Kind == DateTimeKind.Utc)
|
||||
|
@ -57,6 +57,7 @@ internal class BoxProviderInfo : IProviderInfo
|
||||
public FolderType FolderType { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
public string BoxRootId
|
||||
{
|
||||
|
@ -128,6 +128,7 @@ internal abstract class DropboxDaoBase : ThirdPartyProviderDao<DropboxProviderIn
|
||||
folder.ModifiedOn = isRoot ? ProviderInfo.CreateOn : default;
|
||||
folder.Title = MakeFolderTitle(dropboxFolder);
|
||||
folder.Private = ProviderInfo.Private;
|
||||
folder.HasLogo = ProviderInfo.HasLogo;
|
||||
SetFolderType(folder, isRoot);
|
||||
|
||||
if (folder.CreateOn != DateTime.MinValue && folder.CreateOn.Kind == DateTimeKind.Utc)
|
||||
|
@ -56,6 +56,7 @@ internal class DropboxProviderInfo : IProviderInfo
|
||||
public FolderType FolderType { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
private readonly DropboxStorageDisposableWrapper _wrapper;
|
||||
private readonly DropboxProviderInfoHelper _dropboxProviderInfoHelper;
|
||||
|
@ -140,6 +140,7 @@ internal abstract class GoogleDriveDaoBase : ThirdPartyProviderDao<GoogleDrivePr
|
||||
folder.CreateOn = isRoot ? ProviderInfo.CreateOn : (driveEntry.CreatedTime ?? default);
|
||||
folder.ModifiedOn = isRoot ? ProviderInfo.CreateOn : (driveEntry.ModifiedTime ?? default);
|
||||
folder.Private = ProviderInfo.Private;
|
||||
folder.HasLogo = ProviderInfo.HasLogo;
|
||||
SetFolderType(folder, isRoot);
|
||||
|
||||
folder.Title = MakeFolderTitle(driveEntry);
|
||||
|
@ -60,6 +60,7 @@ internal class GoogleDriveProviderInfo : IProviderInfo
|
||||
public FolderType FolderType { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
public string DriveRootId
|
||||
{
|
||||
get
|
||||
|
@ -127,6 +127,7 @@ internal abstract class OneDriveDaoBase : ThirdPartyProviderDao<OneDriveProvider
|
||||
folder.CreateOn = isRoot ? ProviderInfo.CreateOn : (onedriveFolder.CreatedDateTime.HasValue ? _tenantUtil.DateTimeFromUtc(onedriveFolder.CreatedDateTime.Value.DateTime) : default);
|
||||
folder.ModifiedOn = isRoot ? ProviderInfo.CreateOn : (onedriveFolder.LastModifiedDateTime.HasValue ? _tenantUtil.DateTimeFromUtc(onedriveFolder.LastModifiedDateTime.Value.DateTime) : default);
|
||||
folder.Private = ProviderInfo.Private;
|
||||
folder.HasLogo = ProviderInfo.HasLogo;
|
||||
SetFolderType(folder, isRoot);
|
||||
|
||||
folder.Title = MakeItemTitle(onedriveFolder);
|
||||
|
@ -57,6 +57,7 @@ internal class OneDriveProviderInfo : IProviderInfo
|
||||
public FolderType FolderType { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
private readonly OneDriveStorageDisposableWrapper _wrapper;
|
||||
private readonly OneDriveProviderInfoHelper _oneDriveProviderInfoHelper;
|
||||
|
@ -229,6 +229,26 @@ internal class ProviderAccountDao : IProviderDao
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateProviderInfoAsync(int linkId, bool hasLogo)
|
||||
{
|
||||
using var filesDbContext = _dbContextFactory.CreateDbContext();
|
||||
var forUpdate = await filesDbContext.ThirdpartyAccount
|
||||
.Where(r => r.Id == linkId)
|
||||
.Where(r => r.TenantId == TenantID)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (forUpdate == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
forUpdate.HasLogo = hasLogo;
|
||||
|
||||
await filesDbContext.SaveChangesAsync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateProviderInfoAsync(int linkId, string folderId, FolderType roomType, bool @private)
|
||||
{
|
||||
using var filesDbContext = _dbContextFactory.CreateDbContext();
|
||||
@ -496,6 +516,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
var folderId = input.FolderId;
|
||||
var createOn = _tenantUtil.DateTimeFromUtc(input.CreateOn);
|
||||
var authData = new AuthData(input.Url, input.UserName, DecryptPassword(input.Password, id), token);
|
||||
var hasLogo = input.HasLogo;
|
||||
|
||||
if (key == ProviderTypes.Box)
|
||||
{
|
||||
@ -515,6 +536,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
box.FolderType = folderType;
|
||||
box.FolderId = folderId;
|
||||
box.Private = privateRoom;
|
||||
box.HasLogo = hasLogo;
|
||||
|
||||
return box;
|
||||
}
|
||||
@ -537,6 +559,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
drop.FolderType = folderType;
|
||||
drop.FolderId = folderId;
|
||||
drop.Private = privateRoom;
|
||||
drop.HasLogo = hasLogo;
|
||||
|
||||
return drop;
|
||||
}
|
||||
@ -559,6 +582,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
sh.FolderType = folderType;
|
||||
sh.FolderId = folderId;
|
||||
sh.Private = privateRoom;
|
||||
sh.HasLogo = hasLogo;
|
||||
|
||||
return sh;
|
||||
}
|
||||
@ -581,6 +605,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
gd.FolderType = folderType;
|
||||
gd.FolderId = folderId;
|
||||
gd.Private = privateRoom;
|
||||
gd.HasLogo = hasLogo;
|
||||
|
||||
return gd;
|
||||
}
|
||||
@ -603,6 +628,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
od.FolderType = folderType;
|
||||
od.FolderId = folderId;
|
||||
od.Private = privateRoom;
|
||||
od.HasLogo = hasLogo;
|
||||
|
||||
return od;
|
||||
}
|
||||
@ -633,6 +659,7 @@ internal class ProviderAccountDao : IProviderDao
|
||||
sharpBoxProviderInfo.FolderType = folderType;
|
||||
sharpBoxProviderInfo.FolderId = folderId;
|
||||
sharpBoxProviderInfo.Private = privateRoom;
|
||||
sharpBoxProviderInfo.HasLogo = hasLogo;
|
||||
|
||||
return sharpBoxProviderInfo;
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ public class SharePointProviderInfo : IProviderInfo
|
||||
public string SpRootFolderId { get; set; } = "/Shared Documents";
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
|
||||
public SharePointProviderInfo(
|
||||
ILogger<SharePointProviderInfo> logger,
|
||||
@ -576,6 +577,7 @@ public class SharePointProviderInfo : IProviderInfo
|
||||
result.FoldersCount = 0;
|
||||
result.Error = errorFolder.Error;
|
||||
result.Private = Private;
|
||||
result.HasLogo = HasLogo;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -599,6 +601,7 @@ public class SharePointProviderInfo : IProviderInfo
|
||||
result.FilesCount = 0;
|
||||
result.FoldersCount = 0;
|
||||
result.Private = Private;
|
||||
result.HasLogo = HasLogo;
|
||||
|
||||
SetFolderType(result, isRoot);
|
||||
|
||||
|
@ -310,6 +310,7 @@ internal abstract class SharpBoxDaoBase : ThirdPartyProviderDao<SharpBoxProvider
|
||||
folder.FilesCount = 0; /*fsEntry.Count - childFoldersCount NOTE: Removed due to performance isssues*/
|
||||
folder.FoldersCount = 0; /*childFoldersCount NOTE: Removed due to performance isssues*/
|
||||
folder.Private = ProviderInfo.Private;
|
||||
folder.HasLogo = ProviderInfo.HasLogo;
|
||||
SetFolderType(folder, isRoot);
|
||||
|
||||
if (folder.CreateOn != DateTime.MinValue && folder.CreateOn.Kind == DateTimeKind.Utc)
|
||||
|
@ -112,6 +112,7 @@ internal class SharpBoxProviderInfo : IProviderInfo
|
||||
public FolderType FolderType { get; set; }
|
||||
public string FolderId { get; set; }
|
||||
public bool Private { get; set; }
|
||||
public bool HasLogo { get; set; }
|
||||
private readonly SharpBoxStorageDisposableWrapper _wrapper;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user