This commit is contained in:
2020-12-03 19:43:05 +00:00
parent 5da01d776a
commit 4fd9bd2689
7 changed files with 485 additions and 12 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"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_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -0,0 +1,249 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using AyaNova.Biz;
namespace AyaNova.DataList
{
internal class VendorDataList : AyaDataList
{
public VendorDataList()
{
DefaultListObjectType = AyaType.Vendor;
SQLFrom = "from avendor";
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
//######## DEFAULT VIEW WHEN NO VIEW CHOSEN ############
//Default ListView
dynamic dlistView = new JArray();
dynamic cm = new JObject();
cm.fld = "vendorname";
cm.sort = "+";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "vendorphone1";
dlistView.Add(cm);
cm = new JObject();
cm.fld = "vendoremail";
dlistView.Add(cm);
DefaultListView = dlistView.ToString(Newtonsoft.Json.Formatting.None);
//NOTE: Due to the join, all the sql id and name fields that can conflict with the joined table need to be specified completely
FieldDefinitions = new List<AyaDataListFieldDefinition>();
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorName",
FieldKey = "vendorname",
AyaObjectType = (int)AyaType.Vendor,
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "avendor.id",
SqlValueColumnName = "avendor.name",
IsRowId = true
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorNotes",
FieldKey = "vendornotes",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.notes"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "Active",
FieldKey = "vendoractive",
UiFieldDataType = (int)UiFieldDataType.Bool,
SqlValueColumnName = "avendor.active"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "Tags",
FieldKey = "vendortags",
UiFieldDataType = (int)UiFieldDataType.Tags,
SqlValueColumnName = "avendor.tags"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "WebAddress",
FieldKey = "vendorwebaddress",
UiFieldDataType = (int)UiFieldDataType.HTTP,
SqlValueColumnName = "avendor.webaddress"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorAccountNumber",
FieldKey = "vendoraccountnumber",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.accountnumber"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorPhone1",
FieldKey = "vendorphone1",
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
SqlValueColumnName = "avendor.phone1"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorPhone2",
FieldKey = "vendorphone2",
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
SqlValueColumnName = "avendor.phone2"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorPhone3",
FieldKey = "vendorphone3",
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
SqlValueColumnName = "avendor.phone3"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorPhone4",
FieldKey = "vendorphone4",
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
SqlValueColumnName = "avendor.phone4"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorPhone5",
FieldKey = "vendorphone5",
UiFieldDataType = (int)UiFieldDataType.PhoneNumber,
SqlValueColumnName = "avendor.phone5"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "VendorEmail",
FieldKey = "vendoremail",
UiFieldDataType = (int)UiFieldDataType.EmailAddress,
SqlValueColumnName = "avendor.emailaddress"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressPostalDeliveryAddress",
FieldKey = "vendorpostaddress",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.postaddress"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressPostalCity",
FieldKey = "vendorpostcity",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.postcity"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressPostalStateProv",
FieldKey = "vendorpostregion",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.postregion"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressPostalCountry",
FieldKey = "vendorpostcountry",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.postcountry"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressPostalPostal",
FieldKey = "vendorpostcode",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.postcode"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressDeliveryAddress",
FieldKey = "vendoraddress",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.address"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressCity",
FieldKey = "vendorcity",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.city"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressStateProv",
FieldKey = "vendorregion",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.region"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressCountry",
FieldKey = "vendorcountry",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "avendor.country"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressLatitude",
FieldKey = "vendorlatitude",
UiFieldDataType = (int)UiFieldDataType.Decimal,
SqlValueColumnName = "avendor.latitude"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition
{
TKey = "AddressLongitude",
FieldKey = "vendorlongitude",
UiFieldDataType = (int)UiFieldDataType.Decimal,
SqlValueColumnName = "avendor.longitude"
});
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom1", FieldKey = "vendorcustom1", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom2", FieldKey = "vendorcustom2", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom3", FieldKey = "vendorcustom3", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom4", FieldKey = "vendorcustom4", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom5", FieldKey = "vendorcustom5", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom6", FieldKey = "vendorcustom6", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom7", FieldKey = "vendorcustom7", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom8", FieldKey = "vendorcustom8", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom9", FieldKey = "vendorcustom9", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom10", FieldKey = "vendorcustom10", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom11", FieldKey = "vendorcustom11", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom12", FieldKey = "vendorcustom12", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom13", FieldKey = "vendorcustom13", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom14", FieldKey = "vendorcustom14", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom15", FieldKey = "vendorcustom15", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
FieldDefinitions.Add(new AyaDataListFieldDefinition { TKey = "VendorCustom16", FieldKey = "vendorcustom16", IsCustomField = true, IsFilterable = false, IsSortable = false, SqlValueColumnName = "avendor.customfields" });
}
}//eoc
}//eons

View File

