-
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.
Merge pull request #1494 from DFE-Digital/add-creation-channel-model
Add creation channel model and TTA endppoint update
- Loading branch information
Showing
28 changed files
with
744 additions
and
95 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
121 changes: 121 additions & 0 deletions
121
GetIntoTeachingApi/Models/Crm/ContactChannelCreation.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,121 @@ | ||
using GetIntoTeachingApi.Attributes; | ||
using GetIntoTeachingApi.Services; | ||
using Microsoft.Xrm.Sdk; | ||
using System; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace GetIntoTeachingApi.Models.Crm | ||
{ | ||
[SwaggerIgnore] | ||
[Entity("dfe_contactchannelcreation")] | ||
public class ContactChannelCreation : BaseModel, IHasCandidateId | ||
{ | ||
public enum CreationChannelSource | ||
{ | ||
Apply = 222750000, | ||
CheckinApp = 222750001, | ||
ContactCentre = 222750002, | ||
GITWebsite = 222750003, | ||
Highfliers = 222750004, | ||
HPITT = 222750005, | ||
Internships = 222750006, | ||
Legacy = 222750007, | ||
OnCampus = 222750008, | ||
PaidAdvertising = 222750009, | ||
PaidSearch = 222750010, | ||
PaidSocial = 222750011, | ||
Pipeline = 222750012, | ||
SchoolExperience = 222750013, | ||
Scholarships = 222750014 | ||
} | ||
|
||
public enum CreationChannelService | ||
{ | ||
CreatedOnApply = 222750000, | ||
CreatedOnSchoolExperience = 222750001, | ||
CreatedOnScholarships = 222750002, | ||
CreatedOnInternships = 222750003, | ||
CreatedOnHPITT = 222750004, | ||
CreatedOnHighfliers = 222750011, | ||
ExploreTeachingAdviserService = 222750005, | ||
Events = 222750006, | ||
MailingList = 222750007, | ||
PaidSearch = 222750008, | ||
ReturnToTeachingAdviserService = 222750009, | ||
TeacherTrainingAdviserService = 222750010 | ||
} | ||
|
||
public enum CreationChannelActivity | ||
{ | ||
BrandAmbassadorActivity = 222750000, | ||
BritishCouncil = 222750001, | ||
BRFS = 222750002, | ||
BCS = 222750003, | ||
CareersEvent = 222750004, | ||
CTP = 222750005, | ||
DebateMate = 222750006, | ||
EngineersTeachPhysics = 222750007, | ||
FreshersFairs = 222750008, | ||
F2F = 222750009, | ||
GradFairs = 222750010, | ||
InstituteOfPhysics = 222750011, | ||
IMECHE = 222750012, | ||
IMA = 222750013, | ||
NTP = 222750014, | ||
OnsiteActivationDays = 222750015, | ||
Over18CareersEvent = 222750016, | ||
QuickfireSignUpOnApply = 222750017, | ||
RefreshersFairs = 222750018, | ||
RussellGroup6 = 222750019, | ||
RCS = 222750020, | ||
StudentUnionMedia = 222750021, | ||
StudentRooms = 222750022, | ||
ServiceLeaver = 222750023, | ||
Webinar = 222750024 | ||
} | ||
|
||
[JsonIgnore] | ||
[EntityField("dfe_contactid", typeof(EntityReference), "contact")] | ||
public Guid CandidateId { get; set; } | ||
|
||
[EntityField("createdby", typeof(EntityReference), "systemuser")] | ||
public Guid? CreatedBy { get; set; } | ||
|
||
[EntityField("dfe_creationchannel")] | ||
public bool? CreationChannel { get; set; } = false; | ||
|
||
[EntityField("dfe_creationchannelsource", typeof(OptionSetValue))] | ||
public int? CreationChannelSourceId { get; set; } | ||
|
||
[EntityField("dfe_creationchannelservice", typeof(OptionSetValue))] | ||
public int? CreationChannelServiceId { get; set; } | ||
|
||
[EntityField("dfe_creationchannelactivities", typeof(OptionSetValue))] | ||
public int? CreationChannelActivityId { get; set; } | ||
|
||
public ContactChannelCreation() : base(){ | ||
} | ||
|
||
public ContactChannelCreation(Entity entity, ICrmService crm, IServiceProvider serviceProvider) | ||
: base(entity, crm, serviceProvider){ | ||
} | ||
|
||
/// <summary> | ||
/// Factory method for creating a ContactChannelCreation instance. | ||
/// </summary> | ||
/// <returns> | ||
/// A configured <see cref="ContactChannelCreation"/> instance. | ||
/// </returns> | ||
public static ContactChannelCreation Create( | ||
bool creationChannel, | ||
int? sourceId, | ||
int? serviceId, | ||
int? activityId) => new() | ||
{ | ||
CreationChannel = creationChannel, | ||
CreationChannelSourceId = sourceId, | ||
CreationChannelServiceId = serviceId, | ||
CreationChannelActivityId = activityId, | ||
}; | ||
} | ||
} |
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,29 @@ | ||
namespace GetIntoTeachingApi.Models.Crm | ||
{ | ||
/// <summary> | ||
/// Interface that defines the contract on which objects | ||
/// that wish to invoke contact channel creation behaviour must adhere. | ||
/// </summary> | ||
public interface ICreateContactChannel | ||
{ | ||
/// <summary> | ||
/// Provides the default read-only contact creation channel integer value. | ||
/// </summary> | ||
int? DefaultContactCreationChannel { get; } | ||
|
||
/// <summary> | ||
/// Provides the ability to assign and retrieve the channel source creation identifier. | ||
/// </summary> | ||
int? CreationChannelSourceId { get; set; } | ||
|
||
/// <summary> | ||
/// Provides the ability to assign and retrieve the channel service creation identifier. | ||
/// </summary> | ||
int? CreationChannelServiceId { get; set; } | ||
|
||
/// <summary> | ||
/// Provides the ability to assign and retrieve the channel activity creation identifier. | ||
/// </summary> | ||
int? CreationChannelActivityId { 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
19 changes: 19 additions & 0 deletions
19
GetIntoTeachingApi/Models/Crm/Validators/ContactChannelCreationValidator.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,19 @@ | ||
using FluentValidation; | ||
using GetIntoTeachingApi.Services; | ||
using GetIntoTeachingApi.Validators; | ||
|
||
namespace GetIntoTeachingApi.Models.Crm.Validators | ||
{ | ||
public class ContactChannelCreationValidator : AbstractValidator<ContactChannelCreation> | ||
{ | ||
public ContactChannelCreationValidator(IStore store) | ||
{ | ||
RuleFor(contactChannelCreation => contactChannelCreation.CreationChannelSourceId) | ||
.SetValidator(new PickListItemIdValidator<ContactChannelCreation>("dfe_contactchannelcreation", "dfe_creationchannelsource", store)); | ||
RuleFor(contactChannelCreation => contactChannelCreation.CreationChannelServiceId) | ||
.SetValidator(new PickListItemIdValidator<ContactChannelCreation>("dfe_contactchannelcreation", "dfe_creationchannelservice", store)); | ||
RuleFor(contactChannelCreation => contactChannelCreation.CreationChannelActivityId) | ||
.SetValidator(new PickListItemIdValidator<ContactChannelCreation>("dfe_contactchannelcreation", "dfe_creationchannelactivities", store)); | ||
} | ||
} | ||
} |
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.