This commit is contained in:
@@ -98,7 +98,7 @@ namespace AyaNova
|
||||
bool LOG_SENSITIVE_DATA = false;
|
||||
|
||||
#if (DEBUG)
|
||||
LOG_SENSITIVE_DATA = true;
|
||||
//LOG_SENSITIVE_DATA = true;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -12,14 +12,6 @@ namespace AyaNova.Biz
|
||||
//Prime the database with initial, minimum required data to boot and do things (manager account, locales)
|
||||
public static class PrimeData
|
||||
{
|
||||
// private readonly AyContext ct;
|
||||
// private readonly ILogger<PrimeData> log;
|
||||
|
||||
// public PrimeData(AyContext dbcontext, ILogger<PrimeData> logger)
|
||||
// {
|
||||
// ct = dbcontext;
|
||||
// log = logger;
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Prime the database with manager account
|
||||
@@ -49,8 +41,9 @@ namespace AyaNova.Biz
|
||||
/// Prime the locales
|
||||
/// This may be called before there are any users on a fresh db boot
|
||||
/// </summary>
|
||||
public static void PrimeLocales(AyContext ct)
|
||||
{
|
||||
public static void PrimeLocales()
|
||||
{//
|
||||
|
||||
|
||||
//Read in each stock locale from a text file and then create them in the DB
|
||||
var ResourceFolderPath = Path.Combine(ServerBootConfig.AYANOVA_CONTENT_ROOT_PATH, "resource");
|
||||
@@ -60,20 +53,21 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
ImportLocale(ct, ResourceFolderPath, "en");
|
||||
ImportLocale(ct, ResourceFolderPath, "es");
|
||||
ImportLocale(ct, ResourceFolderPath, "fr");
|
||||
ImportLocale(ct, ResourceFolderPath, "de");
|
||||
ImportLocale(ResourceFolderPath, "en");
|
||||
ImportLocale(ResourceFolderPath, "es");
|
||||
ImportLocale(ResourceFolderPath, "fr");
|
||||
ImportLocale(ResourceFolderPath, "de");
|
||||
|
||||
//Ensure locales are present, not missing any keys and that there is a server default locale that exists
|
||||
//LocaleBiz lb = new LocaleBiz(ct, AuthorizationRoles.OpsAdminFull);
|
||||
LocaleBiz lb = LocaleBiz.GetBizInternal(ct, 1, AuthorizationRoles.OpsAdminFull);
|
||||
|
||||
LocaleBiz lb = LocaleBiz.GetBizInternal(ServiceProviderProvider.DBContext, 1, AuthorizationRoles.OpsAdminFull);
|
||||
lb.ValidateLocales();
|
||||
|
||||
}
|
||||
|
||||
private static void ImportLocale(AyContext ct, string resourceFolderPath, string localeCode)
|
||||
private static void ImportLocale(string resourceFolderPath, string localeCode)
|
||||
{
|
||||
AyContext ct = ServiceProviderProvider.DBContext;
|
||||
var LocalePath = Path.Combine(resourceFolderPath, $"{localeCode}.json");
|
||||
if (!File.Exists(LocalePath))
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace AyaNova.Util
|
||||
/////////// CHANGE THIS ON NEW SCHEMA UPDATE ////////////////////
|
||||
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 8;
|
||||
private const int DESIRED_SCHEMA_LEVEL = 9;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 98;
|
||||
internal const long EXPECTED_INDEX_COUNT = 22;
|
||||
@@ -160,7 +160,7 @@ namespace AyaNova.Util
|
||||
exec("CREATE INDEX alocaleitem_localeid_key_display_idx ON alocaleitem (localeid,key, display)");
|
||||
|
||||
//Load the default LOCALES
|
||||
AyaNova.Biz.PrimeData.PrimeLocales(ct);
|
||||
AyaNova.Biz.PrimeData.PrimeLocales();
|
||||
|
||||
|
||||
//Add user table
|
||||
@@ -306,7 +306,7 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////
|
||||
// TAGS repository
|
||||
if (currentSchema < 9)
|
||||
{
|
||||
@@ -316,6 +316,14 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//MAKE SURE THE DESIRED SCHEMA WAS SET PROPERLY
|
||||
if (currentSchema > DESIRED_SCHEMA_LEVEL)
|
||||
throw new ArgumentOutOfRangeException("AySchema::DesiredSchemaLevel WASN'T SET PROPERLY");
|
||||
|
||||
|
||||
|
||||
//#########################################
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user