This commit is contained in:
2020-07-09 21:42:15 +00:00
parent 217cc57a0a
commit dc5945d308
4 changed files with 44 additions and 25 deletions

View File

@@ -0,0 +1,20 @@
namespace AyaNova.Biz
{
/// <summary>
/// All AyaNova notification delivery methods
///
/// </summary>
public enum NotifyDeliveryMethod : int
{
App = 1,//deliver in app via notification system
SMTP = 2//deliver to an email address or other entity reachable via smtp such as sms from email etc
//NEW ITEMS REQUIRE translation KEYS
}
}//eons

View File

@@ -30,6 +30,9 @@ namespace AyaNova.Models
public virtual DbSet<Contract> Contract { get; set; }
public virtual DbSet<HeadOffice> HeadOffice { get; set; }
public virtual DbSet<LoanUnit> LoanUnit { get; set; }
public virtual DbSet<NotifySubscription> NotifySubscription { get; set; }
public virtual DbSet<Part> Part { get; set; }
public virtual DbSet<PM> PM { get; set; }
public virtual DbSet<PMItem> PMItem { get; set; }

View File

@@ -8,35 +8,31 @@ namespace AyaNova.Models
{
//NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal,
//otherwise the server will call it an invalid record if the field isn't sent from client
public class NotifySubscription : ICoreBizObjectModel
public class NotifySubscription
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public long SubscriberId { get; set; }
[Required]
public long SubscriberAyaType { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki {get;set;}
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
[Required]
public long UserId { get; set; }
public AyaType? AyaType { get; set; }
[Required]
public NotifyEventType EventType { get; set; }
public TimeSpan? AdvanceNotice { get; set; } //Note: I've been doing nullable wrong sort of: https://stackoverflow.com/a/29149207/8939
public long? IdValue { get; set; }
public decimal? DecValue { get; set; }
[Required]
public NotifyDeliveryMethod DeliveryMethod { get; set; }
public string DeliveryAddress { get; set; }
public long? AttachReportId { get; set; }
public List<string> InTags { get; set; }
public List<string> OutTags { get; set; }
public NotifySubscription()
{
Tags = new List<string>();
InTags = new List<string>();
OutTags = new List<string>();
}
}//eoc

View File

@@ -682,15 +682,15 @@ $BODY$;
await ExecQueryAsync("CREATE TABLE anotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " +
"userid bigint not null, ayatype integer, eventtype integer not null, advancenotice interval, " +
"idvalue integer, decvalue decimal(19,4), deliverymethod integer not null, deliveryaddress text, attachreportid bigint, intags varchar(255) ARRAY, outtags varchar(255) ARRAY)");
"idvalue bigint, decvalue decimal(19,4), deliverymethod integer not null, deliveryaddress text, attachreportid bigint, intags varchar(255) ARRAY, outtags varchar(255) ARRAY)");
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, subscriptionid bigint not null, idvalue integer, decvalue decimal(19,4), eventdate timestamp, savedmessage text");
"ayatype integer, objectid bigint, eventtype integer not null, subscriptionid bigint not null, idvalue bigint, decvalue decimal(19,4), eventdate timestamp, savedmessage text");
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, ayatype integer, objectid bigint, eventtype integer not null, subscriptionid bigint not null, message text");
await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, ayatype integer, objectid bigint, "+
"eventtype integer not null, subscriptionid bigint not null, idvalue integer, decvalue decimal(19,4), processed timestamp not null, touserid bigint not null, deliverymethod integer not null, fail bool, error text");
"eventtype integer not null, subscriptionid bigint not null, idvalue bigint, decvalue decimal(19,4), processed timestamp not null, touserid bigint not null, deliverymethod integer not null, fail bool, error text");
await SetSchemaLevelAsync(++currentSchema);
}