This commit is contained in:
2022-03-01 20:26:05 +00:00
parent 4f76d2f3e4
commit 8966f0e8e4
6 changed files with 31 additions and 36 deletions

View File

@@ -135,11 +135,11 @@ namespace AyaNova.Biz
AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId"); AddError(ApiErrorCode.VALIDATION_REQUIRED, "UserId");
// //Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388. //Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
// if (inObj.UiColor.Length > 12 || inObj.UiColor.Length < 4 || inObj.UiColor[0] != '#') if (inObj.UiColor.Length > 12 || inObj.UiColor.Length < 4 || inObj.UiColor[0] != '#')
// { {
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UiColor", "UiColor must be valid HEX color value"); AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "UiColor", "UiColor must be valid HEX color value");
// } }
return; return;
} }

View File

@@ -52,7 +52,7 @@ namespace AyaNova.KPI
JArray jData = new JArray(); JArray jData = new JArray();
string sMeta = null; JArray jMeta = new JArray();
#if (DEBUG && AYSHOWKPIQUERYINFO) #if (DEBUG && AYSHOWKPIQUERYINFO)
System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
@@ -86,11 +86,9 @@ namespace AyaNova.KPI
} }
} }
if (!string.IsNullOrWhiteSpace(kpi.MetaQuery)) if (!string.IsNullOrWhiteSpace(kpi.MetaQuery))
{ {
//GET META DATA //GET META DATA ROWS
command.CommandText = kpi.MetaQuery; command.CommandText = kpi.MetaQuery;
#if (DEBUG && AYSHOWQUERYINFO) #if (DEBUG && AYSHOWQUERYINFO)
stopWatch.Start(); stopWatch.Start();
@@ -101,14 +99,14 @@ namespace AyaNova.KPI
stopWatch.Stop(); stopWatch.Stop();
log.LogInformation($"(debug) KPIFetcher:GetResponse META query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}"); log.LogInformation($"(debug) KPIFetcher:GetResponse META query took {stopWatch.ElapsedMilliseconds}ms to execute: {qTotalRecordsQuery}");
#endif #endif
if (dr.Read()) while (dr.Read())
{ {
sMeta = dr.GetString(0); //only one column and it's the zeroth json string column
if (!dr.IsDBNull(0))
jMeta.Add(JObject.Parse(dr.GetString(0)));
} }
} }
} }
} }
catch (Npgsql.PostgresException e) catch (Npgsql.PostgresException e)
{ {
@@ -133,17 +131,13 @@ namespace AyaNova.KPI
throw new System.Exception("KPIFetcher:GetResponseAsync - unexpected failure see log"); throw new System.Exception("KPIFetcher:GetResponseAsync - unexpected failure see log");
} }
if (!string.IsNullOrWhiteSpace(sMeta))
return JObject.FromObject(new return JObject.FromObject(new
{ {
meta = JObject.Parse(sMeta), meta = jMeta,
data = jData data = jData
}); });
else
return JObject.FromObject(new
{
data = jData
});
} }
} }

View File

@@ -80,7 +80,10 @@ ORDER BY X ASC
) t"; ) t";
_metaQuery = _metaQuery =
@"SELECT row_to_json(t) as res from ( @"SELECT row_to_json(t) as res from (
select name from auser where id = 10 select auser.id as userid, name, uicolor, usertype from auser
left outer join auseroptions on auser.id=auseroptions.userid
where auser.usertype=1 or auser.usertype=5
order by name
) t"; ) t";
} }

View File

@@ -25,11 +25,9 @@ namespace AyaNova.Models
Hexadecimal notation: #RGB[A] Hexadecimal notation: #RGB[A]
R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388. R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (09, AF). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388.
*/ */
//removed for v8 alpha due to schedule not really supporting colors and
//it's kind of tacky in my opinion and outdated and it would detract from the use of colors already in teh schedule [MaxLength(12)]
//plus no where else does ayanova use this value so it's a lot of nothing public string UiColor { get; set; }
// [MaxLength(12)]
// public string UiColor { get; set; }
//browser forced overrides //browser forced overrides
public string LanguageOverride { get; set; } public string LanguageOverride { get; set; }
@@ -52,7 +50,7 @@ namespace AyaNova.Models
{ {
CurrencyName = "USD"; CurrencyName = "USD";
Hour12 = true; Hour12 = true;
// UiColor = "#000000";//black is the default UiColor = "#ffffff";//black is the default
} }
} }

View File

@@ -22,16 +22,16 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 1; private const int DESIRED_SCHEMA_LEVEL = 1;
internal const long EXPECTED_COLUMN_COUNT = 1325; internal const long EXPECTED_COLUMN_COUNT = 1326;
internal const long EXPECTED_INDEX_COUNT = 153; internal const long EXPECTED_INDEX_COUNT = 153;
internal const long EXPECTED_CHECK_CONSTRAINTS = 520; internal const long EXPECTED_CHECK_CONSTRAINTS = 521;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 198; internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 198;
internal const long EXPECTED_VIEWS = 11; internal const long EXPECTED_VIEWS = 11;
internal const long EXPECTED_ROUTINES = 2; internal const long EXPECTED_ROUTINES = 2;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////// C1325:I153:CC520:FC198:V11:R2 ///////////////////////////////////////// C1326:I153:CC521:FC198:V11:R2
@@ -617,7 +617,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//Add user options table //Add user options table
await ExecQueryAsync("CREATE TABLE auseroptions (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " await ExecQueryAsync("CREATE TABLE auseroptions (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, "
+ "userid BIGINT NOT NULL UNIQUE REFERENCES auser (id) ON DELETE CASCADE, translationid BIGINT NOT NULL REFERENCES atranslation (id), languageoverride TEXT, timezoneoverride TEXT, " + "userid BIGINT NOT NULL UNIQUE REFERENCES auser (id) ON DELETE CASCADE, translationid BIGINT NOT NULL REFERENCES atranslation (id), languageoverride TEXT, timezoneoverride TEXT, "
+ "currencyname TEXT, hour12 BOOL NOT NULL, emailaddress TEXT, phone1 TEXT, phone2 TEXT, phone3 TEXT, mapurltemplate TEXT)"); + "currencyname TEXT, hour12 BOOL NOT NULL, emailaddress TEXT, phone1 TEXT, phone2 TEXT, phone3 TEXT, mapurltemplate TEXT, uicolor VARCHAR(12) NOT NULL default '#ffffff')");
//Prime the db with the default SuperUser account //Prime the db with the default SuperUser account

View File

@@ -1802,7 +1802,7 @@ namespace AyaNova.Util
u.UserOptions.EmailAddress = bogusEmail; u.UserOptions.EmailAddress = bogusEmail;
u.UserOptions.Hour12 = true; u.UserOptions.Hour12 = true;
u.UserOptions.CurrencyName = "USD"; u.UserOptions.CurrencyName = "USD";
//u.UserOptions.UiColor = Fake.Internet.Color().ToUpperInvariant(); u.UserOptions.UiColor = Fake.Internet.Color().ToUpperInvariant();
//this seems wrong to get a new context inside a loop but in testing is actually faster!? //this seems wrong to get a new context inside a loop but in testing is actually faster!?