-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce a DTO class for UserContactPoints as received from Profile API
- Loading branch information
Showing
5 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.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,27 @@ | ||
using Altinn.Notifications.Core.Models.ContactPoints; | ||
using Altinn.Notifications.Integrations.Profile.Models; | ||
|
||
namespace Altinn.Notifications.Integrations.Profile.Mappers; | ||
|
||
/// <summary> | ||
/// Extension class to map from DTO / Profile API model to domain model for UserContactPoints | ||
/// </summary> | ||
public static class UserContactPointsDTOMapperExtension | ||
Check warning on line 9 in src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs GitHub Actions / Build, test & analyze
Check warning on line 9 in src/Altinn.Notifications.Integrations/Profile/Mappers/UserContactPointsDTOMapperExtension.cs GitHub Actions / Build, test & analyze
|
||
{ | ||
/// <summary> | ||
/// Maps the DTO model to domain model | ||
/// </summary> | ||
/// <param name="userContactPointDto">This DTO object</param> | ||
/// <returns>The UserContactPoints object mapped from this DTO object</returns> | ||
public static UserContactPoints ToUserContactPoint(this UserContactPointsDTO userContactPointDto) | ||
{ | ||
return new UserContactPoints | ||
{ | ||
UserId = userContactPointDto.UserId ?? 0, | ||
NationalIdentityNumber = userContactPointDto.NationalIdentityNumber ?? string.Empty, | ||
IsReserved = userContactPointDto.IsReserved, | ||
MobileNumber = userContactPointDto.MobileNumber ?? string.Empty, | ||
Email = userContactPointDto.Email ?? string.Empty | ||
}; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.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,32 @@ | ||
namespace Altinn.Notifications.Integrations.Profile.Models; | ||
|
||
/// <summary> | ||
/// Data transfer object for the API model describing the availability of contact points for a user, received from the ProfileClient | ||
/// </summary> | ||
public class UserContactPointsDTO | ||
Check warning on line 6 in src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs GitHub Actions / Build, test & analyze
Check warning on line 6 in src/Altinn.Notifications.Integrations/Profile/Models/UserContactPointsDTO.cs GitHub Actions / Build, test & analyze
|
||
{ | ||
/// <summary> | ||
/// Gets or sets the ID of the user | ||
/// </summary> | ||
public int? UserId { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the national identityt number of the user | ||
/// </summary> | ||
public string? NationalIdentityNumber { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a boolean indicating whether the user has reserved themselves from electronic communication | ||
/// </summary> | ||
public bool IsReserved { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the mobile number | ||
/// </summary> | ||
public string? MobileNumber { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the email address | ||
/// </summary> | ||
public string? Email { 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
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