Skip to content

Commit

Permalink
Merge branch 'main' into feature/328792-Update-PowerBI-Link
Browse files Browse the repository at this point in the history
  • Loading branch information
NinjaFocks authored May 9, 2024
2 parents aaba2ae + 3c631f3 commit 3e833d1
Show file tree
Hide file tree
Showing 95 changed files with 3,669 additions and 601 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,4 @@ FodyWeavers.xsd
src/certs/kainos-chain.pem
src/certs/kainos-chain.p7b
/src/EPR.RegulatorService.Frontend.Web/appsettings.development.json
/src/EPR.RegulatorService.Frontend.Web/appsettings.development.json
5 changes: 3 additions & 2 deletions pipelines/ci_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ variables:
resources:
repositories:
- repository: CommonTemplates
name: RWD-CPR-EPR4P-ADO/epr-webapps-code-deploy-templates
type: git
name: defra/epr-webapps-code-deploy-templates
type: github
endpoint: defra
ref: main

extends:
Expand Down
5 changes: 3 additions & 2 deletions pipelines/deployment-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ variables:
resources:
repositories:
- repository: CommonTemplates
name: RWD-CPR-EPR4P-ADO/epr-webapps-code-deploy-templates
type: git
name: defra/epr-webapps-code-deploy-templates
type: github
endpoint: defra
ref: main

# The repo will be reference the repo by a release tag (if the imageTag parameter contains 'release') otherwise it will pull down the main branch.
Expand Down
4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM defradigital/dotnetcore-development:latest AS build-env
FROM defradigital/dotnetcore-development:dotnet6.0 AS build-env
# trigger Build 00.15
# Expose the app on a defined port, configurable via a build argument
ARG PORT=3000
Expand Down Expand Up @@ -32,7 +32,7 @@ WORKDIR /home/dotnet/EPR.RegulatorService.Frontend.Web
RUN dotnet publish -c Release -o out

# Build runtime image
FROM defradigital/dotnetcore:latest
FROM defradigital/dotnetcore:dotnet6.0
COPY --from=build-env --chown=dotnet /home/dotnet/EPR.RegulatorService.Frontend.Web/out .

# Add internationalisation support
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace EPR.RegulatorService.Frontend.Core.Converters;

using System;
using System.Text.Json;
using System.Text.Json.Serialization;
using Enums;
using Extensions;

public class OrganisationTypeConverter : JsonConverter<OrganisationType>
{
public override OrganisationType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
string value = reader.GetString();

foreach (OrganisationType type in Enum.GetValues(typeof(OrganisationType)))
{
if (type.GetDescription() == value)
{
return type;
}
}

throw new JsonException($"Value '{value}' is not valid for {nameof(OrganisationType)}.");
}

public override void Write(Utf8JsonWriter writer, OrganisationType value, JsonSerializerOptions options)
=> writer.WriteStringValue(value.GetDescription());
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</SonarQubeSetting>
<SonarQubeSetting Include="sonar.cpd.exclusions">
<Value>
**/MockedAcceptedRegistrations.cs,**/MockedPendingRegistrations.cs,**/MockedRejectedRegistrations.cs,**/ServiceProviderExtension.cs,**/MockedAcceptedSubmissions.cs,**/MockedPendingSubmissions.cs,**/MockedRejectedSubmissions.cs,**/OrganisationResponse.cs,**/TransferDetails.cs,**/User.cs,**/UserDataResponse.cs,**/UserDetails.cs,**/UserEnrolment.cs,**/MockedFacadeService.cs,**/JourneySession.cs,**/PermissionManagementSessionItem.cs,**/RejectUserJourneyData.cs,**/MockedAcceptedRegistrations.cs,**/RegistrationFilters.cs
**/MockedAcceptedRegistrations.cs,**/MockedPendingRegistrations.cs,**/MockedRejectedRegistrations.cs,**/ServiceProviderExtension.cs,**/MockedAcceptedSubmissions.cs,**/MockedPendingSubmissions.cs,**/MockedRejectedSubmissions.cs,**/OrganisationResponse.cs,**/TransferDetails.cs,**/User.cs,**/UserDataResponse.cs,**/UserDetails.cs,**/UserEnrolment.cs,**/MockedFacadeService.cs,**/JourneySession.cs,**/PermissionManagementSessionItem.cs,**/RejectUserJourneyData.cs,**/MockedAcceptedRegistrations.cs,**/RegistrationFilters.cs,**/Registration.cs
</Value>
</SonarQubeSetting>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.ComponentModel;

namespace EPR.RegulatorService.Frontend.Core.Enums;

using System.Text.Json.Serialization;
using System.ComponentModel;
using Converters;

