This commit is contained in:
2020-12-02 19:45:00 +00:00
parent 1dc680f296
commit 98253526f7
3 changed files with 41 additions and 7 deletions

2
.vscode/launch.json vendored
View File

@@ -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\\"

View File

@@ -271,7 +271,7 @@ namespace AyaNova.Api.Controllers
/// </summary>
/// <returns>Customer contact users</returns>
[HttpGet("customer-contacts/{customerId}")]
public async Task<IActionResult> GetClientContactList(long customerId)
public async Task<IActionResult> GetCustomerContactList(long customerId)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -295,6 +295,36 @@ namespace AyaNova.Api.Controllers
return Ok(ApiOkResponse.Response(ret));
}
/// <summary>
/// Get list of HeadOffice Contact Users
/// (Rights to HeadOffice object required)
/// </summary>
/// <returns>HeadOffice contact users</returns>
[HttpGet("head-office-contacts/{headofficeId}")]
public async Task<IActionResult> GetHeadOfficeContactList(long headofficeId)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.HeadOffice))
return StatusCode(403, new ApiNotAuthorizedResponse());
var ret = await ct.User.Include(o => o.UserOptions).Where(z => z.UserType == UserType.HeadOffice && z.HeadOfficeId == headofficeId).Select(z => new
{
Id = z.Id,
Active = z.Active,
Name = z.Name,
UserType = z.UserType,
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>

View File

@@ -285,7 +285,7 @@ namespace AyaNova.Util
//CUSTOMERS
await GenSeedCustomerAsync(log, 500);
//HEAD-OFFICES
//HEAD-OFFICES
await GenSeedHeadOfficeAsync(log, 20);
//PERF
@@ -359,7 +359,7 @@ namespace AyaNova.Util
//CUSTOMERS
await GenSeedCustomerAsync(log, 5000);
//HEAD-OFFICES
//HEAD-OFFICES
await GenSeedHeadOfficeAsync(log, 30);
//PERF
@@ -433,7 +433,7 @@ namespace AyaNova.Util
//CUSTOMERS
await GenSeedCustomerAsync(log, 20000);
//HEAD-OFFICES
//HEAD-OFFICES
await GenSeedHeadOfficeAsync(log, 40);
//PERF
@@ -586,8 +586,12 @@ namespace AyaNova.Util
public async Task GenSeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType,
bool active = true, string login = null, string password = null, long translationId = 0, List<string> tags = null, long? vendorId = null, long? customerId = null, long? headofficeId = null)
public async Task GenSeedUserAsync(
ILogger log, int count, AuthorizationRoles roles, UserType userType,
bool active = true, string login = null, string password = null,
long translationId = 0, List<string> tags = null,
long? vendorId = null, long? customerId = null, long? headofficeId = null
)
{
if (translationId == 0)
translationId = ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID;