Skip to content

Commit

Permalink
Testing and bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianwium committed Dec 10, 2024
1 parent 8fa4963 commit 0eef9a9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/api/Yoma.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
src\scripts\index_fragmentation_postgre.sql = src\scripts\index_fragmentation_postgre.sql
src\scripts\index_rebuild_reorganize_ms.sql = src\scripts\index_rebuild_reorganize_ms.sql
src\scripts\index_rebuild_reorganize_postgre.sql = src\scripts\index_rebuild_reorganize_postgre.sql
src\other\MyOpportunityInfoCsvImport_Sample.csv = src\other\MyOpportunityInfoCsvImport_Sample.csv
src\other\OpportunityInfoCsvImport_Sample.csv = src\other\OpportunityInfoCsvImport_Sample.csv
EndProjectSection
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
using Yoma.Core.Domain.Entity.Models;
using Yoma.Core.Domain.IdentityProvider.Extensions;
using Yoma.Core.Domain.IdentityProvider.Interfaces;
using Yoma.Core.Domain.Opportunity;
using Yoma.Core.Domain.Opportunity.Extensions;
using Yoma.Core.Domain.Opportunity.Interfaces;
using Yoma.Core.Domain.ShortLinkProvider.Interfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ public async Task<User> Upsert(UserRequest request)
// profile fields updatable via UserProfileService.Update; identity provider is source of truth
if (isNew)
{
var kcUser = await _identityProviderClient.GetUserByUsername(request.Username)
?? throw new InvalidOperationException($"{nameof(User)} with username '{request.Username}' does not exist");
result.FirstName = request.FirstName;
result.Surname = request.Surname;
result.DisplayName = request.DisplayName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ private async Task ProcessImportVerification(MyOpportunityRequestVerifyImportCsv
throw new ValidationException("Opportunity external id required");

var opportunity = _opportunityService.GetByExternalId(requestImport.OrganizationId, item.OpporunityExternalId, true, true);
if(opportunity.VerificationMethod != VerificationMethod.Automatic)
if (opportunity.VerificationMethod != VerificationMethod.Automatic)
throw new ValidationException($"Verification import not supported for opporunity '{opportunity.Title}'. The verification method must be set to 'Automatic'");

var user = _userService.GetByUsernameOrNull(username, false, false);
Expand All @@ -1060,8 +1060,10 @@ private async Task ProcessImportVerification(MyOpportunityRequestVerifyImportCsv
{
var request = new UserRequest
{
Id = user?.Id,
Username = username,
Email = item.Email,
PhoneNumber = item.PhoneNumber,
FirstName = item.FirstName,
Surname = item.Surname,
EmailConfirmed = item.Email == null ? null : false,
Expand All @@ -1084,7 +1086,6 @@ await _executionStrategyService.ExecuteInExecutionStrategyAsync(async () =>

scope.Complete();
});

}

private static List<(DateTime WeekEnding, int Count)> SummaryGroupByWeekItems(List<MyOpportunityInfo> items)
Expand Down
6 changes: 6 additions & 0 deletions src/api/src/other/MyOpportunityInfoCsvImport_Sample.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Email,PhoneNumber,FirstName,Surname,Gender,Country,OpporunityExternalId
,1234567890,John,Doe,Male,US,External_ID1
jane.smith@example.com,,Jane,Smith,Female,GB,External_ID2
ali.khan@example.com,5512345678,,,Male,PK,External_ID3
maria.garcia@example.com,34987654321,Maria,Garcia,,,External_ID4
ali.khan@example.com,5512345678,Jim,Chen,Male,CN,External_ID5

0 comments on commit 0eef9a9

Please sign in to comment.