From 3b128e31f520b3767efed267579f41920a4079b2 Mon Sep 17 00:00:00 2001
From: Leysan Nigmatullina <86958548+einlied753@users.noreply.github.com>
Date: Fri, 15 Jul 2022 11:46:48 +0300
Subject: [PATCH] PT-8151: Add About field for Contact (#17)
---
.../Commands/ContactCommand.cs | 1 +
.../Mapping/ProfileMappingProfile.cs | 1 +
.../RegisterOrganization/RegisteredContact.cs | 1 +
.../Schemas/ContactType.cs | 1 +
.../Schemas/InputContactBaseType.cs | 22 +++++++++++++++++++
.../Schemas/InputCreateContactType.cs | 17 +-------------
.../Schemas/InputUpdateContactType.cs | 11 +---------
.../InputRegisterContactType.cs | 1 +
.../RegisterCompany/RegisterContactType.cs | 1 +
...rce.ProfileExperienceApiModule.Data.csproj | 2 +-
.../module.manifest | 6 ++---
11 files changed, 34 insertions(+), 30 deletions(-)
create mode 100644 src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputContactBaseType.cs
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Commands/ContactCommand.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Commands/ContactCommand.cs
index d63f87c9..a8fbe017 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Commands/ContactCommand.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Commands/ContactCommand.cs
@@ -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
Addresses { get; set; }
public IList Phones { get; set; }
public IList Emails { get; set; }
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Mapping/ProfileMappingProfile.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Mapping/ProfileMappingProfile.cs
index ff58f72d..abe5ca85 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Mapping/ProfileMappingProfile.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Mapping/ProfileMappingProfile.cs
@@ -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 { input.PhoneNumber }
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Models/RegisterOrganization/RegisteredContact.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Models/RegisterOrganization/RegisteredContact.cs
index 34687ecf..cc36819c 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Models/RegisterOrganization/RegisteredContact.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Models/RegisterOrganization/RegisteredContact.cs
@@ -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 DynamicProperties { get; set; }
}
}
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/ContactType.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/ContactType.cs
index ef7ec4fe..55562f63 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/ContactType.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/ContactType.cs
@@ -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>("emails", resolve: x => x.Source.Contact.Emails, description: "List of contact`s emails");
Field("defaultBillingAddress", description: "Default billing address",
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputContactBaseType.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputContactBaseType.cs
new file mode 100644
index 00000000..9e8f0510
--- /dev/null
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputContactBaseType.cs
@@ -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(nameof(Contact.FullName));
+ Field>(nameof(Contact.FirstName));
+ Field>(nameof(Contact.LastName));
+ Field(nameof(Contact.MiddleName));
+ Field(nameof(Contact.Salutation));
+ Field(nameof(Contact.PhotoUrl));
+ Field(nameof(Contact.TimeZone));
+ Field(nameof(Contact.DefaultLanguage));
+ Field(nameof(Contact.About));
+ Field>(nameof(Contact.Organizations));
+ }
+ }
+}
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputCreateContactType.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputCreateContactType.cs
index 063b15d5..e80e6a7b 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputCreateContactType.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputCreateContactType.cs
@@ -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(nameof(Contact.FullName));
- Field>(nameof(Contact.FirstName));
- Field>(nameof(Contact.LastName));
- Field(nameof(Contact.MiddleName));
- Field(nameof(Contact.Salutation));
- Field(nameof(Contact.PhotoUrl));
- Field(nameof(Contact.TimeZone));
- Field(nameof(Contact.DefaultLanguage));
- Field>(nameof(Contact.Organizations));
- }
}
}
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputUpdateContactType.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputUpdateContactType.cs
index fca22603..e35997e0 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputUpdateContactType.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/InputUpdateContactType.cs
@@ -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);
- Field(nameof(Contact.FullName));
- Field>(nameof(Contact.FirstName));
- Field>(nameof(Contact.LastName));
- Field(nameof(Contact.MiddleName));
- Field(nameof(Contact.Salutation));
- Field(nameof(Contact.PhotoUrl));
- Field(nameof(Contact.TimeZone));
- Field(nameof(Contact.DefaultLanguage));
- Field>(nameof(Contact.Organizations));
}
}
}
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/InputRegisterContactType.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/InputRegisterContactType.cs
index eb8da0d5..a6b9988d 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/InputRegisterContactType.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/InputRegisterContactType.cs
@@ -13,6 +13,7 @@ public InputRegisterContactType()
Field("middleName");
Field("phoneNumber");
Field("birthdate");
+ Field("about");
Field>(nameof(Member.DynamicProperties));
}
}
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/RegisterContactType.cs b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/RegisterContactType.cs
index a286c0ce..916c04d0 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/RegisterContactType.cs
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/Schemas/RegisterCompany/RegisterContactType.cs
@@ -20,6 +20,7 @@ public RegisterContactType(IDynamicPropertyResolverService dynamicPropertyResolv
Field("birthdate");
Field("status");
Field("createdBy");
+ Field("about");
ExtendableField>(
"dynamicProperties",
"Contact's dynamic property values",
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Data/VirtoCommerce.ProfileExperienceApiModule.Data.csproj b/src/VirtoCommerce.ProfileExperienceApiModule.Data/VirtoCommerce.ProfileExperienceApiModule.Data.csproj
index 0b4acab5..1c15bbe6 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Data/VirtoCommerce.ProfileExperienceApiModule.Data.csproj
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Data/VirtoCommerce.ProfileExperienceApiModule.Data.csproj
@@ -29,7 +29,7 @@
-
+
diff --git a/src/VirtoCommerce.ProfileExperienceApiModule.Web/module.manifest b/src/VirtoCommerce.ProfileExperienceApiModule.Web/module.manifest
index efcfac82..7f56caad 100644
--- a/src/VirtoCommerce.ProfileExperienceApiModule.Web/module.manifest
+++ b/src/VirtoCommerce.ProfileExperienceApiModule.Web/module.manifest
@@ -1,4 +1,4 @@
-
+
VirtoCommerce.ProfileExperienceApiModule
3.211.0
@@ -20,7 +20,7 @@
VirtoCommerce.ProfileExperienceApiModule.Web.Module, VirtoCommerce.ProfileExperienceApiModule.Web
-
+
@@ -28,4 +28,4 @@
commerce
false
-
\ No newline at end of file
+