Skip to content

Commit

Permalink
PT-8151: Add About field for Contact (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
einlied753 authored Jul 15, 2022
1 parent 4cca81b commit 3b128e3
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ protected ContactCommand()
public string FirstName { get; set; }
public string FullName { get; set; }
public string Salutation { get; set; }
public string About { get; set; }
public IList<Address> Addresses { get; set; }
public IList<string> Phones { get; set; }
public IList<string> Emails { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public ProfileMappingProfile()
LastName = input.LastName,
MiddleName = input.MiddleName,
BirthDate = input.Birthdate,
About = input.About,
Phones = input.PhoneNumber == null ?
null :
new List<string> { input.PhoneNumber }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class RegisteredContact
public string MiddleName { get; set; }
public DateTime Birthdate { get; set; }
public string PhoneNumber { get; set; }
public string About { get; set; }
public IList<DynamicPropertyValue> DynamicProperties { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public ContactType(
Field(x => x.Contact.Name, true);
Field(x => x.Contact.OuterId, true);
Field(x => x.Contact.Status, true).Description("Contact status");
Field(x => x.Contact.About);
Field<ListGraphType<StringGraphType>>("emails", resolve: x => x.Source.Contact.Emails, description: "List of contact`s emails");

Field<MemberAddressType>("defaultBillingAddress", description: "Default billing address",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using GraphQL.Types;
using VirtoCommerce.CustomerModule.Core.Model;

namespace VirtoCommerce.ProfileExperienceApiModule.Data.Schemas
{
public abstract class InputContactBaseType : InputMemberBaseType
{
protected InputContactBaseType()
{
Field<StringGraphType>(nameof(Contact.FullName));
Field<NonNullGraphType<StringGraphType>>(nameof(Contact.FirstName));
Field<NonNullGraphType<StringGraphType>>(nameof(Contact.LastName));
Field<StringGraphType>(nameof(Contact.MiddleName));
Field<StringGraphType>(nameof(Contact.Salutation));
Field<StringGraphType>(nameof(Contact.PhotoUrl));
Field<StringGraphType>(nameof(Contact.TimeZone));
Field<StringGraphType>(nameof(Contact.DefaultLanguage));
Field<StringGraphType>(nameof(Contact.About));
Field<ListGraphType<StringGraphType>>(nameof(Contact.Organizations));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
using GraphQL.Types;
using VirtoCommerce.CustomerModule.Core.Model;

namespace VirtoCommerce.ProfileExperienceApiModule.Data.Schemas
{
public class InputCreateContactType : InputMemberBaseType
public class InputCreateContactType : InputContactBaseType
{
public InputCreateContactType()
{
Field<StringGraphType>(nameof(Contact.FullName));
Field<NonNullGraphType<StringGraphType>>(nameof(Contact.FirstName));
Field<NonNullGraphType<StringGraphType>>(nameof(Contact.LastName));
Field<StringGraphType>(nameof(Contact.MiddleName));
Field<StringGraphType>(nameof(Contact.Salutation));
Field<StringGraphType>(nameof(Contact.PhotoUrl));
Field<StringGraphType>(nameof(Contact.TimeZone));
Field<StringGraphType>(nameof(Contact.DefaultLanguage));
Field<ListGraphType<StringGraphType>>(nameof(Contact.Organizations));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,11 @@

namespace VirtoCommerce.ProfileExperienceApiModule.Data.Schemas
{
public class InputUpdateContactType : InputMemberBaseType
public class InputUpdateContactType : InputContactBaseType
{
public InputUpdateContactType()
{
Fields.FirstOrDefault(x => x.Name == nameof(Member.Id)).Type = typeof(NonNullGraphType<StringGraphType>);
Field<StringGraphType>(nameof(Contact.FullName));
Field<NonNullGraphType<StringGraphType>>(nameof(Contact.FirstName));
Field<NonNullGraphType<StringGraphType>>(nameof(Contact.LastName));
Field<StringGraphType>(nameof(Contact.MiddleName));
Field<StringGraphType>(nameof(Contact.Salutation));
Field<StringGraphType>(nameof(Contact.PhotoUrl));
Field<StringGraphType>(nameof(Contact.TimeZone));
Field<StringGraphType>(nameof(Contact.DefaultLanguage));
Field<ListGraphType<StringGraphType>>(nameof(Contact.Organizations));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public InputRegisterContactType()
Field<StringGraphType>("middleName");
Field<StringGraphType>("phoneNumber");
Field<DateGraphType>("birthdate");
Field<StringGraphType>("about");
Field<ListGraphType<InputDynamicPropertyValueType>>(nameof(Member.DynamicProperties));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public RegisterContactType(IDynamicPropertyResolverService dynamicPropertyResolv
Field<DateGraphType>("birthdate");
Field<StringGraphType>("status");
Field<StringGraphType>("createdBy");
Field<StringGraphType>("about");
ExtendableField<ListGraphType<DynamicPropertyValueType>>(
"dynamicProperties",
"Contact's dynamic property values",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageReference Include="MediatR" Version="8.0.1" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.203.0" />
<PackageReference Include="VirtoCommerce.CustomerModule.Core" Version="3.207.0" />
<PackageReference Include="VirtoCommerce.ExperienceApiModule.Core" Version="3.200.0" />
<PackageReference Include="VirtoCommerce.MarketingModule.Core" Version="3.200.0" />
<PackageReference Include="VirtoCommerce.Platform.Core" Version="3.200.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>VirtoCommerce.ProfileExperienceApiModule</id>
<version>3.211.0</version>
Expand All @@ -20,12 +20,12 @@
<moduleType>VirtoCommerce.ProfileExperienceApiModule.Web.Module, VirtoCommerce.ProfileExperienceApiModule.Web</moduleType>
<dependencies>
<dependency id="VirtoCommerce.ExperienceApi" version="3.200.0" />
<dependency id="VirtoCommerce.Customer" version="3.200.0" />
<dependency id="VirtoCommerce.Customer" version="3.207.0" />
<dependency id="VirtoCommerce.Store" version="3.200.0" />
<dependency id="VirtoCommerce.Marketing" version="3.200.0" />
</dependencies>
<groups>
<group>commerce</group>
</groups>
<useFullTypeNameInSwagger>false</useFullTypeNameInSwagger>
</module>
</module>

0 comments on commit 3b128e3

Please sign in to comment.