This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
|||||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||||
|
|||||||
3
docs/8.0/ayanova/docs/form-acc-service-banks.md
Normal file
3
docs/8.0/ayanova/docs/form-acc-service-banks.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# SERVICE BANK Placeholder
|
||||||
|
|
||||||
|
This is a placeholder page for sections that are not written yet
|
||||||
@@ -22,8 +22,8 @@ namespace AyaNova.Util
|
|||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||||
private const int DESIRED_SCHEMA_LEVEL = 15;
|
private const int DESIRED_SCHEMA_LEVEL = 15;
|
||||||
|
|
||||||
internal const long EXPECTED_COLUMN_COUNT = 587;
|
internal const long EXPECTED_COLUMN_COUNT = 596;
|
||||||
internal const long EXPECTED_INDEX_COUNT = 176;
|
internal const long EXPECTED_INDEX_COUNT = 175;
|
||||||
|
|
||||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
|
||||||
|
|
||||||
@@ -705,6 +705,15 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_name_id_idx ON apurchaseorder (id, name);");
|
await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_name_id_idx ON apurchaseorder (id, name);");
|
||||||
await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)");
|
await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)");
|
||||||
|
|
||||||
|
//VENDOR
|
||||||
|
await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
|
||||||
|
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, webaddress text, popupnotes text, accountnumber text, " +
|
||||||
|
"contact text, contactnotes text, phone1 text, phone2 text, phone3 text, phone4 text, phone5 text, emailaddress text, " +
|
||||||
|
"postaddress text, postcity text, postregion text, postcountry text, postcode text, address text, city text, region text, country text, latitude decimal(8,6), longitude decimal(9,6))");
|
||||||
|
await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);");
|
||||||
|
await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)");
|
||||||
|
await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (vendorid) REFERENCES avendor(id)");
|
||||||
|
|
||||||
//UNIT
|
//UNIT
|
||||||
await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
|
await ExecQueryAsync("CREATE TABLE aunit (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
|
||||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
|
"notes text, wiki text, customfields text, tags varchar(255) ARRAY )");
|
||||||
@@ -720,14 +729,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
|||||||
await ExecQueryAsync("CREATE UNIQUE INDEX aunitmodel_name_id_idx ON aunitmodel (id, name);");
|
await ExecQueryAsync("CREATE UNIQUE INDEX aunitmodel_name_id_idx ON aunitmodel (id, name);");
|
||||||
await ExecQueryAsync("CREATE INDEX aunitmodel_tags ON aunitmodel using GIN(tags)");
|
await ExecQueryAsync("CREATE INDEX aunitmodel_tags ON aunitmodel using GIN(tags)");
|
||||||
|
|
||||||
//VENDOR
|
|
||||||
await ExecQueryAsync("CREATE TABLE avendor (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " +
|
|
||||||
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, webaddress text, popupnotes text, accountnumber text, " +
|
|
||||||
"contact text, contactnotes text, phone1 text, phone2 text, phone3 text, phone4 text, phone5 text, emailaddress text, " +
|
|
||||||
"postaddress text, postcity text, postregion text, postcountry text, postcode text, address text, city text, region text, country text, latitude decimal(8,6), longitude decimal(9,6))");
|
|
||||||
await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);");
|
|
||||||
await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)");
|
|
||||||
await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (vendorid) REFERENCES avendor(id)");
|
|
||||||
|
|
||||||
//----------
|
//----------
|
||||||
//WORKORDER
|
//WORKORDER
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ namespace AyaNova.Util
|
|||||||
public Faker Fake;
|
public Faker Fake;
|
||||||
//### FAKER BIG LIST OF ALL SOURCE DATA HERE:
|
//### FAKER BIG LIST OF ALL SOURCE DATA HERE:
|
||||||
//https://github.com/bchavez/Bogus/blob/master/Source/Bogus/data/en.locale.json
|
//https://github.com/bchavez/Bogus/blob/master/Source/Bogus/data/en.locale.json
|
||||||
|
//https://github.com/bchavez/Bogus#bogus-api-support
|
||||||
|
|
||||||
public Seeder()
|
public Seeder()
|
||||||
{
|
{
|
||||||
@@ -196,10 +197,6 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Seed special test data for integration testing
|
//Seed special test data for integration testing
|
||||||
//log.LogInformation("Seeding known users");
|
//log.LogInformation("Seeding known users");
|
||||||
await SeedKnownObjectsAsync(log);
|
await SeedKnownObjectsAsync(log);
|
||||||
@@ -242,6 +239,9 @@ namespace AyaNova.Util
|
|||||||
await SeedServiceRateAsync(log, 5);
|
await SeedServiceRateAsync(log, 5);
|
||||||
await SeedTravelRateAsync(log, 3);
|
await SeedTravelRateAsync(log, 3);
|
||||||
|
|
||||||
|
//UNITMODELS
|
||||||
|
await SeedUnitModelAsync(log, 10);
|
||||||
|
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -311,6 +311,9 @@ namespace AyaNova.Util
|
|||||||
await SeedServiceRateAsync(log, 10);
|
await SeedServiceRateAsync(log, 10);
|
||||||
await SeedTravelRateAsync(log, 5);
|
await SeedTravelRateAsync(log, 5);
|
||||||
|
|
||||||
|
//UNITMODELS
|
||||||
|
await SeedUnitModelAsync(log, 25);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
await LogStatusAsync(JobId, LogJob, log, $"MEDIUM level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
await LogStatusAsync(JobId, LogJob, log, $"MEDIUM level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
||||||
@@ -373,9 +376,6 @@ namespace AyaNova.Util
|
|||||||
//5 accountant / bookkeeper
|
//5 accountant / bookkeeper
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//WIDGETS
|
//WIDGETS
|
||||||
await SeedWidgetAsync(log, 100);
|
await SeedWidgetAsync(log, 100);
|
||||||
|
|
||||||
@@ -395,6 +395,9 @@ namespace AyaNova.Util
|
|||||||
await SeedServiceRateAsync(log, 20);
|
await SeedServiceRateAsync(log, 20);
|
||||||
await SeedTravelRateAsync(log, 10);
|
await SeedTravelRateAsync(log, 10);
|
||||||
|
|
||||||
|
//UNITMODELS
|
||||||
|
await SeedUnitModelAsync(log, 30);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
await LogStatusAsync(JobId, LogJob, log, $"LARGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
await LogStatusAsync(JobId, LogJob, log, $"LARGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
||||||
@@ -476,6 +479,9 @@ namespace AyaNova.Util
|
|||||||
await SeedServiceRateAsync(log, 30);
|
await SeedServiceRateAsync(log, 30);
|
||||||
await SeedTravelRateAsync(log, 15);
|
await SeedTravelRateAsync(log, 15);
|
||||||
|
|
||||||
|
//UNITMODELS
|
||||||
|
await SeedUnitModelAsync(log, 40);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
await LogStatusAsync(JobId, LogJob, log, $"HUGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
await LogStatusAsync(JobId, LogJob, log, $"HUGE level sample data seeded in {watch.ElapsedMilliseconds} ms");
|
||||||
@@ -546,10 +552,7 @@ namespace AyaNova.Util
|
|||||||
return s + " " + (++RUNNING_COUNT).ToString();
|
return s + " " + (++RUNNING_COUNT).ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<string> HashUserNames = new HashSet<string>();
|
|
||||||
public HashSet<string> HashCompanyNames = new HashSet<string>();
|
|
||||||
public HashSet<string> HashProjectNames = new HashSet<string>();
|
|
||||||
public HashSet<string> HashRateNames = new HashSet<string>();
|
|
||||||
|
|
||||||
|
|
||||||
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
|
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
|
||||||
@@ -867,6 +870,9 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public HashSet<string> HashUserNames = new HashSet<string>();
|
||||||
|
|
||||||
|
|
||||||
public async Task SeedUserAsync(
|
public async Task SeedUserAsync(
|
||||||
ILogger log, int count, AuthorizationRoles roles, UserType userType,
|
ILogger log, int count, AuthorizationRoles roles, UserType userType,
|
||||||
bool active = true, string login = null, string password = null,
|
bool active = true, string login = null, string password = null,
|
||||||
@@ -1002,6 +1008,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public HashSet<string> HashCompanyNames = new HashSet<string>();
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
@@ -1180,6 +1187,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public HashSet<string> HashProjectNames = new HashSet<string>();
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
//PROJECT
|
//PROJECT
|
||||||
@@ -1223,6 +1231,8 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public HashSet<string> HashRateNames = new HashSet<string>();
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
//SERVICERATE
|
//SERVICERATE
|
||||||
//
|
//
|
||||||
@@ -1306,6 +1316,64 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public HashSet<string> HashUnitModelNames = new HashSet<string>();
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//UNITMODEL
|
||||||
|
//
|
||||||
|
public async Task SeedUnitModelAsync(ILogger log, int count)
|
||||||
|
{
|
||||||
|
DateTime seedStartWindow = DateTime.Now.AddYears(-5);
|
||||||
|
DateTime seedEndWindow = DateTime.Now.AddYears(1);
|
||||||
|
var WarrantyMonths = new[] { 1, 6, 12, 24, 36 };
|
||||||
|
var WarrantyTerms = new[] { "Parts only", "Parts and service", "Service only", "Shipping parts and service", "First month parts and service here; after is depot only" };
|
||||||
|
|
||||||
|
for (int x = 0; x < count; x++)
|
||||||
|
{
|
||||||
|
UnitModel o = new UnitModel();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
o.Name = $"{Fake.Vehicle.Model()} {Fake.Commerce.Categories(1)[0]}";
|
||||||
|
} while (!HashUnitModelNames.Add(o.Name));
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
o.Number = Fake.Finance.Account(6);
|
||||||
|
} while (!HashUnitModelNames.Add(o.Number));
|
||||||
|
|
||||||
|
o.Active = true;
|
||||||
|
o.Notes = Fake.Lorem.Sentence();
|
||||||
|
o.Tags = RandomTags();
|
||||||
|
o.VendorId = Fake.Random.Long(1, 10);
|
||||||
|
o.UPC = Fake.Commerce.Ean13();
|
||||||
|
o.LifeTimeWarranty = false;
|
||||||
|
o.IntroducedDate = Fake.Date.Between(seedStartWindow, DateTime.Now).ToUniversalTime();
|
||||||
|
o.Discontinued = false;
|
||||||
|
o.DiscontinuedDate = null;
|
||||||
|
o.WarrantyLength = Fake.PickRandom(WarrantyMonths);
|
||||||
|
o.WarrantyTerms = Fake.PickRandom(WarrantyTerms);
|
||||||
|
|
||||||
|
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
||||||
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
|
{
|
||||||
|
UnitModelBiz biz = UnitModelBiz.GetBiz(ct);
|
||||||
|
var NewObject = await biz.CreateAsync(o);
|
||||||
|
|
||||||
|
if (NewObject == null)
|
||||||
|
{
|
||||||
|
var err = $"Seeder::SeedUnitModel error creating {o.Name}\r\n{biz.GetErrorsAsString()}";
|
||||||
|
log.LogError(err);
|
||||||
|
throw new System.Exception(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user