This commit is contained in:
2020-07-09 19:09:54 +00:00
parent 05f76723e4
commit 4e29788355
4 changed files with 85 additions and 21 deletions

View File

@@ -0,0 +1,47 @@
namespace AyaNova.Biz
{
/// <summary>
/// All AyaNova notification event types
///
/// </summary>
public enum NotifyEventType : int
{
//see core-notifications.txt spec doc for a bit more info on each type (they are named a little bit differently)
ObjectDeleted = 1,
ObjectCreated = 2,
ObjectModified = 3,
WorkorderStatusChange=4,
ContractExpiring=5,
CSRAccepted=6,
CSRRejected=7,
WorkorderClosed=8,
QuoteStatusChange=9,
WorkorderFollowUp=10,
ServiceBankDepleted=11,
ReminderImminent=12,
ScheduledOnWorkorder=13,
ScheduledOnWorkorderImminent=14,
WorkorderCloseByPassed=15,
OutsideServiceOverdue=16,
OutsideServiceReceived=17,
PartRequestReceived=18,
NotifyHealthCheck=19,//with timespan to set frequency
BackupStatus=20,
CustomerServiceImminent=21,
PartRequested=22,
WorkorderTotalExceedsThreshold=23,//"the Andy"
WorkorderStatusAge=24,//sitting too long in same status
UnitWarrantyExpiry=25,
UnitMeterReadingMultipleExceeded=26,
DefaultNotification=27//old quick notification, refers now to any direct text notification internal or user to user used for system notifications
//NEW ITEMS REQUIRE translation KEYS
}
}//eons

View File

@@ -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 = 11;
private const int DESIRED_SCHEMA_LEVEL = 12;
internal const long EXPECTED_COLUMN_COUNT = 328;
internal const long EXPECTED_INDEX_COUNT = 134;
@@ -674,22 +674,28 @@ $BODY$;
// //////////////////////////////////////////////////
// // WikiPage table
// if (currentSchema < 11)
// {
// LogUpdateMessage(log);
//////////////////////////////////////////////////
// NOTIFICATIONS tables
if (currentSchema < 12)
{
LogUpdateMessage(log);
// await ExecQueryAsync("CREATE TABLE awikipage (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
// "objectid bigint not null, objecttype integer not null, " +
// "content text)");
await ExecQueryAsync("CREATE TABLE anotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
"subscriberid bigint, subscriberayatype integer, ayatype integer, eventtype integer not null, advancenotice interval, " +
"idvalue integer, deliverymethod integer not null, deliveryaddress text, attachreportid bigint, intags varchar(255) ARRAY NULL, outtags varchar(255) ARRAY NULL)");
// //INDEX: Most selective first as there is more unique ID's than unique types
// //to take advantage of this always query with where objectid=xx and objecttype=yy order
// await ExecQueryAsync("CREATE INDEX awikipage_typeid_idx ON awikipage (objectid, objecttype );");
// await SetSchemaLevelAsync(++currentSchema);
// }
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
"ayatype integer, objectid bigint, eventtype integer not null, eventdate timestamp, savedmessage text");
//created (timestamp used to clean out old stuck events), ayatype, objectid, eventtype, appliestouserid (single subscriber event), aEventDate, ASAVEDMESSAGE, HASH?
//INDEX: Most selective first as there is more unique ID's than unique types
//to take advantage of this always query with where objectid=xx and objecttype=yy order
// await ExecQueryAsync("CREATE INDEX awikipage_typeid_idx ON awikipage (objectid, objecttype );");
await SetSchemaLevelAsync(++currentSchema);
}