This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -48,7 +48,7 @@
|
||||
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
|
||||
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"1",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
|
||||
@@ -116,11 +116,11 @@ namespace AyaNova.Biz
|
||||
private static async Task DeliverCustomerNotificationSMTP(CustomerNotifyEvent ne, CustomerNotifySubscription subscription, string deliveryAddress, AyContext ct)
|
||||
{
|
||||
|
||||
var DeliveryLogItem = new NotifyDeliveryLog()
|
||||
var DeliveryLogItem = new CustomerNotifyDeliveryLog()
|
||||
{
|
||||
Processed = DateTime.UtcNow,
|
||||
ObjectId = ne.ObjectId,
|
||||
NotifySubscriptionId = ne.CustomerNotifySubscriptionId,
|
||||
CustomerNotifySubscriptionId = ne.CustomerNotifySubscriptionId,
|
||||
Fail = false
|
||||
};
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace AyaNova.Biz
|
||||
ct.CustomerNotifyEvent.Remove(ne);
|
||||
|
||||
//add delivery log item
|
||||
await ct.NotifyDeliveryLog.AddAsync(DeliveryLogItem);
|
||||
await ct.CustomerNotifyDeliveryLog.AddAsync(DeliveryLogItem);
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ namespace AyaNova.Biz
|
||||
//Note: also has bearing on CoreJobPMInventoryCheck which uses notifydeliverylog to check if pm inventory notify has been done it's one time already
|
||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from anotifydeliverylog where processed < {dtDeleteCutoff}");
|
||||
|
||||
//CustomerNotifyDeliveryLog - deletes all log items older than 90 days
|
||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from acustomernotifydeliverylog where processed < {dtDeleteCutoff}");
|
||||
|
||||
|
||||
}
|
||||
lastSweep = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ namespace AyaNova.Models
|
||||
|
||||
public virtual DbSet<CustomerNotifySubscription> CustomerNotifySubscription { get; set; }
|
||||
public virtual DbSet<CustomerNotifyEvent> CustomerNotifyEvent { get; set; }
|
||||
public virtual DbSet<CustomerNotifyDeliveryLog> CustomerNotifyDeliveryLog { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
41
server/AyaNova/models/CustomerNotifyDeliveryLog.cs
Normal file
41
server/AyaNova/models/CustomerNotifyDeliveryLog.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace AyaNova.Models
|
||||
{
|
||||
//This model holds the Customer notification deliveries that have been attempted in the past 90 days (cleaned out by corenotifysweeper)
|
||||
//it is used for verification / troubleshooting purposes from the OPS log
|
||||
//and also used as a circuit breaker by the corejobnotify to ensure users are not spammed with identical messages
|
||||
|
||||
public class CustomerNotifyDeliveryLog
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
[Required]
|
||||
public DateTime Processed { get; set; }
|
||||
|
||||
public long ObjectId { get; set; }
|
||||
|
||||
[Required]
|
||||
public long CustomerNotifySubscriptionId { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool Fail { get; set; }
|
||||
public string Error { get; set; }
|
||||
|
||||
|
||||
public CustomerNotifyDeliveryLog()
|
||||
{
|
||||
Processed = DateTime.UtcNow;
|
||||
Fail = false;
|
||||
ObjectId = 0;
|
||||
}
|
||||
|
||||
//linked entity
|
||||
public CustomerNotifySubscription CustomerNotifySubscription { get; set; }
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
@@ -17,23 +17,17 @@ namespace AyaNova.Models
|
||||
public long Id { get; set; }
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
//public AyaType NotifyType { get; set; }
|
||||
//public long CustomerNotifySubscriptionId {get;set;}
|
||||
|
||||
[Required]
|
||||
public DateTime Processed { get; set; }
|
||||
//public AyaType AyaType { get; set; }
|
||||
|
||||
public long ObjectId { get; set; }
|
||||
// [Required]
|
||||
//public NotifyEventType EventType { get; set; }
|
||||
|
||||
[Required]
|
||||
public long NotifySubscriptionId { get; set; }
|
||||
|
||||
// [Required]
|
||||
// public long IdValue { get; set; }
|
||||
//[Required]
|
||||
// public decimal DecValue { get; set; }
|
||||
// [Required]
|
||||
// public long UserId { get; set; }
|
||||
// [Required]
|
||||
// public NotifyDeliveryMethod DeliveryMethod { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool Fail { get; set; }
|
||||
public string Error { get; set; }
|
||||
@@ -43,10 +37,6 @@ namespace AyaNova.Models
|
||||
{
|
||||
Processed = DateTime.UtcNow;
|
||||
Fail = false;
|
||||
|
||||
// IdValue = 0;
|
||||
// DecValue = 0;
|
||||
// AyaType = AyaType.NoType;
|
||||
ObjectId = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,16 +22,16 @@ namespace AyaNova.Util
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
||||
private const int DESIRED_SCHEMA_LEVEL = 1;
|
||||
|
||||
internal const long EXPECTED_COLUMN_COUNT = 1355;
|
||||
internal const long EXPECTED_INDEX_COUNT = 155;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 545;
|
||||
internal const long EXPECTED_COLUMN_COUNT = 1361;
|
||||
internal const long EXPECTED_INDEX_COUNT = 156;
|
||||
internal const long EXPECTED_CHECK_CONSTRAINTS = 550;
|
||||
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 201;
|
||||
internal const long EXPECTED_VIEWS = 11;
|
||||
internal const long EXPECTED_ROUTINES = 2;
|
||||
|
||||
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!!
|
||||
|
||||
///////////////////////////////////////// (C1353:I155:CC542:FC201:V11:R2)
|
||||
///////////////////////////////////////// C1361:I156:CC550:FC201:V11:R2)
|
||||
|
||||
/*
|
||||
|
||||
@@ -1217,6 +1217,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
|
||||
+ "ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, customernotifysubscriptionid BIGINT NOT NULL REFERENCES acustomernotifysubscription(id) ON DELETE CASCADE, "
|
||||
+ "customerid BIGINT NOT NULL REFERENCES acustomer (id) ON DELETE CASCADE, eventdate TIMESTAMPTZ NOT NULL, decvalue DECIMAL(38,18) NULL, message TEXT NOT NULL, subject TEXT NOT NULL)");
|
||||
|
||||
await ExecQueryAsync("CREATE TABLE acustomernotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMPTZ NOT NULL, "
|
||||
+ "objectid BIGINT NOT NULL, customernotifysubscriptionid BIGINT NOT NULL, fail BOOL NOT NULL, error TEXT)");
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -464,6 +464,9 @@ namespace AyaNova.Util
|
||||
await EraseTableAsync("anotifyevent", conn);
|
||||
await EraseTableAsync("anotifydeliverylog", conn);
|
||||
await EraseTableAsync("anotifysubscription", conn);
|
||||
await EraseTableAsync("acustomernotifyevent", conn);
|
||||
await EraseTableAsync("acustomernotifydeliverylog", conn);
|
||||
await EraseTableAsync("acustomernotifysubscription", conn);
|
||||
|
||||
await EraseTableAsync("amemo", conn);
|
||||
await EraseTableAsync("areminder", conn);//depends on User
|
||||
|
||||
Reference in New Issue
Block a user