@@ -469,6 +469,29 @@ namespace AyaNova.Biz
l.Add(new AyaFormFieldDefinition { TKey = "Wiki", FieldKey = "Wiki" });
l.Add(new AyaFormFieldDefinition { TKey = "Attachments", FieldKey = "Attachments" });
//VENDOR FIELDS
l.Add(new AyaFormFieldDefinition { TKey = "WebAddress", FieldKey = "WebAddress" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficeAccountNumber", FieldKey = "AccountNumber" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficePhone1", FieldKey = "Phone1" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficePhone2", FieldKey = "Phone2" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficePhone3", FieldKey = "Phone3" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficePhone4", FieldKey = "Phone4" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficePhone5", FieldKey = "Phone5" });
l.Add(new AyaFormFieldDefinition { TKey = "HeadOfficeEmail", FieldKey = "EmailAddress" });
//ADDRESS FIELDS
l.Add(new AyaFormFieldDefinition { TKey = "AddressPostalDeliveryAddress", FieldKey = "PostAddress" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressPostalCity", FieldKey = "PostCity" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressPostalStateProv", FieldKey = "PostRegion" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressPostalCountry", FieldKey = "PostCountry" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressPostalPostal", FieldKey = "PostCode" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressDeliveryAddress", FieldKey = "Address" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressCity", FieldKey = "City" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressStateProv", FieldKey = "Region" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressCountry", FieldKey = "Country" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressLatitude", FieldKey = "Latitude" });
l.Add(new AyaFormFieldDefinition { TKey = "AddressLongitude", FieldKey = "Longitude" });
l.Add(new AyaFormFieldDefinition { TKey = "VendorCustom1", FieldKey = "VendorCustom1", IsCustomField = true });
l.Add(new AyaFormFieldDefinition { TKey = "VendorCustom2", FieldKey = "VendorCustom2", IsCustomField = true });
l.Add(new AyaFormFieldDefinition { TKey = "VendorCustom3", FieldKey = "VendorCustom3", IsCustomField = true });

View File

@@ -1,12 +1,17 @@
using System;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using AyaNova.Util;
using AyaNova.Api.ControllerHelpers;
using AyaNova.Models;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace AyaNova.Biz
{
internal class VendorBiz : BizObject, ISearchAbleObject
internal class VendorBiz : BizObject, IJobObject, ISearchAbleObject, IReportAbleObject, IExportAbleObject, IImportAbleObject
{
internal VendorBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
{
@@ -238,12 +243,151 @@ namespace AyaNova.Biz
}
////////////////////////////////////////////////////////////////////////////////////////////////
//JOB / OPERATIONS
//REPORTING
//
public async Task<JArray> GetReportData(long[] idList)
{
JArray ReportData = new JArray();
while (idList.Any())
{
var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE);
idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray();
//query for this batch, comes back in db natural order unfortunately
var batchResults = await ct.Vendor.Where(z => batch.Contains(z.Id)).ToArrayAsync();
//order the results back into original
var orderedList = from id in batch join z in batchResults on id equals z.Id select z;
foreach (Vendor w in orderedList)
{
var jo = JObject.FromObject(w);
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
ReportData.Add(jo);
}
}
return ReportData;
}
////////////////////////////////////////////////////////////////////////////////////////////////
// IMPORT EXPORT
//
//Other job handlers here...
public async Task<JArray> GetExportData(long[] idList)
{
//for now just re-use the report data code
//this may turn out to be the pattern for most biz object types but keeping it seperate allows for custom usage from time to time
return await GetReportData(idList);
}
public async Task<List<string>> ImportData(JArray ja)
{
List<string> ImportResult = new List<string>();
string ImportTag = $"imported-{FileUtil.GetSafeDateFileName()}";
var jsset = JsonSerializer.CreateDefault(new JsonSerializerSettings { ContractResolver = new AyaNova.Util.JsonUtil.ShouldSerializeContractResolver(new string[] { "Concurrency", "Id", "CustomFields" }) });
foreach (JObject j in ja)
{
var w = j.ToObject<Vendor>(jsset);
if (j["CustomFields"] != null)
w.CustomFields = j["CustomFields"].ToString();
w.Tags.Add(ImportTag);//so user can find them all and revert later if necessary
var res = await CreateAsync(w);
if (res == null)
{
ImportResult.Add($"* {w.Name} - {this.GetErrorsAsString()}");
this.ClearErrors();
}
else
{
ImportResult.Add($"{w.Name} - ok");
}
}
return ImportResult;
}
////////////////////////////////////////////////////////////////////////////////////////////////
//JOB / OPERATIONS
//
public async Task HandleJobAsync(OpsJob job)
{
//Hand off the particular job to the corresponding processing code
//NOTE: If this code throws an exception the caller (JobsBiz::ProcessJobsAsync) will automatically set the job to failed and log the exeption so
//basically any error condition during job processing should throw up an exception if it can't be handled
switch (job.JobType)
{
case JobType.BulkCoreBizObjectOperation:
await ProcessBulkJobAsync(job);
break;
default:
throw new System.ArgumentOutOfRangeException($"VendorBiz.HandleJob-> Invalid job type{job.JobType.ToString()}");
}
}
private async Task ProcessBulkJobAsync(OpsJob job)
{
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Running);
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} started...");
List<long> idList = new List<long>();
long ProcessedObjectCount = 0;
JObject jobData = JObject.Parse(job.JobInfo);
if (jobData.ContainsKey("idList"))
idList = ((JArray)jobData["idList"]).ToObject<List<long>>();
else
idList = await ct.Vendor.Select(z => z.Id).ToListAsync();
bool SaveIt = false;
foreach (long id in idList)
{
try
{
SaveIt = false;
ClearErrors();
var o = await GetAsync(id, false);
switch (job.SubType)
{
case JobSubType.TagAddAny:
case JobSubType.TagAdd:
case JobSubType.TagRemoveAny:
case JobSubType.TagRemove:
case JobSubType.TagReplaceAny:
case JobSubType.TagReplace:
SaveIt = TagBiz.ProcessBulkTagOperation(o.Tags, (string)jobData["tag"], jobData.ContainsKey("toTag") ? (string)jobData["toTag"] : null, job.SubType);
break;
default:
throw new System.ArgumentOutOfRangeException($"ProcessBulkJob -> Invalid job Subtype{job.SubType}");
}
if (SaveIt)
{
o = await PutAsync(o);
if (o == null)
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}: {GetErrorsAsString()}");
else
ProcessedObjectCount++;
}
else
ProcessedObjectCount++;
}
catch (Exception ex)
{
await JobsBiz.LogJobAsync(job.GId, $"Error processing item {id}");
await JobsBiz.LogJobAsync(job.GId, ExceptionUtil.ExtractAllExceptionMessages(ex));
}
}
await JobsBiz.LogJobAsync(job.GId, $"Bulk job {job.SubType} processed {ProcessedObjectCount} of {idList.Count}");
await JobsBiz.UpdateJobStatusAsync(job.GId, JobStatus.Completed);
}
/////////////////////////////////////////////////////////////////////

