-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YOMA-611] Opportunity Completions Import (#1178)
* Code completed; Pending testing and bug fixing * Testing and bug fixing
- Loading branch information
1 parent
e196a2b
commit ce751a7
Showing
14 changed files
with
260 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/api/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityInfoCsvImport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Yoma.Core.Domain.MyOpportunity.Models | ||
{ | ||
public class MyOpportunityInfoCsvImport | ||
{ | ||
public string? Email { get; set; } | ||
|
||
public string? PhoneNumber { get; set; } | ||
|
||
public string? FirstName { get; set; } | ||
|
||
public string? Surname { get; set; } | ||
|
||
public string? Gender { get; set; } | ||
|
||
public string? Country { get; set; } | ||
|
||
[Required] | ||
public string OpporunityExternalId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...i/src/domain/Yoma.Core.Domain/MyOpportunity/Models/MyOpportunityRequestVerifyImportCsv.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Yoma.Core.Domain.MyOpportunity.Models | ||
{ | ||
public class MyOpportunityRequestVerifyImportCsv | ||
{ | ||
public IFormFile File { get; set; } | ||
|
||
public Guid OrganizationId { get; set; } | ||
|
||
public string? Comment { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...Yoma.Core.Domain/MyOpportunity/Validators/MyOpportunityRequestValidatorVerifyImportCsv.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using FluentValidation; | ||
using Yoma.Core.Domain.Entity.Interfaces; | ||
using Yoma.Core.Domain.MyOpportunity.Models; | ||
|
||
namespace Yoma.Core.Domain.MyOpportunity.Validators | ||
{ | ||
public class MyOpportunityRequestValidatorVerifyImportCsv : AbstractValidator<MyOpportunityRequestVerifyImportCsv> | ||
{ | ||
#region Class Variables | ||
private readonly IOrganizationService _organizationService; | ||
#endregion | ||
|
||
#region Constructor | ||
public MyOpportunityRequestValidatorVerifyImportCsv(IOrganizationService organizationService) | ||
{ | ||
_organizationService = organizationService; | ||
|
||
RuleFor(x => x.File).Must(file => file != null && file.Length > 0).WithMessage("{PropertyName} is required."); | ||
RuleFor(x => x.OrganizationId).NotEmpty().Must(OrganizationExists).WithMessage($"Specified organization does not exist."); | ||
} | ||
#endregion | ||
|
||
#region Private Members | ||
private bool OrganizationExists(Guid id) | ||
{ | ||
if (id == Guid.Empty) return false; | ||
return _organizationService.GetByIdOrNull(id, false, false, false) != null; | ||
} | ||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.