This commit is contained in:
2020-07-09 21:58:28 +00:00
parent 64fa92cffc
commit 3e3379cd7c
4 changed files with 83 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ namespace AyaNova.Models
public virtual DbSet<NotifySubscription> NotifySubscription { get; set; }
public virtual DbSet<NotifyEvent> NotifyEvent { get; set; }
public virtual DbSet<Notification> Notification { get; set; }
public virtual DbSet<Part> Part { get; set; }
public virtual DbSet<PM> PM { get; set; }

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
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 Notification
{
public long Id { get; set; }
public uint Concurrency { get; set; }
[Required]
public DateTime Created { get; set; }
public AyaType? AyaType { get; set; }
public long? ObjectId { get; set; }
[Required]
public NotifyEventType EventType { get; set; }
[Required]
public long SubscriptionId { get; set; }
public string Message { get; set; }
public Notification()
{
Created = DateTime.UtcNow;
}
}//eoc
}//eons

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
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 NotifyDeliveryLog
{
public long Id { get; set; }
public uint Concurrency { 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 SubscriptionId { get; set; }
public long? IdValue { get; set; }
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; }
public NotifyDeliveryLog()
{
Processed = DateTime.UtcNow;
}
}//eoc
}//eons

View File

@@ -687,10 +687,12 @@ $BODY$;
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 bigint, decvalue decimal(19,4), eventdate timestamp, message 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 anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, 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 bigint, decvalue decimal(19,4), processed timestamp not null, touserid bigint not null, deliverymethod integer not null, fail bool, error text");
await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed timestamp not null, ayatype integer, objectid bigint, " +
"eventtype integer not null, subscriptionid bigint not null, idvalue bigint, decvalue decimal(19,4), userid bigint not null, " +
"deliverymethod integer not null, fail bool not null, error text");
await SetSchemaLevelAsync(++currentSchema);
}