Skip to content

Commit

Permalink
fix(invitation): adjust invitation model (#568)
Browse files Browse the repository at this point in the history
Refs: CPLP-3383
  • Loading branch information
Phil91 authored Mar 15, 2024
1 parent 0c6aeb2 commit 7be06fc
Showing 1 changed file with 45 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,48 @@

namespace Org.Eclipse.TractusX.Portal.Backend.Administration.Service.Models;

public record CompanyInvitationData(
[property: JsonPropertyName("userName")]
string? UserName,
[property: DefaultValue("string")]
[property: RegularExpression(ValidationExpressions.Name, ErrorMessage = "Invalid firstName", MatchTimeoutInMilliseconds = 500)]
[property: JsonPropertyName("firstName")]
string FirstName,
[property: DefaultValue("string")]
[property: RegularExpression(ValidationExpressions.Name, ErrorMessage = "Invalid lastName", MatchTimeoutInMilliseconds = 500)]
[property: JsonPropertyName("lastName")]
string LastName,
[property: DefaultValue("string")]
[property: EmailAddress]
[property: JsonPropertyName("email")]
string Email,
[property: JsonPropertyName("organisationName")]
string OrganisationName);
public class CompanyInvitationData
{
public CompanyInvitationData(string? userName,
string firstName,
string lastName,
string email,
string organisationName)
{
this.UserName = userName;
this.FirstName = firstName;
this.LastName = lastName;
this.Email = email;
this.OrganisationName = organisationName;
}

[JsonPropertyName("userName")]
public string? UserName { get; init; }

[DefaultValue("string")]
[RegularExpression(ValidationExpressions.Name, ErrorMessage = "Invalid firstName", MatchTimeoutInMilliseconds = 500)]
[JsonPropertyName("firstName")]
public string FirstName { get; init; }

[DefaultValue("string")]
[RegularExpression(ValidationExpressions.Name, ErrorMessage = "Invalid lastName", MatchTimeoutInMilliseconds = 500)]
[JsonPropertyName("lastName")]
public string LastName { get; init; }

[DefaultValue("string")]
[EmailAddress]
[JsonPropertyName("email")]
public string Email { get; init; }

[JsonPropertyName("organisationName")]
public string OrganisationName { get; init; }

public void Deconstruct(out string? userName, out string firstName, out string lastName, out string email, out string organisationName)
{
userName = this.UserName;
firstName = this.FirstName;
lastName = this.LastName;
email = this.Email;
organisationName = this.OrganisationName;
}
}

0 comments on commit 7be06fc

Please sign in to comment.