From bad49065e0bb92317f579567d84e0ff0febfebe2 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 24 Jan 2023 00:49:30 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/DataList/PurchaseDataList.cs | 9 +++++++++ server/DataList/VendorNotificationDataList.cs | 18 ++++++++++++++---- .../SockBotProcessVendorNotifications.cs | 14 ++++++++++++++ server/models/Purchase.cs | 2 +- server/util/AySchema.cs | 6 +++--- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7cade77..d5d28f8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -33,7 +33,7 @@ "SOCKEYE_DB_CONNECTION": "Server=localhost;Username=postgres;Password=sockeye;Database=sockeye;CommandTimeout=300;", "SOCKEYE_DATA_PATH": "c:\\temp\\sockeye", "SOCKEYE_USE_URLS": "http://*:7676;", - //"SOCKEYE_PERMANENTLY_ERASE_DATABASE": "true", + "SOCKEYE_PERMANENTLY_ERASE_DATABASE": "true", //"SOCKEYE_REPORT_RENDERING_TIMEOUT":"1", "SOCKEYE_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin" }, diff --git a/server/DataList/PurchaseDataList.cs b/server/DataList/PurchaseDataList.cs index 800b5f7..3aabcd7 100644 --- a/server/DataList/PurchaseDataList.cs +++ b/server/DataList/PurchaseDataList.cs @@ -137,6 +137,15 @@ namespace Sockeye.DataList }); + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "DatabaseID", + FieldKey = "DatabaseID", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlValueColumnName = "apurchase.dbid" + }); + + FieldDefinitions.Add(new DataListFieldDefinition { TKey = "Tags", diff --git a/server/DataList/VendorNotificationDataList.cs b/server/DataList/VendorNotificationDataList.cs index 440e80f..bd26765 100644 --- a/server/DataList/VendorNotificationDataList.cs +++ b/server/DataList/VendorNotificationDataList.cs @@ -12,10 +12,21 @@ namespace Sockeye.DataList var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - DefaultColumns = new List() { "VendorNotificationCreated", "VendorNotificationProcessed" }; - DefaultSortBy = new Dictionary() { { "VendorNotificationCreated", "-" } }; + DefaultColumns = new List() { "VendorNotification", "VendorNotificationCreated", "VendorNotificationProcessed" }; + DefaultSortBy = new Dictionary() { { "VendorNotification", "-" } }; FieldDefinitions = new List(); + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "VendorNotification", + FieldKey = "VendorNotification", + SockType = (int)SockType.VendorNotification, + UiFieldDataType = (int)UiFieldDataType.Integer, + SqlIdColumnName = "avendornotification.id", + SqlValueColumnName = "avendornotification.id", + IsRowId = true + }); + FieldDefinitions.Add(new DataListFieldDefinition { TKey = "VendorNotificationCreated", @@ -23,8 +34,7 @@ namespace Sockeye.DataList SockType = (int)SockType.VendorNotification, UiFieldDataType = (int)UiFieldDataType.DateTime, SqlIdColumnName = "avendornotification.id", - SqlValueColumnName = "avendornotification.created", - IsRowId = true + SqlValueColumnName = "avendornotification.created" }); FieldDefinitions.Add(new DataListFieldDefinition diff --git a/server/generator/SockBotProcessVendorNotifications.cs b/server/generator/SockBotProcessVendorNotifications.cs index 6bc97d0..34e5410 100644 --- a/server/generator/SockBotProcessVendorNotifications.cs +++ b/server/generator/SockBotProcessVendorNotifications.cs @@ -199,6 +199,20 @@ namespace Sockeye.Biz p.Revenue = jPurchase["accounting"]["your_revenue"].Value(); } + //Capture raven database id if present + if (jPurchase["additional_information"] != null) + { + var jaAdditionalItems = (JArray)jPurchase["additional_information"]; + foreach (JObject jAdditionalItem in jaAdditionalItems) + { + if (jAdditionalItem["additional_id"] != null && jAdditionalItem["additional_id"].Value() == "DATABASEID") + { + p.DbId = jAdditionalItem["additional_value"].Value(); + break; + } + } + } + if (jPurchase["promotion_coupon"] != null) p.CouponCode = jPurchase["promotion_coupon"].Value(); diff --git a/server/models/Purchase.cs b/server/models/Purchase.cs index 82494b0..4a5d387 100644 --- a/server/models/Purchase.cs +++ b/server/models/Purchase.cs @@ -25,7 +25,7 @@ namespace Sockeye.Models [NotMapped] public string ProductViz { get; set; } public string SalesOrderNumber { get; set; } - + public string DbId { get; set; }//if a RAVEN order /* "accounting": { "currency": "USD", diff --git a/server/util/AySchema.cs b/server/util/AySchema.cs index 0ad3bfb..7277dc4 100644 --- a/server/util/AySchema.cs +++ b/server/util/AySchema.cs @@ -22,7 +22,7 @@ namespace Sockeye.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 17; - internal const long EXPECTED_COLUMN_COUNT = 528; + internal const long EXPECTED_COLUMN_COUNT = 529; internal const long EXPECTED_INDEX_COUNT = 75; internal const long EXPECTED_CHECK_CONSTRAINTS = 250; internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 37; @@ -31,7 +31,7 @@ namespace Sockeye.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! - ///////////////////////////////////////// (C528:I75:CC250:FC37:V0:R2) + ///////////////////////////////////////// (C529:I75:CC250:FC37:V0:R2) /* MAXIMUM POSTGRES OBJECT NAME LENGTH: 63 CHARACTERS @@ -903,7 +903,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "vendorid BIGINT NOT NULL REFERENCES avendor(id), productid BIGINT REFERENCES aproduct(id), pgroup INTEGER NOT NULL DEFAULT 4, salesordernumber TEXT NOT NULL, " + "productnet DECIMAL(38,18) NOT NULL default 0, discount DECIMAL(38,18) NOT NULL default 0, vendorfee DECIMAL(38,18) NOT NULL default 0, revenue DECIMAL(38,18) NOT NULL default 0, " + "currency TEXT, purchasedate TIMESTAMPTZ NOT NULL, expiredate TIMESTAMPTZ, canceldate TIMESTAMPTZ, couponcode text, notes text, " - + "renewnoticesent BOOL NOT NULL DEFAULT false, quantity INTEGER NOT NULL DEFAULT 1, " + + "renewnoticesent BOOL NOT NULL DEFAULT false, quantity INTEGER NOT NULL DEFAULT 1, dbid TEXT, " + "vendornotificationid BIGINT REFERENCES avendornotification(id), licenseid BIGINT REFERENCES alicense(id), processed BOOL NOT NULL DEFAULT false, " + "wiki TEXT, tags VARCHAR(255) ARRAY )");