View File

@@ -36,17 +36,11 @@ namespace AyaNova.Models
public long? ContractId { get; set; }
public DateTime? ContractExpires { get; set; }
public long? DefaultServiceTemplateId { get; set; }
//[Phone]
public string Phone1 { get; set; }
// [Phone]
public string Phone2 { get; set; }
//[Phone]
public string Phone3 { get; set; }
//[Phone]
public string Phone4 { get; set; }
//[Phone]
public string Phone5 { get; set; }
//[EmailAddress]
public string EmailAddress { get; set; }
//POSTAL ADDRESS

View File

@@ -24,6 +24,34 @@ namespace AyaNova.Models
public List<string> Tags { get; set; }
public string PopUpNotes { get; set; }
public string WebAddress { get; set; }
public string AccountNumber { get; set; }
public string Phone1 { get; set; }
public string Phone2 { get; set; }
public string Phone3 { get; set; }
public string Phone4 { get; set; }
public string Phone5 { get; set; }
public string EmailAddress { get; set; }
//POSTAL ADDRESS
public string PostAddress { get; set; }
public string PostCity { get; set; }
public string PostRegion { get; set; }
public string PostCountry { get; set; }
public string PostCode { get; set; }
//PHYSICAL ADDRESS
public string Address { get; set; }
public string City { get; set; }
public string Region { get; set; }
public string Country { get; set; }
public decimal? Latitude { get; set; }
public decimal? Longitude { get; set; }
public Vendor()
{
Tags = new List<string>();
@@ -35,3 +63,36 @@ namespace AyaNova.Models
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AVENDOR](
[AID] [uniqueidentifier] NOT NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NOT NULL,
[AWEBADDRESS] [nvarchar](255) NULL,
[AVENDORTYPE] [smallint] NOT NULL,
[ANOTES] [ntext] NULL,
[AACCOUNTNUMBER] [nvarchar](255) NULL,
[ACUSTOM1] [ntext] NULL,
[ACUSTOM2] [ntext] NULL,
[ACUSTOM3] [ntext] NULL,
[ACUSTOM4] [ntext] NULL,
[ACUSTOM5] [ntext] NULL,
[ACUSTOM6] [ntext] NULL,
[ACUSTOM7] [ntext] NULL,
[ACUSTOM8] [ntext] NULL,
[ACUSTOM9] [ntext] NULL,
[ACUSTOM0] [ntext] NULL,
[ACONTACTNOTES] [ntext] NULL,
[ACONTACT] [nvarchar](500) NULL,
[APHONE1] [nvarchar](255) NULL,
[APHONE2] [nvarchar](255) NULL,
[APHONE3] [nvarchar](255) NULL,
[APHONE4] [nvarchar](255) NULL,
[APHONE5] [nvarchar](255) NULL,
[AEMAIL] [nvarchar](255) NULL,
*/

View File

@@ -22,7 +22,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 15;
internal const long EXPECTED_COLUMN_COUNT = 478;
internal const long EXPECTED_COLUMN_COUNT = 498;
internal const long EXPECTED_INDEX_COUNT = 145;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -558,7 +558,9 @@ $BODY$;
//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 )");
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, webaddress text, popupnotes text, accountnumber 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)");