[JsonConverter(typeof(OrganisationTypeConverter))]
public enum OrganisationType
{
[Description("Direct Producer")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace EPR.RegulatorService.Frontend.Core.Extensions;

public static class BoolExtensionMethods
{
public static string ToYesNo(this bool inBool) => inBool ? "Yes" : "No";
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using EPR.RegulatorService.Frontend.Core.Models.Registrations;
using EPR.RegulatorService.Frontend.Core.Enums;
using EPR.RegulatorService.Frontend.Core.Models;

namespace EPR.RegulatorService.Frontend.Core.MockedData.Filters;

public static class RegistrationFilters
public static class AbstractSubmissionFilters
{
public static IQueryable<Registration> FilterByOrganisationNameAndOrganisationReference(this IQueryable<Registration> query,
public static IQueryable<AbstractSubmission> FilterByOrganisationNameAndOrganisationReference(this IQueryable<AbstractSubmission> query,
string organisationName, string organisationReference)
{
bool organisationNameSet = !string.IsNullOrWhiteSpace(organisationName);
Expand Down Expand Up @@ -35,7 +35,7 @@ public static IQueryable<Registration> FilterByOrganisationNameAndOrganisationRe
return query;
}

public static IQueryable<Registration> FilterByOrganisationType(this IQueryable<Registration> query,
public static IQueryable<AbstractSubmission> FilterByOrganisationType(this IQueryable<AbstractSubmission> query,
OrganisationType? organisationType)
{
if (organisationType != null)
Expand All @@ -46,10 +46,10 @@ public static IQueryable<Registration> FilterByOrganisationType(this IQueryable<
return query;
}

public static IQueryable<Registration> FilterByRegistrationStatus(this IQueryable<Registration> query,
public static IQueryable<AbstractSubmission> FilterByStatus(this IQueryable<AbstractSubmission> query,
string[] registrationStatuses)
{
if (registrationStatuses.Length != 0)
if (registrationStatuses != null && registrationStatuses.Length != 0)
{
query = query.Where(o => registrationStatuses.Any(o.Decision.Contains));
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using EPR.RegulatorService.Frontend.Core.Models.Submissions;
using System.Diagnostics.CodeAnalysis;
using EPR.RegulatorService.Frontend.Core.Enums;

namespace EPR.RegulatorService.Frontend.Core.MockedData;

[ExcludeFromCodeCoverage]
[SuppressMessage("Major Code Smell", "S2245:Random should not be used for security-sensitive applications", Justification = "Used only for generating test data")]
public static class MockedAcceptedSubmissions
{
public static List<Submission> GetMockedAcceptedSubmissions(int begin, int end)
Expand All @@ -19,7 +22,7 @@ public static List<Submission> GetMockedAcceptedSubmissions(int begin, int end)
{
OrganisationId = Guid.NewGuid(),
OrganisationName = $"Organisation {i} Ltd",
OrganisationType = (i % 2) == 0 ? "Direct producer" : "Compliance scheme",
OrganisationType = (i % 2) == 0 ? OrganisationType.DirectProducer : OrganisationType.ComplianceScheme,
OrganisationReference = i.ToString().PadLeft(6, '0').Insert(3, " "),
Email = "test@abc.com",
UserId = Guid.NewGuid(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using EPR.RegulatorService.Frontend.Core.Models.Submissions;
using System.Diagnostics.CodeAnalysis;
using EPR.RegulatorService.Frontend.Core.Enums;

namespace EPR.RegulatorService.Frontend.Core.MockedData;

[ExcludeFromCodeCoverage]
[SuppressMessage("Major Code Smell", "S2245:Random should not be used for security-sensitive applications", Justification = "Used only for generating test data")]
public static class MockedPendingSubmissions
{
public static List<Submission> GetMockedPendingSubmissions(int begin, int end)
Expand All @@ -19,7 +22,7 @@ public static List<Submission> GetMockedPendingSubmissions(int begin, int end)
{
OrganisationId = Guid.NewGuid(),
OrganisationName = $"Organisation {i} Ltd",
OrganisationType = (i % 2) == 0 ? "Direct producer" : "Compliance scheme",
OrganisationType = (i % 2) == 0 ? OrganisationType.DirectProducer : OrganisationType.ComplianceScheme,
OrganisationReference = i.ToString().PadLeft(6, '0').Insert(3, " "),
Email = "test@abc.com",
UserId = Guid.NewGuid(),
Expand All @@ -29,6 +32,7 @@ public static List<Submission> GetMockedPendingSubmissions(int begin, int end)
ServiceRole = "Approved person",
SubmissionId = Guid.NewGuid(),
SubmittedDate = DateTime.Now.AddDays(-random.Next(2, 180)),
SubmissionPeriod = "July to December 2023",
IsResubmission = isResubmission,
Decision = "Pending",
IsResubmissionRequired = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using System.Diagnostics.CodeAnalysis;
using EPR.RegulatorService.Frontend.Core.Models.Submissions;
using System.Diagnostics.CodeAnalysis;
using EPR.RegulatorService.Frontend.Core.Enums;

namespace EPR.RegulatorService.Frontend.Core.MockedData;

[ExcludeFromCodeCoverage]
[SuppressMessage("Major Code Smell", "S2245:Random should not be used for security-sensitive applications", Justification = "Used only for generating test data")]
public static class MockedRejectedSubmissions
{
public static List<Submission> GetMockedRejectedSubmissions(int begin, int end)
Expand All @@ -19,7 +22,7 @@ public static List<Submission> GetMockedRejectedSubmissions(int begin, int end)
{
OrganisationId = Guid.NewGuid(),
OrganisationName = $"Organisation {i} Ltd",
OrganisationType = (i % 2) == 0 ? "Direct producer" : "Compliance scheme",
OrganisationType = (i % 2) == 0 ? OrganisationType.DirectProducer : OrganisationType.ComplianceScheme,
OrganisationReference = i.ToString().PadLeft(6, '0').Insert(3, " "),
Email = "test@abc.com",
UserId = Guid.NewGuid(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,39 @@ public static List<Registration> GetMockedAcceptedRegistrations(int begin, int e
OrganisationName = $"Organisation {i} Ltd",
OrganisationType = (i % 2) == 0 ? OrganisationType.DirectProducer : OrganisationType.ComplianceScheme,
OrganisationReference = i.ToString().PadLeft(6,'0').Insert(3, " "),
CompaniesHouseNumber = RandomNumberGenerator.GetInt32(1000000000).ToString(),

BuildingName = "Building name",
SubBuildingName = "Sub-building name",
BuildingNumber = "Building number",
Street = "Street",
Locality = "Locality",
DependantLocality = "Dependant locality",
Town = "Town",
County = "County",
Country = "Country",
PostCode = "PostCode",

Email = "test@abc.com",
UserId = Guid.NewGuid(),
FirstName = "Test User",
LastName = "Test User",
FirstName = "Sally",
LastName = "Smith",
Telephone = "0123 456 789",
ServiceRole = "Approved person",

RegistrationId = Guid.NewGuid(),
SubmissionId = Guid.NewGuid(),
SubmissionPeriod = "January 2023 to June 2023",
RegistrationDate = DateTime.Now.AddDays(-RandomNumberGenerator.GetInt32(2,180)),
IsResubmission = isResubmission,
Decision = "Accepted",
RejectionComments = String.Empty
RejectionComments = String.Empty,
PreviousRejectionComments = isResubmission ? "Rejected because reasons" : string.Empty,
OrganisationDetailsFileId = Guid.NewGuid(),
OrganisationDetailsFileName = "OrgDetails.csv",
PartnershipDetailsFileId = Guid.NewGuid(),
PartnershipDetailsFileName = "PartnerDetails.csv",
BrandDetailsFileId = Guid.NewGuid(),
BrandDetailsFileName = "BrandDetails.csv"
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,39 @@ public static List<Registration> GetMockedPendingRegistrations(int begin, int en
OrganisationName = $"Organisation {i} Ltd",
OrganisationType = (i % 2) == 0 ? OrganisationType.DirectProducer : OrganisationType.ComplianceScheme,
OrganisationReference = i.ToString().PadLeft(6,'0').Insert(3, " "),
CompaniesHouseNumber = RandomNumberGenerator.GetInt32(1000000000).ToString(),

BuildingName = "Building name",
SubBuildingName = "Sub-building name",
BuildingNumber = "Building number",
Street = "Street",
Locality = "Locality",
DependantLocality = "Dependant locality",
Town = "Town",
County = "County",
Country = "Country",
PostCode = "PostCode",

Email = "test@abc.com",
UserId = Guid.NewGuid(),
FirstName = "Test User",
LastName = "Test User",
FirstName = "Sally",
LastName = "Smith",
Telephone = "0123 456 789",
ServiceRole = "Approved person",

RegistrationId = Guid.NewGuid(),
SubmissionId = Guid.NewGuid(),
SubmissionPeriod = "January 2023 to June 2023",
RegistrationDate = DateTime.Now.AddDays(-RandomNumberGenerator.GetInt32(2, 180)),
IsResubmission = isResubmission,
Decision = "Pending",
RejectionComments = isResubmission ? "Missing data / wrong submission period" : String.Empty
PreviousRejectionComments = isResubmission ? "Missing data / wrong submission period" : String.Empty,

OrganisationDetailsFileId = Guid.NewGuid(),
OrganisationDetailsFileName = "OrgDetails.csv",
PartnershipDetailsFileId = Guid.NewGuid(),
BrandDetailsFileId = Guid.NewGuid(),
PartnershipDetailsFileName = "PartnerDetails.csv",
BrandDetailsFileName = "BrandDetails.csv"
});
}

Expand Down
Loading

0 comments on commit 3e833d1

Please sign in to comment.