This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -53,7 +53,7 @@
|
||||
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
|
||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"
|
||||
|
||||
@@ -301,25 +301,29 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("outlist")]
|
||||
public async Task<IActionResult> GetOutsideUserList()
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
var ret = await ct.User.Where(z => z.UserType == UserType.Customer || z.UserType == UserType.HeadOffice).Select(z => new dtUser
|
||||
var ret = await ct.User.Include(o => o.UserOptions).Where(z => z.UserType == UserType.Customer || z.UserType == UserType.HeadOffice).Select(z => new
|
||||
{
|
||||
Id = z.Id,
|
||||
Active = z.Active,
|
||||
Name = z.Name,
|
||||
UserType = z.UserType,
|
||||
LastLogin = z.LastLogin
|
||||
LastLogin = z.LastLogin,
|
||||
EmailAddress = z.UserOptions.EmailAddress,
|
||||
Phone1 = z.UserOptions.Phone1,
|
||||
Phone2 = z.UserOptions.Phone2,
|
||||
Phone3 = z.UserOptions.Phone3
|
||||
|
||||
}).ToListAsync();
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Get list of Customer Contact Users
|
||||
/// (Rights to Customer object required)
|
||||
/// </summary>
|
||||
@@ -327,19 +331,23 @@ namespace AyaNova.Api.Controllers
|
||||
[HttpGet("customer-contacts/{customerId}")]
|
||||
public async Task<IActionResult> GetClientContactList(long customerId)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Customer))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
var ret = await ct.User.Where(z => z.UserType == UserType.Customer && z.CustomerId==customerId).Select(z => new dtUser
|
||||
var ret = await ct.User.Include(o => o.UserOptions).Where(z => z.UserType == UserType.Customer && z.CustomerId == customerId).Select(z => new
|
||||
{
|
||||
Id = z.Id,
|
||||
Active = z.Active,
|
||||
Name = z.Name,
|
||||
UserType = z.UserType,
|
||||
LastLogin = z.LastLogin
|
||||
LastLogin = z.LastLogin,
|
||||
EmailAddress = z.UserOptions.EmailAddress,
|
||||
Phone1 = z.UserOptions.Phone1,
|
||||
Phone2 = z.UserOptions.Phone2,
|
||||
Phone3 = z.UserOptions.Phone3
|
||||
|
||||
}).ToListAsync();
|
||||
return Ok(ApiOkResponse.Response(ret));
|
||||
|
||||
@@ -348,9 +348,7 @@ namespace AyaNova.Biz
|
||||
await ValidateCanDelete(dbObject);
|
||||
if (HasErrors)
|
||||
return false;
|
||||
//Remove the object
|
||||
ct.User.Remove(dbObject);
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
//Delete sibling objects
|
||||
//USEROPTIONS
|
||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from auseroptions where userid = {dbObject.Id}");
|
||||
@@ -365,6 +363,11 @@ namespace AyaNova.Biz
|
||||
await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct);
|
||||
await TagBiz.ProcessDeleteTagsInRepositoryAsync(ct, dbObject.Tags);
|
||||
await FileUtil.DeleteAttachmentsForObjectAsync(BizType, dbObject.Id, ct);
|
||||
|
||||
//Remove the object
|
||||
ct.User.Remove(dbObject);
|
||||
await ct.SaveChangesAsync();
|
||||
|
||||
await transaction.CommitAsync();
|
||||
await NotifyEventProcessor.HandlePotentialNotificationEvent(AyaEvent.Deleted, dbObject);
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace AyaNova.Util
|
||||
u.UserOptions.EmailAddress = Fake.Internet.ExampleEmail();
|
||||
u.UserOptions.Hour12 = true;
|
||||
u.UserOptions.CurrencyName = "USD";
|
||||
u.UserOptions.UiColor = Fake.Internet.Color();
|
||||
u.UserOptions.UiColor = Fake.Internet.Color().ToUpperInvariant();
|
||||
|
||||
|
||||
//this seems wrong to get a new context inside a loop but in testing is actually faster!?
|
||||
@@ -725,7 +725,7 @@ namespace AyaNova.Util
|
||||
o.Notes = Fake.Company.CatchPhrase();
|
||||
o.Tags = RandomTags();
|
||||
|
||||
o.AccountNumber=Fake.Finance.Account();
|
||||
o.AccountNumber = Fake.Finance.Account();
|
||||
o.Latitude = (decimal)Fake.Address.Latitude();
|
||||
o.Longitude = (decimal)Fake.Address.Longitude();
|
||||
o.Address = Fake.Address.StreetAddress();
|
||||
@@ -733,11 +733,11 @@ namespace AyaNova.Util
|
||||
o.Region = Fake.Address.State();
|
||||
o.Country = Fake.Address.Country();
|
||||
|
||||
o.Phone1=Fake.Phone.PhoneNumber();
|
||||
o.Phone2=Fake.Phone.PhoneNumber();
|
||||
o.Phone3=Fake.Phone.PhoneNumber();
|
||||
o.WebAddress=Fake.Internet.Url();
|
||||
o.EmailAddress=Fake.Internet.ExampleEmail();
|
||||
o.Phone1 = Fake.Phone.PhoneNumber();
|
||||
o.Phone2 = Fake.Phone.PhoneNumber();
|
||||
o.Phone3 = Fake.Phone.PhoneNumber();
|
||||
o.WebAddress = Fake.Internet.Url();
|
||||
o.EmailAddress = Fake.Internet.ExampleEmail();
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user