This commit is contained in:
2020-06-08 23:42:40 +00:00
parent 4e13b3c9bb
commit 937e9c5907
18 changed files with 119 additions and 83 deletions

2
.vscode/launch.json vendored
View File

@@ -10,7 +10,7 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build", "preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path. // If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.1/rockfishCore.dll", "program": "${workspaceRoot}/bin/Debug/netcoreapp3.1/rockfishCore.dll",
"args": [], "args": [],
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"stopAtEntry": false, "stopAtEntry": false,

View File

@@ -50,6 +50,32 @@ namespace rockfishCore.Controllers
} }
// //Get api/customer/list
// [HttpGet("list")]
// public ActionResult GetList()
// {
// var res = from c in _context.Customer.OrderBy(c => c.Name)
// select new dtoCustomerListItem
// {
// lapsed = false,
// active = c.Active,
// id = c.Id,
// name = c.Name
// };
// //Need to be made into a list before updating or else the changes would be lost
// //The tolist is what triggers the actual query to run
// var LapsedRes = res.ToList();
// foreach (dtoCustomerListItem i in LapsedRes)
// {
// i.lapsed = CustomerHasLapsed(i.id);
// }
// return Ok(LapsedRes);
// }
/// <summary> /// <summary>
/// Check if a customer has any active subs /// Check if a customer has any active subs
/// return true if no active subs /// return true if no active subs

View File

@@ -138,8 +138,8 @@ namespace rockfishCore.Controllers
public class dtoReplyMessageItem public class dtoReplyMessageItem
{ {
public string composition; public string composition { get; set; }
public bool trackDelivery; public bool trackDelivery { get; set; }
} }

View File

@@ -102,8 +102,8 @@ namespace rockfishCore.Controllers
public class dtoOpsStatus public class dtoOpsStatus
{ {
public bool Status; public bool Status { get; set; }
public string ServiceCheckError; public string ServiceCheckError { get; set; }
public dtoOpsStatus() public dtoOpsStatus()
{ {

View File

@@ -27,7 +27,7 @@ namespace rockfishCore.Controllers
_configuration = configuration; _configuration = configuration;
} }
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
//Get expiring subscriptions list //Get expiring subscriptions list
@@ -54,12 +54,12 @@ namespace rockfishCore.Controllers
//dto classes for route //dto classes for route
public class expiresResultItem public class expiresResultItem
{ {
public long id; public long id { get; set; }
public string name; public string name { get; set; }
public string Customer; public string Customer { get; set; }
public long customerId; public long customerId { get; set; }
public long? expireDate; public long? expireDate { get; set; }
public long site_id; public long site_id { get; set; }
} }
@@ -110,7 +110,7 @@ namespace rockfishCore.Controllers
private List<string> getEmailsForClient(long id) private List<string> getEmailsForClient(long id)
{ {
List<string> ret = new List<string>(); List<string> ret = new List<string>();
//New for RF 6 //New for RF 6
var cust = _context.Customer.Where(p => p.Id == id).FirstOrDefault(); var cust = _context.Customer.Where(p => p.Id == id).FirstOrDefault();
if (cust != null) if (cust != null)
@@ -121,7 +121,7 @@ namespace rockfishCore.Controllers
ret.Add(cust.SupportEmail); ret.Add(cust.SupportEmail);
} }
//TOASTED for RF 6 //TOASTED for RF 6
//search contact, trial, purchase, incident (optionally) //search contact, trial, purchase, incident (optionally)
// ret.AddRange(_context.Purchase.Where(p => p.CustomerId == id).Select(p => p.Email).Distinct().ToList()); // ret.AddRange(_context.Purchase.Where(p => p.CustomerId == id).Select(p => p.Email).Distinct().ToList());
// ret.AddRange(_context.Contact.Where(p => p.CustomerId == id).Select(p => p.Email).Distinct().ToList()); // ret.AddRange(_context.Contact.Where(p => p.CustomerId == id).Select(p => p.Email).Distinct().ToList());
@@ -188,9 +188,9 @@ namespace rockfishCore.Controllers
//dto classes for route //dto classes for route
public class requestEmailsForProductCodes public class requestEmailsForProductCodes
{ {
public string[] products; public string[] products { get; set; }
public bool ckIncidental; public bool ckIncidental { get; set; }
public bool ckNoContact; public bool ckNoContact { get; set; }
} }
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////

View File

@@ -102,11 +102,11 @@ namespace rockfishCore.Controllers
//dto classes for route //dto classes for route
public class subnotifyResultItem public class subnotifyResultItem
{ {
public long id; public long id { get; set; }
public string Customer; public string Customer { get; set; }
public string purchasenames; public string purchasenames { get; set; }
public List<long> purchaseidlist; public List<long> purchaseidlist { get; set; }
public long customerId; public long customerId { get; set; }
} }

View File

@@ -127,7 +127,7 @@ namespace rockfishCore.Controllers
//------------ //------------
[HttpPost("{id}/changepassword")] [HttpPost("{id}/changepassword")]
public JsonResult ChangePassword([FromRoute] long id, [FromBody] dtoChangePassword cp) public JsonResult ChangePassword([FromRoute] long id, [FromBody] dtoChangePassword cp)
{ {
@@ -161,8 +161,8 @@ namespace rockfishCore.Controllers
public class dtoChangePassword public class dtoChangePassword
{ {
public string oldpassword; public string oldpassword { get; set; }
public string newpassword; public string newpassword { get; set; }
} }

View File

@@ -3,9 +3,9 @@ namespace rockfishCore.Models
//Used to populate list routes for return //Used to populate list routes for return
public class dtoCustomerListItem public class dtoCustomerListItem
{ {
public bool active; public bool active { get; set; }
public bool lapsed; public bool lapsed { get; set; }
public long id; public long id { get; set; }
public string name; public string name { get; set; }
} }
} }

View File

@@ -2,12 +2,12 @@ namespace rockfishCore.Models
{ {
//Used to populate list routes for return //Used to populate list routes for return
public class dtoLicenseListItem public class dtoLicenseListItem
{ {
public long id; public long id { get; set; }
public long created; public long created { get; set; }
public string regto; public string regto { get; set; }
public bool fetched; public bool fetched { get; set; }
public bool trial; public bool trial { get; set; }
} }
} }

View File

@@ -3,8 +3,8 @@ namespace rockfishCore.Models
//Used to populate list routes for return //Used to populate list routes for return
public class dtoNameIdActiveItem public class dtoNameIdActiveItem
{ {
public bool active; public bool active { get; set; }
public long id; public long id { get; set; }
public string name; public string name { get; set; }
} }
} }

