From 6f0455aa85b2abffc0dd3ff17cbe6398ebad6279 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 16 Feb 2023 01:25:20 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/Controllers/RvfController.cs | 4 +- server/biz/GlobalBizSettingsBiz.cs | 39 ++++++++++++++++++- server/biz/LicenseBiz.cs | 6 ++- .../models/GlobalOpsNotificationSettings.cs | 2 +- 5 files changed, 46 insertions(+), 7 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/Controllers/RvfController.cs b/server/Controllers/RvfController.cs index cb59fca..cca612e 100644 --- a/server/Controllers/RvfController.cs +++ b/server/Controllers/RvfController.cs @@ -59,7 +59,9 @@ namespace Sockeye.Api.Controllers //Get the most recent key for this dbid regardless if fetched or not, most recent is most recent and supersedes any other keys //for the same database id //this means if a user requests a trial key then buys a key but both are unfetched the bought key takes precedence or vice versa - var license = await ct.License.OrderByDescending(z => z.Id).Where(z => z.DbId == FetchRequestDbId).FirstOrDefaultAsync(); + var license = await ct.License.OrderByDescending(z => z.Id) + .Where(z => z.DbId == FetchRequestDbId && z.Active == true) + .FirstOrDefaultAsync(); if (license != null) { //Found a recent purchased key, if not fetched then can be sent diff --git a/server/biz/GlobalBizSettingsBiz.cs b/server/biz/GlobalBizSettingsBiz.cs index a3b8811..fec314f 100644 --- a/server/biz/GlobalBizSettingsBiz.cs +++ b/server/biz/GlobalBizSettingsBiz.cs @@ -199,7 +199,7 @@ namespace Sockeye.Biz if (multiSite) { - CustomerName += " - " + jSite["name"].Value(); + CustomerName = $"{jCustomer["name"].Value()} - {jSite["name"].Value()}"; log.LogInformation($"RFImport MULTISITE CUSTOMER: {CustomerName}"); } @@ -786,7 +786,42 @@ namespace Sockeye.Biz tlr.EmailValidated = jTrialRequestItem["emailValidated"].Value(); tlr.Requested = (DateTime)DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtRequested"].Value()); tlr.Processed = DateUtil.EpochToDateNullIsNull(jTrialRequestItem["dtProcessed"].Value()); - tlr.Status = (TrialRequestStatus)jTrialRequestItem["status"].Value(); + + /* + rockfish status differs numerically + switch (obj.status) { + case 0: + return "NEW"; + case 1: + return "approved"; + case 2: + return "rejected"; + default: + return "BAD STATUS: " + obj.status; + } + + sockeye: + New = 0, + AwaitingEmailValidation = 1, + AwaitingApproval = 2, + Approved = 3, + Rejected = 4 + */ + switch (jTrialRequestItem["status"].Value()) + { + case 0: + tlr.Status = TrialRequestStatus.New; + break; + case 1: + tlr.Status = TrialRequestStatus.Approved; + break; + case 2: + tlr.Status = TrialRequestStatus.Rejected; + break; + default: + tlr.Status = TrialRequestStatus.Rejected;//just set unknowns to rejected + break; + } tlr.RejectReason = jTrialRequestItem["rejectReason"].Value(); tlr.LicenseId = TrialKeyId; var biz = TrialLicenseRequestBiz.GetBiz(ct); diff --git a/server/biz/LicenseBiz.cs b/server/biz/LicenseBiz.cs index bc8c6b1..f9b77e3 100644 --- a/server/biz/LicenseBiz.cs +++ b/server/biz/LicenseBiz.cs @@ -55,7 +55,7 @@ namespace Sockeye.Biz else { - if (!importedWithKeyDoNotGenerate)//do not generate is used for initial import only from rockfish, could be removed after the initial import + if (!importedWithKeyDoNotGenerate && newObject.Active)//do not generate is used for initial import only from rockfish, could be removed after the initial import { await GenerateKey(newObject); @@ -120,7 +120,9 @@ namespace Sockeye.Biz } await ValidateAsync(putObject, dbObject); if (HasErrors) return null; - await GenerateKey(putObject); + + if(putObject.Active) + await GenerateKey(putObject); if (HasErrors) return null; ct.Replace(dbObject, putObject); diff --git a/server/models/GlobalOpsNotificationSettings.cs b/server/models/GlobalOpsNotificationSettings.cs index f7c3dee..55f06a8 100644 --- a/server/models/GlobalOpsNotificationSettings.cs +++ b/server/models/GlobalOpsNotificationSettings.cs @@ -27,7 +27,7 @@ namespace Sockeye.Models ConnectionSecurity = NotifyMailSecurity.SSLTLS; SmtpServerPort = 465; NotifyFromAddress = "support@ayanova.com"; - SockeyeServerURL = "http://localhost:8080"; + SockeyeServerURL = "https://rockfish.ayanova.com"; }