api-defaultvalue: add JsonPropertyNames

This commit is contained in:
SuhorukovAnton 2020-07-09 18:37:36 +03:00
parent 71c267939d
commit 28e70e91f6
13 changed files with 112 additions and 71 deletions

View File

@ -34,8 +34,9 @@ namespace ASC.Core.Billing
[DebuggerDisplay("{DueDate}")]
public class License
{
public string OriginalLicense { get; set; }
public string OriginalLicense { get; set; }
[JsonPropertyName("affiliate_id")]
public string AffiliateId { get; set; }
//[Obsolete]

View File

@ -37,6 +37,7 @@ namespace ASC.Web.Files.Classes
[Serializable]
public class FilesSettings : ISettings
{
[JsonPropertyName("EnableThirdpartySettings")]
public bool EnableThirdpartySetting { get; set; }
[JsonPropertyName("FastDelete")]

View File

@ -141,6 +141,7 @@ namespace ASC.Files.Core
public DateTime ModifiedOn;
[JsonPropertyName("created")]
public string ModifiedOnString
{
get { return ModifiedOn.Equals(default) ? null : ModifiedOn.ToString("g"); }

View File

@ -26,7 +26,7 @@
using System;
using System.Diagnostics;
using System.Text.Json.Serialization;
using ASC.Web.Core.Files;
using ASC.Web.Files.Classes;
using ASC.Web.Files.Utils;
@ -74,6 +74,7 @@ namespace ASC.Files.Core
public int Version { get; set; }
[JsonPropertyName("version_group")]
public int VersionGroup { get; set; }
public string Comment { get; set; }
@ -95,8 +96,10 @@ namespace ASC.Files.Core
set { base.Title = value; }
}
[JsonPropertyName("content_length")]
public long ContentLength { get; set; }
[JsonPropertyName("content_length_string")]
public string ContentLengthString
{
get { return FileSizeComment.FilesSizeToString(ContentLength); }
@ -128,6 +131,7 @@ namespace ASC.Files.Core
}
}
[JsonPropertyName("file_status")]
public FileStatus FileStatus
{
get
@ -154,6 +158,7 @@ namespace ASC.Files.Core
public bool Locked { get; set; }
[JsonPropertyName("locked_by")]
public string LockedBy { get; set; }
public override bool IsNew
@ -212,6 +217,7 @@ namespace ASC.Files.Core
private T _folderIdDisplay;
[JsonPropertyName("folder_id")]
public override T FolderIdDisplay
{
get

View File

@ -25,7 +25,7 @@
using System;
using System.Text.Json.Serialization;
using ASC.Files.Core.Security;
using ASC.Web.Files.Classes;
@ -41,28 +41,34 @@ namespace ASC.Files.Core
public virtual string Title { get; set; }
[JsonPropertyName("create_by_id")]
public Guid CreateBy { get; set; }
[JsonPropertyName("create_by")]
public string CreateByString
{
get { return !CreateBy.Equals(Guid.Empty) ? Global.GetUserName(CreateBy) : _createByString; }
set { _createByString = value; }
}
[JsonPropertyName("create_on")]
public string CreateOnString
{
get { return CreateOn.Equals(default) ? null : CreateOn.ToString("g"); }
set { throw new NotImplementedException(); }
}
[JsonPropertyName("modified_on")]
public string ModifiedOnString
{
get { return ModifiedOn.Equals(default) ? null : ModifiedOn.ToString("g"); }
set { throw new NotImplementedException(); }
}
[JsonPropertyName("modified_by_id")]
public Guid ModifiedBy { get; set; }
[JsonPropertyName("modified_by")]
public string ModifiedByString
{
get { return !ModifiedBy.Equals(Guid.Empty) ? Global.GetUserName(ModifiedBy) : _modifiedByString; }
@ -75,8 +81,10 @@ namespace ASC.Files.Core
public bool Shared { get; set; }
[JsonPropertyName("provider_id")]
public int ProviderId { get; set; }
[JsonPropertyName("provider_key")]
public string ProviderKey { get; set; }
public bool ProviderEntry
{
@ -122,6 +130,7 @@ namespace ASC.Files.Core
public T ID { get; set; }
[JsonPropertyName("folder_id")]
public abstract T FolderIdDisplay
{
get;

View File

@ -26,7 +26,7 @@
using System;
using System.Diagnostics;
using System.Text.Json.Serialization;
using ASC.Web.Files.Classes;
namespace ASC.Files.Core
@ -49,14 +49,18 @@ namespace ASC.Files.Core
public T ParentFolderID { get; set; }
[JsonPropertyName("total_files")]
public int TotalFiles { get; set; }
[JsonPropertyName("total_sub_folder")]
public int TotalSubFolders { get; set; }
public bool Shareable { get; set; }
[JsonPropertyName("isnew")]
public int NewForMe { get; set; }
[JsonPropertyName("folder_url")]
public string FolderUrl { get; set; }
public override bool IsNew

View File

@ -25,6 +25,7 @@
using System.Diagnostics;
using System.Text.Json.Serialization;
namespace ASC.Files.Core
{
@ -42,8 +43,10 @@ namespace ASC.Files.Core
[DebuggerDisplay("{SortedBy} {IsAsc}")]
public class OrderBy
{
[JsonPropertyName("is_asc")]
public bool IsAsc { get; set; }
[JsonPropertyName("property")]
public SortedByType SortedBy { get; set; }
public OrderBy(SortedByType sortedByType, bool isAsc)

View File

@ -29,7 +29,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Security;
using System.Text.Json.Serialization;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
@ -430,8 +430,10 @@ namespace ASC.Web.Files.Helpers
[DebuggerDisplay("{AccountId} {BaseUri}")]
private class DocuSignAccount
{
[JsonPropertyName("account_id")]
public string AccountId { get; set; }
[JsonPropertyName("base_uri")]
public string BaseUri { get; set; }
}

View File

@ -25,7 +25,7 @@
using System;
using System.Text.Json.Serialization;
using ASC.Files.Core;
using ASC.Files.Core.Security;
using ASC.Files.Resources;
@ -45,18 +45,23 @@ namespace ASC.Web.Files.Services.WCFService
{
public Guid SubjectId { get; set; }
[JsonPropertyName("title")]
public string SubjectName { get; set; }
public string Link { get; set; }
[JsonPropertyName("is_group")]
public bool SubjectGroup { get; set; }
public bool Owner { get; set; }
[JsonPropertyName("ace_status")]
public FileShare Share { get; set; }
[JsonPropertyName("locked")]
public bool LockedRights { get; set; }
[JsonPropertyName("disable_remove")]
public bool DisableRemove { get; set; }
}

View File

@ -25,6 +25,7 @@
using System;
using System.Text.Json.Serialization;
using ASC.Core.Common.Settings;
namespace ASC.Web.Studio.Core.TFA
@ -42,6 +43,7 @@ namespace ASC.Web.Studio.Core.TFA
return new TfaAppAuthSettings { EnableSetting = false, };
}
[JsonPropertyName("Enable")]
public bool EnableSetting { get; set; }

View File

@ -26,7 +26,7 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
using ASC.Core.Common.Settings;
using Microsoft.Extensions.DependencyInjection;
@ -39,7 +39,7 @@ namespace ASC.Web.Core.Utility.Settings
{
get { return new Guid("{C888CF56-585B-4c78-9E64-FE1093649A62}"); }
}
[JsonPropertyName("Settings")]
public List<WebItemOption> SettingsCollection { get; set; }
public WebItemSettings()

View File

@ -28,7 +28,7 @@ using System;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Text.Json.Serialization;
using ASC.Common;
using ASC.Core;
using ASC.Core.Common.Settings;
@ -41,11 +41,14 @@ namespace ASC.Web.Core.WhiteLabel
{
[Serializable]
public class TenantInfoSettings : ISettings
{
public Size CompanyLogoSize { get; internal set; }
public string _companyLogoFileName;
{
[JsonPropertyName("LogoSize")]
public Size CompanyLogoSize { get; internal set; }
[JsonPropertyName("LogoFileName")]
public string CompanyLogoFileName;
[JsonPropertyName("Default")]
internal bool _isDefault { get; set; }
public ISettings GetDefault(IServiceProvider serviceProvider)
@ -130,7 +133,7 @@ namespace ASC.Web.Core.WhiteLabel
tenantInfoSettings.CompanyLogoSize = image.Size;
memory.Seek(0, SeekOrigin.Begin);
store.Save(companyLogoFileName, memory);
tenantInfoSettings._companyLogoFileName = companyLogoFileName;
tenantInfoSettings.CompanyLogoFileName = companyLogoFileName;
}
tenantInfoSettings._isDefault = false;
@ -145,7 +148,7 @@ namespace ASC.Web.Core.WhiteLabel
}
var store = StorageFactory.GetStorage(TenantManager.GetCurrentTenant().TenantId.ToString(), "logo");
return store.GetUri(tenantInfoSettings._companyLogoFileName ?? "").ToString();
return store.GetUri(tenantInfoSettings.CompanyLogoFileName ?? "").ToString();
}
/// <summary>
@ -159,7 +162,7 @@ namespace ASC.Web.Core.WhiteLabel
if (storage == null) return null;
var fileName = tenantInfoSettings._companyLogoFileName ?? "";
var fileName = tenantInfoSettings.CompanyLogoFileName ?? "";
return storage.IsFile(fileName) ? storage.GetReadStream(fileName) : null;
}

View File

@ -30,7 +30,7 @@ using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json.Serialization;
using ASC.Common;
using ASC.Common.Logging;
using ASC.Core;
@ -49,41 +49,45 @@ namespace ASC.Web.Core.WhiteLabel
[Serializable]
public class TenantWhiteLabelSettings : ISettings
{
public const string DefaultLogoText = BaseWhiteLabelSettings.DefaultLogoText;
public const string DefaultLogoText = BaseWhiteLabelSettings.DefaultLogoText;
#region Logos information: extension, isDefault, text for img auto generating
internal string _logoLightSmallExt;
internal string LogoLightSmallExt { get; set; }
[JsonPropertyName("DefaultLogoLightSmall")]
internal bool IsDefaultLogoLightSmall { get; set; }
internal bool _isDefaultLogoLightSmall { get; set; }
internal string LogoDarkExt { get; set; }
[JsonPropertyName("DefaultLogoDark")]
internal bool IsDefaultLogoDark { get; set; }
internal string _logoDarkExt;
internal string LogoFaviconExt { get; set; }
[JsonPropertyName("DefaultLogoFavicon")]
internal bool IsDefaultLogoFavicon { get; set; }
internal bool _isDefaultLogoDark { get; set; }
internal string _logoFaviconExt;
internal bool _isDefaultLogoFavicon { get; set; }
internal string _logoDocsEditorExt;
internal bool _isDefaultLogoDocsEditor { get; set; }
internal string LogoDocsEditorExt { get; set; }
[JsonPropertyName("DefaultLogoDocsEditor")]
internal bool IsDefaultLogoDocsEditor { get; set; }
private string _logoText { get; set; }
private string LogoText { get; set; }
public string GetLogoText(SettingsManager settingsManager)
{
if (!string.IsNullOrEmpty(_logoText) && _logoText != DefaultLogoText)
return _logoText;
if (!string.IsNullOrEmpty(LogoText) && LogoText != DefaultLogoText)
return LogoText;
var partnerSettings = settingsManager.LoadForDefaultTenant<TenantWhiteLabelSettings>();
return string.IsNullOrEmpty(partnerSettings._logoText) ? DefaultLogoText : partnerSettings._logoText;
return string.IsNullOrEmpty(partnerSettings.LogoText) ? DefaultLogoText : partnerSettings.LogoText;
}
public void SetLogoText(string val)
{
_logoText = val;
LogoText = val;
}
#endregion
@ -103,17 +107,17 @@ namespace ASC.Web.Core.WhiteLabel
{
return new TenantWhiteLabelSettings
{
_logoLightSmallExt = null,
_logoDarkExt = null,
_logoFaviconExt = null,
_logoDocsEditorExt = null,
LogoLightSmallExt = null,
LogoDarkExt = null,
LogoFaviconExt = null,
LogoDocsEditorExt = null,
_isDefaultLogoLightSmall = true,
_isDefaultLogoDark = true,
_isDefaultLogoFavicon = true,
_isDefaultLogoDocsEditor = true,
IsDefaultLogoLightSmall = true,
IsDefaultLogoDark = true,
IsDefaultLogoFavicon = true,
IsDefaultLogoDocsEditor = true,
_logoText = null
LogoText = null
};
}
#endregion
@ -129,10 +133,10 @@ namespace ASC.Web.Core.WhiteLabel
{
return type switch
{
WhiteLabelLogoTypeEnum.LightSmall => _isDefaultLogoLightSmall,
WhiteLabelLogoTypeEnum.Dark => _isDefaultLogoDark,
WhiteLabelLogoTypeEnum.Favicon => _isDefaultLogoFavicon,
WhiteLabelLogoTypeEnum.DocsEditor => _isDefaultLogoDocsEditor,
WhiteLabelLogoTypeEnum.LightSmall => IsDefaultLogoLightSmall,
WhiteLabelLogoTypeEnum.Dark => IsDefaultLogoDark,
WhiteLabelLogoTypeEnum.Favicon => IsDefaultLogoFavicon,
WhiteLabelLogoTypeEnum.DocsEditor => IsDefaultLogoDocsEditor,
_ => true,
};
}
@ -142,16 +146,16 @@ namespace ASC.Web.Core.WhiteLabel
switch (type)
{
case WhiteLabelLogoTypeEnum.LightSmall:
_isDefaultLogoLightSmall = value;
IsDefaultLogoLightSmall = value;
break;
case WhiteLabelLogoTypeEnum.Dark:
_isDefaultLogoDark = value;
IsDefaultLogoDark = value;
break;
case WhiteLabelLogoTypeEnum.Favicon:
_isDefaultLogoFavicon = value;
IsDefaultLogoFavicon = value;
break;
case WhiteLabelLogoTypeEnum.DocsEditor:
_isDefaultLogoDocsEditor = value;
IsDefaultLogoDocsEditor = value;
break;
}
}
@ -160,10 +164,10 @@ namespace ASC.Web.Core.WhiteLabel
{
return type switch
{
WhiteLabelLogoTypeEnum.LightSmall => _logoLightSmallExt,
WhiteLabelLogoTypeEnum.Dark => _logoDarkExt,
WhiteLabelLogoTypeEnum.Favicon => _logoFaviconExt,
WhiteLabelLogoTypeEnum.DocsEditor => _logoDocsEditorExt,
WhiteLabelLogoTypeEnum.LightSmall => LogoLightSmallExt,
WhiteLabelLogoTypeEnum.Dark => LogoDarkExt,
WhiteLabelLogoTypeEnum.Favicon => LogoFaviconExt,
WhiteLabelLogoTypeEnum.DocsEditor => LogoDocsEditorExt,
_ => "",
};
}
@ -173,16 +177,16 @@ namespace ASC.Web.Core.WhiteLabel
switch (type)
{
case WhiteLabelLogoTypeEnum.LightSmall:
_logoLightSmallExt = fileExt;
LogoLightSmallExt = fileExt;
break;
case WhiteLabelLogoTypeEnum.Dark:
_logoDarkExt = fileExt;
LogoDarkExt = fileExt;
break;
case WhiteLabelLogoTypeEnum.Favicon:
_logoFaviconExt = fileExt;
LogoFaviconExt = fileExt;
break;
case WhiteLabelLogoTypeEnum.DocsEditor:
_logoDocsEditorExt = fileExt;
LogoDocsEditorExt = fileExt;
break;
}
}
@ -230,15 +234,15 @@ namespace ASC.Web.Core.WhiteLabel
public void RestoreDefault(TenantWhiteLabelSettings tenantWhiteLabelSettings, TenantLogoManager tenantLogoManager)
{
tenantWhiteLabelSettings._logoLightSmallExt = null;
tenantWhiteLabelSettings._logoDarkExt = null;
tenantWhiteLabelSettings._logoFaviconExt = null;
tenantWhiteLabelSettings._logoDocsEditorExt = null;
tenantWhiteLabelSettings.LogoLightSmallExt = null;
tenantWhiteLabelSettings.LogoDarkExt = null;
tenantWhiteLabelSettings.LogoFaviconExt = null;
tenantWhiteLabelSettings.LogoDocsEditorExt = null;
tenantWhiteLabelSettings._isDefaultLogoLightSmall = true;
tenantWhiteLabelSettings._isDefaultLogoDark = true;
tenantWhiteLabelSettings._isDefaultLogoFavicon = true;
tenantWhiteLabelSettings._isDefaultLogoDocsEditor = true;
tenantWhiteLabelSettings.IsDefaultLogoLightSmall = true;
tenantWhiteLabelSettings.IsDefaultLogoDark = true;
tenantWhiteLabelSettings.IsDefaultLogoFavicon = true;
tenantWhiteLabelSettings.IsDefaultLogoDocsEditor = true;
tenantWhiteLabelSettings.SetLogoText(null);