View File

@@ -9,10 +9,10 @@ namespace rockfishCore.Models
{ {
children = new List<dtoNameIdItem>(); children = new List<dtoNameIdItem>();
} }
public long id; public long id { get; set; }
public string name; public string name { get; set; }
public List<dtoNameIdItem> children; public List<dtoNameIdItem> children { get; set; }
} }
} }

View File

@@ -2,8 +2,8 @@ namespace rockfishCore.Models
{ {
//Used to populate list routes for return //Used to populate list routes for return
public class dtoNameIdItem public class dtoNameIdItem
{ {
public long id; public long id { get; set; }
public string name; public string name { get; set; }
} }
} }

View File

@@ -77,6 +77,8 @@ namespace rockfishCore
}; };
}); });
} }
@@ -113,6 +115,7 @@ namespace rockfishCore
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>
{ {
endpoints.MapControllers(); endpoints.MapControllers();
}); });
} }
} }

View File

@@ -8,13 +8,13 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.3.111.9" /> <PackageReference Include="AWSSDK.S3" Version="3.3.111.9" />
<!-- <PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" /> -->
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.4" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.4" />
<PackageReference Include="jose-jwt" Version="2.5.0" /> <PackageReference Include="jose-jwt" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.4" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.4" />
<PackageReference Include="mailkit" Version="2.7.0" /> <PackageReference Include="mailkit" Version="2.7.0" />
<!-- <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.4" /> -->
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -259,21 +259,21 @@ namespace rockfishCore.Util
{ {
attachments = new List<fbAttachment>(); attachments = new List<fbAttachment>();
} }
public bool noRecord; public bool noRecord { get; set; }
public string id; public string id { get; set; }
public string title; public string title { get; set; }
public string project; public string project { get; set; }
public int priority; public int priority { get; set; }
public string notes; public string notes { get; set; }
public long? created; public long? created { get; set; }
public long? closed; public long? closed { get; set; }
public List<fbAttachment> attachments; public List<fbAttachment> attachments { get; set; }
} }
public class fbAttachment public class fbAttachment
{ {
public string fileName; public string fileName { get; set; }
public byte[] blob; public byte[] blob { get; set; }
} }
//eoc //eoc

View File

@@ -21,13 +21,18 @@ namespace rockfishCore.Util
private const string S3_HOST_ENDPOINT = "https://nyc3.digitaloceanspaces.com"; private const string S3_HOST_ENDPOINT = "https://nyc3.digitaloceanspaces.com";
private const string S3_BUCKET_NAME = "gztw1"; private const string S3_BUCKET_NAME = "gztw1";
private static HttpClient Client = new HttpClient(); private static readonly HttpClient _httpClient;
static OpsDiagnostics()
{
_httpClient = new HttpClient();
}
public static bool CheckWebsite(string url, string mustContain) public static bool CheckWebsite(string url, string mustContain)
{ {
bool Result = false; bool Result = false;
var Response = Client.GetAsync(url).Result; var Response = _httpClient.GetAsync(url).Result;
if (Response.IsSuccessStatusCode) if (Response.IsSuccessStatusCode)
{ {
var PageText = Response.Content.ReadAsStringAsync().Result; var PageText = Response.Content.ReadAsStringAsync().Result;
@@ -73,9 +78,11 @@ namespace rockfishCore.Util
} }
}; };
var httpClient = new HttpClient(httpClientHandler); using (var httpClient = new HttpClient(httpClientHandler))
await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url)); {
await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Head, url));
//httpClient.Dispose();
}
return ret; return ret;
} }

