From 197a30225ec576e8d07cafe53e7268af89061fdf Mon Sep 17 00:00:00 2001 From: Chidi Ekuma Date: Fri, 15 Dec 2023 09:53:09 +0000 Subject: [PATCH 1/2] Adds optional param to TeachingEventAddAttendee - Adds `Channel_id` to the model --- .../Models/GetIntoTeaching/TeachingEventAddAttendee.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GetIntoTeachingApi/Models/GetIntoTeaching/TeachingEventAddAttendee.cs b/GetIntoTeachingApi/Models/GetIntoTeaching/TeachingEventAddAttendee.cs index 58d913c6e..cd4a2b69e 100644 --- a/GetIntoTeachingApi/Models/GetIntoTeaching/TeachingEventAddAttendee.cs +++ b/GetIntoTeachingApi/Models/GetIntoTeaching/TeachingEventAddAttendee.cs @@ -15,6 +15,10 @@ public class TeachingEventAddAttendee [SwaggerSchema(WriteOnly = true)] public Guid? EventId { get; set; } + + [SwaggerSchema(WriteOnly = true)] + public int? ChannelId { get; set; } + [SwaggerSchema(WriteOnly = true)] public Guid? AcceptedPolicyId { get; set; } public Guid? PreferredTeachingSubjectId { get; set; } @@ -136,7 +140,7 @@ private void ConfigureChannel(Candidate candidate) { if (CandidateId == null) { - candidate.ChannelId = (int?)Candidate.Channel.Event; + candidate.ChannelId = ChannelId ?? (int?)Candidate.Channel.Event; } } From ff2a521f9e6df640ba6b363876a5d75c2e0c8d87 Mon Sep 17 00:00:00 2001 From: Chidi Ekuma Date: Tue, 2 Jan 2024 17:49:39 +0000 Subject: [PATCH 2/2] Adds Unit test --- .../GetIntoTeaching/TeachingEventAddAttendeeTests.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/GetIntoTeachingApiTests/Models/GetIntoTeaching/TeachingEventAddAttendeeTests.cs b/GetIntoTeachingApiTests/Models/GetIntoTeaching/TeachingEventAddAttendeeTests.cs index 2b4dee280..53002b45d 100644 --- a/GetIntoTeachingApiTests/Models/GetIntoTeaching/TeachingEventAddAttendeeTests.cs +++ b/GetIntoTeachingApiTests/Models/GetIntoTeaching/TeachingEventAddAttendeeTests.cs @@ -156,6 +156,14 @@ public void Candidate_ChannelIdWhenCandidateIdIsNull_IsMailingList() request.Candidate.ChannelId.Should().Be((int)Candidate.Channel.Event); } + [Fact] + public void Candidate_WithNonNullChannelIdWhenCandidateIdIsNull_IsMailingList() + { + var request = new TeachingEventAddAttendee() { CandidateId = null, ChannelId = 456 }; + + request.Candidate.ChannelId.Should().Be(456); + } + [Fact] public void Candidate_ChannelIdWhenCandidateIdIsNotNull_IsNotChanged() {