View File

@@ -43,8 +43,8 @@ namespace rockfishCore.Util
public class rfMailMessage public class rfMailMessage
{ {
public MimeMessage message; public MimeMessage message { get; set; }
public uint uid; public uint uid { get; set; }
} }
@@ -119,8 +119,8 @@ namespace rockfishCore.Util
bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "") bool trackDeliveryStatus = false, string CustomHeader = "", string CustomHeaderValue = "")
{ {
var message = new MimeMessage(); var message = new MimeMessage();
message.From.Add(new MailboxAddress("",MessageFrom)); message.From.Add(new MailboxAddress("", MessageFrom));
message.To.Add(new MailboxAddress("",MessageTo)); message.To.Add(new MailboxAddress("", MessageTo));
message.Subject = MessageSubject; message.Subject = MessageSubject;
message.Body = new TextPart("plain") message.Body = new TextPart("plain")
@@ -273,12 +273,12 @@ namespace rockfishCore.Util
case rfMailAccount.sales: case rfMailAccount.sales:
from_account = MAIL_ACCOUNT_SALES; from_account = MAIL_ACCOUNT_SALES;
from_account_password = MAIL_ACCOUNT_PASSWORD_SALES; from_account_password = MAIL_ACCOUNT_PASSWORD_SALES;
from = new MailboxAddress("",from_account); from = new MailboxAddress("", from_account);
break; break;
default: default:
from_account = MAIL_ACCOUNT_SUPPORT; from_account = MAIL_ACCOUNT_SUPPORT;
from_account_password = MAIL_ACCOUNT_PASSWORD_SUPPORT; from_account_password = MAIL_ACCOUNT_PASSWORD_SUPPORT;
from = new MailboxAddress("",from_account); from = new MailboxAddress("", from_account);
break; break;
} }
reply.From.Add(from); reply.From.Add(from);
@@ -342,7 +342,7 @@ namespace rockfishCore.Util
theBody = StripHTML(ht, true); theBody = StripHTML(ht, true);
theBody += "> "; theBody += "> ";
theBody = theBody.Replace("\r\n", "\r\n> ").Trim().TrimEnd('>'); theBody = theBody.Replace("\r\n", "\r\n> ").Trim().TrimEnd('>');
theBody ="\r\n"+theBody;//descend the first line under the On you wrote bit theBody = "\r\n" + theBody;//descend the first line under the On you wrote bit
} }
else else
@@ -520,7 +520,7 @@ namespace rockfishCore.Util
string CustomHeader = "", string CustomHeaderValue = "") string CustomHeader = "", string CustomHeaderValue = "")
{ {
var message = new MimeMessage(); var message = new MimeMessage();
message.From.Add(new MailboxAddress("",MessageFrom)); message.From.Add(new MailboxAddress("", MessageFrom));
//case 3512 handle more than one email in the address //case 3512 handle more than one email in the address
@@ -530,13 +530,13 @@ namespace rockfishCore.Util
var addrs = MessageTo.Split(','); var addrs = MessageTo.Split(',');
foreach (string addr in addrs) foreach (string addr in addrs)
{ {
mbAll.Add(new MailboxAddress("",addr.Trim())); mbAll.Add(new MailboxAddress("", addr.Trim()));
} }
message.To.AddRange(mbAll); message.To.AddRange(mbAll);
} }
else else
{ {
message.To.Add(new MailboxAddress("",MessageTo)); message.To.Add(new MailboxAddress("", MessageTo));
} }
@@ -656,12 +656,12 @@ namespace rockfishCore.Util
public class rfMessageSummary public class rfMessageSummary
{ {
public string account; public string account { get; set; }
public uint id; public uint id { get; set; }
public string from; public string from { get; set; }
public string subject; public string subject { get; set; }
public long? sent; public long? sent { get; set; }
public string flags; public string flags { get; set; }
} }
//Fetch a single string preview of message by Account / folder / UID //Fetch a single string preview of message by Account / folder / UID
@@ -737,9 +737,9 @@ namespace rockfishCore.Util
public class rfMessagePreview public class rfMessagePreview
{ {
public bool isKeyRequest; public bool isKeyRequest { get; set; }
public string preview; public string preview { get; set; }
public uint id; public uint id { get; set; }
} }

View File

@@ -2,7 +2,7 @@ namespace rockfishCore.Util
{ {
public static class RfVersion public static class RfVersion
{ {
public const string NumberOnly="6.8"; public const string NumberOnly="6.9";
public const string Full = "Rockfish server " + NumberOnly; public const string Full = "Rockfish server " + NumberOnly;
} }
} }