diff --git a/DVSRegister.BusinessLogic/Services/Consent/ConsentService.cs b/DVSRegister.BusinessLogic/Services/Consent/ConsentService.cs index b6915921..6865f0fd 100644 --- a/DVSRegister.BusinessLogic/Services/Consent/ConsentService.cs +++ b/DVSRegister.BusinessLogic/Services/Consent/ConsentService.cs @@ -43,9 +43,13 @@ public async Task RemoveProceedApplicationConsentToken(string token, strin return null ; } } - public async Task UpdateServiceStatus(int serviceId, string providerEmail) + public async Task UpdateServiceStatus(int serviceId, string providerEmail, string companyName, string serviceName) { GenericResponse genericResponse = await consentRepository.UpdateServiceStatus(serviceId, ServiceStatusEnum.Received, providerEmail); + if(genericResponse.Success) + { + await emailSender.SendAgreementToProceedApplicationToDSIT(companyName, serviceName); + } return genericResponse; } diff --git a/DVSRegister.BusinessLogic/Services/Consent/IConsentService.cs b/DVSRegister.BusinessLogic/Services/Consent/IConsentService.cs index c94772ba..614a25c3 100644 --- a/DVSRegister.BusinessLogic/Services/Consent/IConsentService.cs +++ b/DVSRegister.BusinessLogic/Services/Consent/IConsentService.cs @@ -8,7 +8,7 @@ public interface IConsentService //opening loop public Task RemoveConsentToken(string token, string tokenId, string loggedInUserEmail); public Task GetProviderAndCertificateDetailsByToken(string token, string tokenId); - public Task UpdateServiceStatus(int serviceId, string providerEmail); + public Task UpdateServiceStatus(int serviceId, string providerEmail, string companyName, string serviceName); //closing loop diff --git a/DVSRegister.CommonUtility/Email/GovUkNotifyApi.cs b/DVSRegister.CommonUtility/Email/GovUkNotifyApi.cs index 05c9aa42..4cfcfe12 100644 --- a/DVSRegister.CommonUtility/Email/GovUkNotifyApi.cs +++ b/DVSRegister.CommonUtility/Email/GovUkNotifyApi.cs @@ -174,6 +174,27 @@ public async Task SendCertificateInfoSubmittedToDSIT() return await SendEmail(emailModel); } + + #region openong the loop + public async Task SendAgreementToProceedApplicationToDSIT(string companyName, string serviceName) + { + var template = govUkNotifyConfig.AgreementToProceedApplicationToDSIT; + + var personalisation = new Dictionary + { + { template.CompanyName, companyName}, + { template.ServiceName, serviceName} + }; + var emailModel = new GovUkNotifyEmailModel + { + EmailAddress = govUkNotifyConfig.OfDiaEmailId, + TemplateId = template.Id, + Personalisation = personalisation + }; + return await SendEmail(emailModel); + } + #endregion + #region closing the loop public async Task SendAgreementToPublishToDIP(string companyName, string serviceName, string recipientName, string emailAddress) { diff --git a/DVSRegister.CommonUtility/Email/IEmailSender.cs b/DVSRegister.CommonUtility/Email/IEmailSender.cs index 1dfbab40..1c81b92e 100644 --- a/DVSRegister.CommonUtility/Email/IEmailSender.cs +++ b/DVSRegister.CommonUtility/Email/IEmailSender.cs @@ -12,6 +12,9 @@ public interface IEmailSender public Task SendEmailCabInformationSubmitted(string emailAddress, string recipientName); public Task SendCertificateInfoSubmittedToDSIT(); + //opening the loop + public Task SendAgreementToProceedApplicationToDSIT(string companyName, string serviceName); + //closing the loop public Task SendAgreementToPublishToDSIT(string companyName, string serviceName); public Task SendAgreementToPublishToDIP(string companyName, string serviceName, string recipientName, string emailAddress); diff --git a/DVSRegister.CommonUtility/Models/Email/AgreementToProceedApplicationToDSIT.cs b/DVSRegister.CommonUtility/Models/Email/AgreementToProceedApplicationToDSIT.cs new file mode 100644 index 00000000..794f9f86 --- /dev/null +++ b/DVSRegister.CommonUtility/Models/Email/AgreementToProceedApplicationToDSIT.cs @@ -0,0 +1,9 @@ +namespace DVSRegister.CommonUtility.Models +{ + public class AgreementToProceedApplicationToDSIT + { + public string Id { get; set; } + public string CompanyName { get; set; } + public string ServiceName { get; set; } + } +} diff --git a/DVSRegister.CommonUtility/Models/Email/GovUkNotifyConfiguration.cs b/DVSRegister.CommonUtility/Models/Email/GovUkNotifyConfiguration.cs index 73f7c13d..30206e26 100644 --- a/DVSRegister.CommonUtility/Models/Email/GovUkNotifyConfiguration.cs +++ b/DVSRegister.CommonUtility/Models/Email/GovUkNotifyConfiguration.cs @@ -20,5 +20,6 @@ public class GovUkNotifyConfiguration public AgreementToPublishTemplate AgreementToPublishTemplate { get; set; } public AgreementToPublishToDSITTemplate AgreementToPublishToDSITTemplate { get; set; } + public AgreementToProceedApplicationToDSIT AgreementToProceedApplicationToDSIT { get; set; } } } diff --git a/DVSRegister.Data/CAB/CabRepository.cs b/DVSRegister.Data/CAB/CabRepository.cs index 139ac0f5..1ed29cad 100644 --- a/DVSRegister.Data/CAB/CabRepository.cs +++ b/DVSRegister.Data/CAB/CabRepository.cs @@ -76,13 +76,12 @@ public async Task> GetProviders(int cabId, string searchTe .OrderBy(p => p.ModifiedTime != null ? p.ModifiedTime : p.CreatedTime); if (!string.IsNullOrEmpty(searchText)) { - searchText = searchText.Trim().ToLower(); - providerQuery = providerQuery.Where(p => p.SearchVector.Matches(searchText) || - p.Services.Any(s => s.SearchVector.Matches(searchText))); - } + searchText = searchText.Trim().ToLower(); + providerQuery = providerQuery.Where(p => p.Services.Any(s => EF.Functions.TrigramsSimilarity(s.ServiceName.ToLower(), searchText.ToLower()) > .1)); + } var searchResults = await providerQuery.ToListAsync(); return searchResults; - } + } public async Task GetProvider(int providerId,int cabId) { diff --git a/DVSRegister.Data/DVSRegisterDbContext.cs b/DVSRegister.Data/DVSRegisterDbContext.cs index 2721ced3..ebb2c880 100644 --- a/DVSRegister.Data/DVSRegisterDbContext.cs +++ b/DVSRegister.Data/DVSRegisterDbContext.cs @@ -124,15 +124,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity() .ToTable(b => b.HasCheckConstraint("CK_ServiceNumber", "\"ServiceNumber\" BETWEEN 1 AND 99")); - modelBuilder.Entity() - .HasGeneratedTsVectorColumn(p => p.SearchVector, "english", p => new { p.RegisteredName, p.TradingName }) - .HasIndex(p => p.SearchVector) - .HasMethod("GIN"); - - modelBuilder.Entity() - .HasGeneratedTsVectorColumn(p => p.SearchVector, "english", p => new { p.ServiceName }) - .HasIndex(p => p.SearchVector) - .HasMethod("GIN"); modelBuilder.Entity().HasData( new QualityLevel { Id =1, Level = "Low", QualityType = QualityTypeEnum.Authentication }, diff --git a/DVSRegister.Data/Entities/CertificateReview.cs b/DVSRegister.Data/Entities/CertificateReview.cs index 8fc51be1..6212ea91 100644 --- a/DVSRegister.Data/Entities/CertificateReview.cs +++ b/DVSRegister.Data/Entities/CertificateReview.cs @@ -19,21 +19,21 @@ public CertificateReview() { } public int ProviProviderProfileId { get; set; } public ProviderProfile ProviderProfile { get; set; } - public bool IsCabLogoCorrect { get; set; } - public bool IsCabDetailsCorrect { get; set; } - public bool IsProviderDetailsCorrect { get; set; } - public bool IsServiceNameCorrect { get; set; } - public bool IsRolesCertifiedCorrect { get; set; } - public bool IsCertificationScopeCorrect { get; set; } - public bool IsServiceSummaryCorrect { get; set; } - public bool IsURLLinkToServiceCorrect { get; set; } - public bool IsGPG44Correct { get; set; } - public bool IsGPG45Correct { get; set; } - public bool IsServiceProvisionCorrect { get; set; } - public bool IsLocationCorrect { get; set; } - public bool IsDateOfIssueCorrect { get; set; } - public bool IsDateOfExpiryCorrect { get; set; } - public bool IsAuthenticyVerifiedCorrect { get; set; } + public bool? IsCabLogoCorrect { get; set; } + public bool? IsCabDetailsCorrect { get; set; } + public bool? IsProviderDetailsCorrect { get; set; } + public bool? IsServiceNameCorrect { get; set; } + public bool? IsRolesCertifiedCorrect { get; set; } + public bool? IsCertificationScopeCorrect { get; set; } + public bool? IsServiceSummaryCorrect { get; set; } + public bool? IsURLLinkToServiceCorrect { get; set; } + public bool? IsGPG44Correct { get; set; } + public bool? IsGPG45Correct { get; set; } + public bool? IsServiceProvisionCorrect { get; set; } + public bool? IsLocationCorrect { get; set; } + public bool? IsDateOfIssueCorrect { get; set; } + public bool? IsDateOfExpiryCorrect { get; set; } + public bool? IsAuthenticyVerifiedCorrect { get; set; } public string? Comments { get; set; } public bool? InformationMatched { get; set; } public string CommentsForIncorrect { get; set; } diff --git a/DVSRegister.Data/Entities/ProviderProfile.cs b/DVSRegister.Data/Entities/ProviderProfile.cs index 66f1aadf..16c75b38 100644 --- a/DVSRegister.Data/Entities/ProviderProfile.cs +++ b/DVSRegister.Data/Entities/ProviderProfile.cs @@ -34,8 +34,7 @@ public class ProviderProfile public int CabUserId { get; set; } public CabUser CabUser { get; set; } public ProviderStatusEnum ProviderStatus { get; set; } - public ICollection? Services { get; set; } - public NpgsqlTsVector SearchVector { get; set; } + public ICollection? Services { get; set; } public DateTime? CreatedTime { get; set; } public DateTime? ModifiedTime { get; set; } public DateTime? PublishedTime { get; set; } diff --git a/DVSRegister.Data/Entities/PublicInterestCheck.cs b/DVSRegister.Data/Entities/PublicInterestCheck.cs index aea59618..03ad5b91 100644 --- a/DVSRegister.Data/Entities/PublicInterestCheck.cs +++ b/DVSRegister.Data/Entities/PublicInterestCheck.cs @@ -18,16 +18,16 @@ public PublicInterestCheck() { } [ForeignKey("ProviderProfile")] public int ProviderProfileId { get; set; } public ProviderProfile Provider { get; set; } - public bool IsCompanyHouseNumberApproved { get; set; } - public bool IsDirectorshipsApproved { get; set; } - public bool IsDirectorshipsAndRelationApproved { get; set; } - public bool IsTradingAddressApproved { get; set; } - public bool IsSanctionListApproved { get; set; } - public bool IsUNFCApproved { get; set; } - public bool IsECCheckApproved { get; set; } - public bool IsTARICApproved { get; set; } - public bool IsBannedPoliticalApproved { get; set; } - public bool IsProvidersWebpageApproved { get; set; } + public bool? IsCompanyHouseNumberApproved { get; set; } + public bool? IsDirectorshipsApproved { get; set; } + public bool? IsDirectorshipsAndRelationApproved { get; set; } + public bool? IsTradingAddressApproved { get; set; } + public bool? IsSanctionListApproved { get; set; } + public bool? IsUNFCApproved { get; set; } + public bool? IsECCheckApproved { get; set; } + public bool? IsTARICApproved { get; set; } + public bool? IsBannedPoliticalApproved { get; set; } + public bool? IsProvidersWebpageApproved { get; set; } public PublicInterestCheckEnum PublicInterestCheckStatus { get; set; } public RejectionReasonEnum? RejectionReason { get; set; } public string? RejectionReasons { get; set; } diff --git a/DVSRegister.Data/Entities/Service.cs b/DVSRegister.Data/Entities/Service.cs index e2395126..2091cbfc 100644 --- a/DVSRegister.Data/Entities/Service.cs +++ b/DVSRegister.Data/Entities/Service.cs @@ -40,8 +40,7 @@ public Service() { } public CabUser CabUser { get; set; } public int ServiceNumber { get;set; } - public ServiceStatusEnum ServiceStatus { get; set; } - public NpgsqlTsVector SearchVector { get; set; } + public ServiceStatusEnum ServiceStatus { get; set; } public DateTime? CreatedTime { get; set; } public DateTime? ModifiedTime { get; set; } public DateTime? PublishedTime { get; set; } diff --git a/DVSRegister.Data/Migrations/20241121162337_ModifyCertificateReviewTable.Designer.cs b/DVSRegister.Data/Migrations/20241121162337_ModifyCertificateReviewTable.Designer.cs new file mode 100644 index 00000000..563a9755 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241121162337_ModifyCertificateReviewTable.Designer.cs @@ -0,0 +1,1527 @@ +// +using System; +using System.Text.Json; +using DVSRegister.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + [DbContext(typeof(DVSRegisterDbContext))] + [Migration("20241121162337_ModifyCertificateReviewTable")] + partial class ModifyCertificateReviewTable + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DVSRegister.Data.Entities.Cab", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Cab"); + + b.HasData( + new + { + Id = 1, + CabName = "EY", + CreatedTime = new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3429) + }, + new + { + Id = 2, + CabName = "DSIT", + CreatedTime = new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3432) + }, + new + { + Id = 3, + CabName = "ACCS", + CreatedTime = new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3433) + }, + new + { + Id = 4, + CabName = "Kantara", + CreatedTime = new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3434) + }, + new + { + Id = 6, + CabName = "NQA", + CreatedTime = new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3435) + }, + new + { + Id = 7, + CabName = "BSI", + CreatedTime = new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3436) + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("CabId") + .HasColumnType("integer"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("CabId"); + + b.ToTable("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewStatus") + .HasColumnType("integer"); + + b.Property("Comments") + .HasColumnType("text"); + + b.Property("CommentsForIncorrect") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("InformationMatched") + .HasColumnType("boolean"); + + b.Property("IsAuthenticyVerifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabLogoCorrect") + .HasColumnType("boolean"); + + b.Property("IsCertificationScopeCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfExpiryCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfIssueCorrect") + .HasColumnType("boolean"); + + b.Property("IsGPG44Correct") + .HasColumnType("boolean"); + + b.Property("IsGPG45Correct") + .HasColumnType("boolean"); + + b.Property("IsLocationCorrect") + .HasColumnType("boolean"); + + b.Property("IsProviderDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsRolesCertifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceNameCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceProvisionCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceSummaryCorrect") + .HasColumnType("boolean"); + + b.Property("IsURLLinkToServiceCorrect") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviProviderProfileId") + .HasColumnType("integer"); + + b.Property("RejectionComments") + .HasColumnType("text"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("VerifiedUser") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProviProviderProfileId"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("CertificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CertificateReviewRejectionReason"); + + b.HasData( + new + { + Id = 1, + Reason = "Information is missing from the certificate" + }, + new + { + Id = 2, + Reason = "The certificate contains invalid information" + }, + new + { + Id = 3, + Reason = "The information submitted does not match the information on the certificate" + }, + new + { + Id = 4, + Reason = "The certificate or information submitted contains errors" + }, + new + { + Id = 5, + Reason = "Other" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewRejectionReasonId") + .HasColumnType("integer"); + + b.Property("CetificateReviewId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CertificateReviewRejectionReasonId"); + + b.HasIndex("CetificateReviewId"); + + b.ToTable("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("Action") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("AffectedColumns") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("DateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("EventType") + .IsRequired() + .HasColumnType("text"); + + b.Property("NewValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("OldValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("PrimaryKey") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("TableName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Team") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EventLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.IdentityProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("IdentityProfile"); + + b.HasData( + new + { + Id = 1, + IdentityProfileName = "L1A " + }, + new + { + Id = 2, + IdentityProfileName = "L1B " + }, + new + { + Id = 3, + IdentityProfileName = "L1C " + }, + new + { + Id = 4, + IdentityProfileName = "L2A " + }, + new + { + Id = 5, + IdentityProfileName = "L2B " + }, + new + { + Id = 6, + IdentityProfileName = "L3A " + }, + new + { + Id = 7, + IdentityProfileName = "M1A " + }, + new + { + Id = 8, + IdentityProfileName = "M1B " + }, + new + { + Id = 9, + IdentityProfileName = "M1C " + }, + new + { + Id = 10, + IdentityProfileName = "M1D " + }, + new + { + Id = 11, + IdentityProfileName = "M2A " + }, + new + { + Id = 12, + IdentityProfileName = "M2B " + }, + new + { + Id = 13, + IdentityProfileName = "M2C " + }, + new + { + Id = 14, + IdentityProfileName = "M3A " + }, + new + { + Id = 15, + IdentityProfileName = "H1A " + }, + new + { + Id = 16, + IdentityProfileName = "H1B " + }, + new + { + Id = 17, + IdentityProfileName = "H1C " + }, + new + { + Id = 18, + IdentityProfileName = "H2A " + }, + new + { + Id = 19, + IdentityProfileName = "H2B " + }, + new + { + Id = 20, + IdentityProfileName = "H2C " + }, + new + { + Id = 21, + IdentityProfileName = "H2D " + }, + new + { + Id = 22, + IdentityProfileName = "H2E " + }, + new + { + Id = 23, + IdentityProfileName = "H3A " + }, + new + { + Id = 24, + IdentityProfileName = "V1A " + }, + new + { + Id = 25, + IdentityProfileName = "V1B " + }, + new + { + Id = 26, + IdentityProfileName = "V1C " + }, + new + { + Id = 27, + IdentityProfileName = "V1D " + }, + new + { + Id = 28, + IdentityProfileName = "V2A " + }, + new + { + Id = 29, + IdentityProfileName = "V2B " + }, + new + { + Id = 30, + IdentityProfileName = "V2C " + }, + new + { + Id = 31, + IdentityProfileName = "V2D " + }, + new + { + Id = 32, + IdentityProfileName = "V3A " + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text"); + + b.Property("LogTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PublicInterestCheckId") + .HasColumnType("integer"); + + b.Property("ReviewType") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PublicInterestCheckId"); + + b.HasIndex("UserId"); + + b.ToTable("PICheckLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("ProceedApplicationConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("Token"); + + b.HasIndex("TokenId"); + + b.ToTable("ProceedPublishConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEditedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyRegistrationNumber") + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("DUNSNumber") + .HasColumnType("text"); + + b.Property("HasParentCompany") + .HasColumnType("boolean"); + + b.Property("HasRegistrationNumber") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ParentCompanyLocation") + .HasColumnType("text"); + + b.Property("ParentCompanyRegisteredName") + .HasColumnType("text"); + + b.Property("PrimaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderStatus") + .HasColumnType("integer"); + + b.Property("ProviderTelephoneNumber") + .HasColumnType("text"); + + b.Property("ProviderWebsiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublicContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("RegisteredName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "RegisteredName", "TradingName" }); + + b.Property("SecondaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("TradingName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("SearchVector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.ToTable("ProviderProfile"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IsBannedPoliticalApproved") + .HasColumnType("boolean"); + + b.Property("IsCompanyHouseNumberApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsAndRelationApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsApproved") + .HasColumnType("boolean"); + + b.Property("IsECCheckApproved") + .HasColumnType("boolean"); + + b.Property("IsProvidersWebpageApproved") + .HasColumnType("boolean"); + + b.Property("IsSanctionListApproved") + .HasColumnType("boolean"); + + b.Property("IsTARICApproved") + .HasColumnType("boolean"); + + b.Property("IsTradingAddressApproved") + .HasColumnType("boolean"); + + b.Property("IsUNFCApproved") + .HasColumnType("boolean"); + + b.Property("PrimaryCheckComment") + .HasColumnType("text"); + + b.Property("PrimaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PrimaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublicInterestCheckStatus") + .HasColumnType("integer"); + + b.Property("RejectionReason") + .HasColumnType("integer"); + + b.Property("RejectionReasons") + .HasColumnType("text"); + + b.Property("SecondaryCheckComment") + .HasColumnType("text"); + + b.Property("SecondaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SecondaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PrimaryCheckUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SecondaryCheckUserId"); + + b.HasIndex("ServiceId"); + + b.ToTable("PublicInterestCheck"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.QualityLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Level") + .IsRequired() + .HasColumnType("text"); + + b.Property("QualityType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("QualityLevel"); + + b.HasData( + new + { + Id = 1, + Level = "Low", + QualityType = 1 + }, + new + { + Id = 2, + Level = "Medium", + QualityType = 1 + }, + new + { + Id = 3, + Level = "High", + QualityType = 1 + }, + new + { + Id = 4, + Level = "Low", + QualityType = 2 + }, + new + { + Id = 5, + Level = "Medium", + QualityType = 2 + }, + new + { + Id = 6, + Level = "High", + QualityType = 2 + }, + new + { + Id = 7, + Level = "Very High", + QualityType = 2 + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("Services") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ProviderProfileId"); + + b.ToTable("RegisterPublishLog"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + Order = 1, + RoleName = "Identity Service Provider (IDSP)" + }, + new + { + Id = 2, + Order = 2, + RoleName = "Attribute Service Provider (ASP)" + }, + new + { + Id = 3, + Order = 3, + RoleName = "Orchestration Service Provider (OSP)" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConformityExpiryDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConformityIssueDate") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("FileLink") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileSizeInKb") + .HasColumnType("decimal(10, 1)"); + + b.Property("HasGPG44") + .HasColumnType("boolean"); + + b.Property("HasGPG45") + .HasColumnType("boolean"); + + b.Property("HasSupplementarySchemes") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "ServiceName" }); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ServiceStatus") + .HasColumnType("integer"); + + b.Property("WebSiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SearchVector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.ToTable("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IdentityProfileId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceIdentityProfileMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("QualityLevelId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("QualityLevelId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceQualityLevelMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceRoleMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("SupplementarySchemeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("SupplementarySchemeId"); + + b.ToTable("ServiceSupSchemeMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.SupplementaryScheme", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("SchemeName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("SupplementaryScheme"); + + b.HasData( + new + { + Id = 1, + Order = 2, + SchemeName = "Right to Work" + }, + new + { + Id = 2, + Order = 1, + SchemeName = "Right to Rent" + }, + new + { + Id = 3, + Order = 3, + SchemeName = "Disclosure and Barring Service" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.Property("CompanyId") + .HasColumnType("integer"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("TimeStamp") + .HasColumnType("timestamp without time zone"); + + b.Property("TrustMarkNumber") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("text") + .HasComputedColumnSql("LPAD(\"CompanyId\"::VARCHAR(4), 4, '0') || LPAD(\"ServiceNumber\"::VARCHAR(2), 2, '0')", true); + + b.HasKey("CompanyId", "ServiceNumber"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TrustMarkNumber") + .IsUnique(); + + b.HasIndex("ProviderProfileId", "ServiceId") + .IsUnique(); + + b.ToTable("TrustmarkNumber", t => + { + t.HasCheckConstraint("CK_CompanyId", "\"CompanyId\" BETWEEN 200 AND 9999"); + + t.HasCheckConstraint("CK_ServiceNumber", "\"ServiceNumber\" BETWEEN 1 AND 99"); + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.HasOne("DVSRegister.Data.Entities.Cab", "Cab") + .WithMany() + .HasForeignKey("CabId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cab"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "ProviderProfile") + .WithMany() + .HasForeignKey("ProviProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("CertificateReview") + .HasForeignKey("DVSRegister.Data.Entities.CertificateReview", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.CertificateReviewRejectionReason", "CertificateReviewRejectionReason") + .WithMany() + .HasForeignKey("CertificateReviewRejectionReasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.CertificateReview", "CetificateReview") + .WithMany("CertificateReviewRejectionReasonMapping") + .HasForeignKey("CetificateReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CertificateReviewRejectionReason"); + + b.Navigation("CetificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.HasOne("DVSRegister.Data.Entities.PublicInterestCheck", "PublicInterestCheck") + .WithMany() + .HasForeignKey("PublicInterestCheckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicInterestCheck"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("ProceedApplicationConsentToken") + .HasForeignKey("DVSRegister.Data.Entities.ProceedApplicationConsentToken", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.HasOne("DVSRegister.Data.Entities.User", "PrimaryCheckUser") + .WithMany() + .HasForeignKey("PrimaryCheckUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "SecondaryCheckUser") + .WithMany() + .HasForeignKey("SecondaryCheckUserId"); + + b.HasOne("DVSRegister.Data.Entities.Service", "PreRegistration") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PreRegistration"); + + b.Navigation("PrimaryCheckUser"); + + b.Navigation("Provider"); + + b.Navigation("SecondaryCheckUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany("Services") + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.IdentityProfile", "IdentityProfile") + .WithMany() + .HasForeignKey("IdentityProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceIdentityProfileMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IdentityProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.QualityLevel", "QualityLevel") + .WithMany() + .HasForeignKey("QualityLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceQualityLevelMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QualityLevel"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceRoleMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceSupSchemeMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.SupplementaryScheme", "SupplementaryScheme") + .WithMany() + .HasForeignKey("SupplementarySchemeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + + b.Navigation("SupplementaryScheme"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Navigation("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Navigation("Services"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Navigation("CertificateReview") + .IsRequired(); + + b.Navigation("ProceedApplicationConsentToken") + .IsRequired(); + + b.Navigation("ServiceIdentityProfileMapping"); + + b.Navigation("ServiceQualityLevelMapping"); + + b.Navigation("ServiceRoleMapping"); + + b.Navigation("ServiceSupSchemeMapping"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DVSRegister.Data/Migrations/20241121162337_ModifyCertificateReviewTable.cs b/DVSRegister.Data/Migrations/20241121162337_ModifyCertificateReviewTable.cs new file mode 100644 index 00000000..61d37eb3 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241121162337_ModifyCertificateReviewTable.cs @@ -0,0 +1,392 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + /// + public partial class ModifyCertificateReviewTable : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_ProceedApplicationConsentToken_ServiceId", + table: "ProceedApplicationConsentToken"); + + migrationBuilder.AlterColumn( + name: "IsURLLinkToServiceCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsServiceSummaryCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsServiceProvisionCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsServiceNameCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsRolesCertifiedCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsProviderDetailsCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsLocationCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsGPG45Correct", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsGPG44Correct", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsDateOfIssueCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsDateOfExpiryCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsCertificationScopeCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsCabLogoCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsCabDetailsCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsAuthenticyVerifiedCorrect", + table: "CertificateReview", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 1, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3429)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 2, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3432)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 3, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3433)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 4, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3434)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 6, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3435)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 7, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3436)); + + migrationBuilder.CreateIndex( + name: "IX_ProceedApplicationConsentToken_ServiceId", + table: "ProceedApplicationConsentToken", + column: "ServiceId", + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_ProceedApplicationConsentToken_ServiceId", + table: "ProceedApplicationConsentToken"); + + migrationBuilder.AlterColumn( + name: "IsURLLinkToServiceCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsServiceSummaryCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsServiceProvisionCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsServiceNameCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsRolesCertifiedCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsProviderDetailsCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsLocationCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsGPG45Correct", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsGPG44Correct", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsDateOfIssueCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsDateOfExpiryCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsCertificationScopeCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsCabLogoCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsCabDetailsCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsAuthenticyVerifiedCorrect", + table: "CertificateReview", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 1, + column: "CreatedTime", + value: new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9262)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 2, + column: "CreatedTime", + value: new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9266)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 3, + column: "CreatedTime", + value: new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9267)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 4, + column: "CreatedTime", + value: new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9268)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 6, + column: "CreatedTime", + value: new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9269)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 7, + column: "CreatedTime", + value: new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9270)); + + migrationBuilder.CreateIndex( + name: "IX_ProceedApplicationConsentToken_ServiceId", + table: "ProceedApplicationConsentToken", + column: "ServiceId"); + } + } +} diff --git a/DVSRegister.Data/Migrations/20241122155539_ModifyPublicInterestCheck.Designer.cs b/DVSRegister.Data/Migrations/20241122155539_ModifyPublicInterestCheck.Designer.cs new file mode 100644 index 00000000..22251e78 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241122155539_ModifyPublicInterestCheck.Designer.cs @@ -0,0 +1,1527 @@ +// +using System; +using System.Text.Json; +using DVSRegister.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + [DbContext(typeof(DVSRegisterDbContext))] + [Migration("20241122155539_ModifyPublicInterestCheck")] + partial class ModifyPublicInterestCheck + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DVSRegister.Data.Entities.Cab", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Cab"); + + b.HasData( + new + { + Id = 1, + CabName = "EY", + CreatedTime = new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2100) + }, + new + { + Id = 2, + CabName = "DSIT", + CreatedTime = new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110) + }, + new + { + Id = 3, + CabName = "ACCS", + CreatedTime = new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110) + }, + new + { + Id = 4, + CabName = "Kantara", + CreatedTime = new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110) + }, + new + { + Id = 6, + CabName = "NQA", + CreatedTime = new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110) + }, + new + { + Id = 7, + CabName = "BSI", + CreatedTime = new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110) + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("CabId") + .HasColumnType("integer"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("CabId"); + + b.ToTable("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewStatus") + .HasColumnType("integer"); + + b.Property("Comments") + .HasColumnType("text"); + + b.Property("CommentsForIncorrect") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("InformationMatched") + .HasColumnType("boolean"); + + b.Property("IsAuthenticyVerifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabLogoCorrect") + .HasColumnType("boolean"); + + b.Property("IsCertificationScopeCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfExpiryCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfIssueCorrect") + .HasColumnType("boolean"); + + b.Property("IsGPG44Correct") + .HasColumnType("boolean"); + + b.Property("IsGPG45Correct") + .HasColumnType("boolean"); + + b.Property("IsLocationCorrect") + .HasColumnType("boolean"); + + b.Property("IsProviderDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsRolesCertifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceNameCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceProvisionCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceSummaryCorrect") + .HasColumnType("boolean"); + + b.Property("IsURLLinkToServiceCorrect") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviProviderProfileId") + .HasColumnType("integer"); + + b.Property("RejectionComments") + .HasColumnType("text"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("VerifiedUser") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProviProviderProfileId"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("CertificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CertificateReviewRejectionReason"); + + b.HasData( + new + { + Id = 1, + Reason = "Information is missing from the certificate" + }, + new + { + Id = 2, + Reason = "The certificate contains invalid information" + }, + new + { + Id = 3, + Reason = "The information submitted does not match the information on the certificate" + }, + new + { + Id = 4, + Reason = "The certificate or information submitted contains errors" + }, + new + { + Id = 5, + Reason = "Other" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewRejectionReasonId") + .HasColumnType("integer"); + + b.Property("CetificateReviewId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CertificateReviewRejectionReasonId"); + + b.HasIndex("CetificateReviewId"); + + b.ToTable("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("Action") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("AffectedColumns") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("DateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("EventType") + .IsRequired() + .HasColumnType("text"); + + b.Property("NewValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("OldValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("PrimaryKey") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("TableName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Team") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EventLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.IdentityProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("IdentityProfile"); + + b.HasData( + new + { + Id = 1, + IdentityProfileName = "L1A " + }, + new + { + Id = 2, + IdentityProfileName = "L1B " + }, + new + { + Id = 3, + IdentityProfileName = "L1C " + }, + new + { + Id = 4, + IdentityProfileName = "L2A " + }, + new + { + Id = 5, + IdentityProfileName = "L2B " + }, + new + { + Id = 6, + IdentityProfileName = "L3A " + }, + new + { + Id = 7, + IdentityProfileName = "M1A " + }, + new + { + Id = 8, + IdentityProfileName = "M1B " + }, + new + { + Id = 9, + IdentityProfileName = "M1C " + }, + new + { + Id = 10, + IdentityProfileName = "M1D " + }, + new + { + Id = 11, + IdentityProfileName = "M2A " + }, + new + { + Id = 12, + IdentityProfileName = "M2B " + }, + new + { + Id = 13, + IdentityProfileName = "M2C " + }, + new + { + Id = 14, + IdentityProfileName = "M3A " + }, + new + { + Id = 15, + IdentityProfileName = "H1A " + }, + new + { + Id = 16, + IdentityProfileName = "H1B " + }, + new + { + Id = 17, + IdentityProfileName = "H1C " + }, + new + { + Id = 18, + IdentityProfileName = "H2A " + }, + new + { + Id = 19, + IdentityProfileName = "H2B " + }, + new + { + Id = 20, + IdentityProfileName = "H2C " + }, + new + { + Id = 21, + IdentityProfileName = "H2D " + }, + new + { + Id = 22, + IdentityProfileName = "H2E " + }, + new + { + Id = 23, + IdentityProfileName = "H3A " + }, + new + { + Id = 24, + IdentityProfileName = "V1A " + }, + new + { + Id = 25, + IdentityProfileName = "V1B " + }, + new + { + Id = 26, + IdentityProfileName = "V1C " + }, + new + { + Id = 27, + IdentityProfileName = "V1D " + }, + new + { + Id = 28, + IdentityProfileName = "V2A " + }, + new + { + Id = 29, + IdentityProfileName = "V2B " + }, + new + { + Id = 30, + IdentityProfileName = "V2C " + }, + new + { + Id = 31, + IdentityProfileName = "V2D " + }, + new + { + Id = 32, + IdentityProfileName = "V3A " + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text"); + + b.Property("LogTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PublicInterestCheckId") + .HasColumnType("integer"); + + b.Property("ReviewType") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PublicInterestCheckId"); + + b.HasIndex("UserId"); + + b.ToTable("PICheckLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("ProceedApplicationConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("Token"); + + b.HasIndex("TokenId"); + + b.ToTable("ProceedPublishConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEditedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyRegistrationNumber") + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("DUNSNumber") + .HasColumnType("text"); + + b.Property("HasParentCompany") + .HasColumnType("boolean"); + + b.Property("HasRegistrationNumber") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ParentCompanyLocation") + .HasColumnType("text"); + + b.Property("ParentCompanyRegisteredName") + .HasColumnType("text"); + + b.Property("PrimaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderStatus") + .HasColumnType("integer"); + + b.Property("ProviderTelephoneNumber") + .HasColumnType("text"); + + b.Property("ProviderWebsiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublicContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("RegisteredName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "RegisteredName", "TradingName" }); + + b.Property("SecondaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("TradingName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("SearchVector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.ToTable("ProviderProfile"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IsBannedPoliticalApproved") + .HasColumnType("boolean"); + + b.Property("IsCompanyHouseNumberApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsAndRelationApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsApproved") + .HasColumnType("boolean"); + + b.Property("IsECCheckApproved") + .HasColumnType("boolean"); + + b.Property("IsProvidersWebpageApproved") + .HasColumnType("boolean"); + + b.Property("IsSanctionListApproved") + .HasColumnType("boolean"); + + b.Property("IsTARICApproved") + .HasColumnType("boolean"); + + b.Property("IsTradingAddressApproved") + .HasColumnType("boolean"); + + b.Property("IsUNFCApproved") + .HasColumnType("boolean"); + + b.Property("PrimaryCheckComment") + .HasColumnType("text"); + + b.Property("PrimaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PrimaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublicInterestCheckStatus") + .HasColumnType("integer"); + + b.Property("RejectionReason") + .HasColumnType("integer"); + + b.Property("RejectionReasons") + .HasColumnType("text"); + + b.Property("SecondaryCheckComment") + .HasColumnType("text"); + + b.Property("SecondaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SecondaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PrimaryCheckUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SecondaryCheckUserId"); + + b.HasIndex("ServiceId"); + + b.ToTable("PublicInterestCheck"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.QualityLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Level") + .IsRequired() + .HasColumnType("text"); + + b.Property("QualityType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("QualityLevel"); + + b.HasData( + new + { + Id = 1, + Level = "Low", + QualityType = 1 + }, + new + { + Id = 2, + Level = "Medium", + QualityType = 1 + }, + new + { + Id = 3, + Level = "High", + QualityType = 1 + }, + new + { + Id = 4, + Level = "Low", + QualityType = 2 + }, + new + { + Id = 5, + Level = "Medium", + QualityType = 2 + }, + new + { + Id = 6, + Level = "High", + QualityType = 2 + }, + new + { + Id = 7, + Level = "Very High", + QualityType = 2 + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("Services") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ProviderProfileId"); + + b.ToTable("RegisterPublishLog"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + Order = 1, + RoleName = "Identity Service Provider (IDSP)" + }, + new + { + Id = 2, + Order = 2, + RoleName = "Attribute Service Provider (ASP)" + }, + new + { + Id = 3, + Order = 3, + RoleName = "Orchestration Service Provider (OSP)" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConformityExpiryDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConformityIssueDate") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("FileLink") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileSizeInKb") + .HasColumnType("decimal(10, 1)"); + + b.Property("HasGPG44") + .HasColumnType("boolean"); + + b.Property("HasGPG45") + .HasColumnType("boolean"); + + b.Property("HasSupplementarySchemes") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "ServiceName" }); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ServiceStatus") + .HasColumnType("integer"); + + b.Property("WebSiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SearchVector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.ToTable("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IdentityProfileId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceIdentityProfileMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("QualityLevelId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("QualityLevelId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceQualityLevelMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceRoleMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("SupplementarySchemeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("SupplementarySchemeId"); + + b.ToTable("ServiceSupSchemeMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.SupplementaryScheme", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("SchemeName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("SupplementaryScheme"); + + b.HasData( + new + { + Id = 1, + Order = 2, + SchemeName = "Right to Work" + }, + new + { + Id = 2, + Order = 1, + SchemeName = "Right to Rent" + }, + new + { + Id = 3, + Order = 3, + SchemeName = "Disclosure and Barring Service" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.Property("CompanyId") + .HasColumnType("integer"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("TimeStamp") + .HasColumnType("timestamp without time zone"); + + b.Property("TrustMarkNumber") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("text") + .HasComputedColumnSql("LPAD(\"CompanyId\"::VARCHAR(4), 4, '0') || LPAD(\"ServiceNumber\"::VARCHAR(2), 2, '0')", true); + + b.HasKey("CompanyId", "ServiceNumber"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TrustMarkNumber") + .IsUnique(); + + b.HasIndex("ProviderProfileId", "ServiceId") + .IsUnique(); + + b.ToTable("TrustmarkNumber", t => + { + t.HasCheckConstraint("CK_CompanyId", "\"CompanyId\" BETWEEN 200 AND 9999"); + + t.HasCheckConstraint("CK_ServiceNumber", "\"ServiceNumber\" BETWEEN 1 AND 99"); + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.HasOne("DVSRegister.Data.Entities.Cab", "Cab") + .WithMany() + .HasForeignKey("CabId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cab"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "ProviderProfile") + .WithMany() + .HasForeignKey("ProviProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("CertificateReview") + .HasForeignKey("DVSRegister.Data.Entities.CertificateReview", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.CertificateReviewRejectionReason", "CertificateReviewRejectionReason") + .WithMany() + .HasForeignKey("CertificateReviewRejectionReasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.CertificateReview", "CetificateReview") + .WithMany("CertificateReviewRejectionReasonMapping") + .HasForeignKey("CetificateReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CertificateReviewRejectionReason"); + + b.Navigation("CetificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.HasOne("DVSRegister.Data.Entities.PublicInterestCheck", "PublicInterestCheck") + .WithMany() + .HasForeignKey("PublicInterestCheckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicInterestCheck"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("ProceedApplicationConsentToken") + .HasForeignKey("DVSRegister.Data.Entities.ProceedApplicationConsentToken", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.HasOne("DVSRegister.Data.Entities.User", "PrimaryCheckUser") + .WithMany() + .HasForeignKey("PrimaryCheckUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "SecondaryCheckUser") + .WithMany() + .HasForeignKey("SecondaryCheckUserId"); + + b.HasOne("DVSRegister.Data.Entities.Service", "PreRegistration") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PreRegistration"); + + b.Navigation("PrimaryCheckUser"); + + b.Navigation("Provider"); + + b.Navigation("SecondaryCheckUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany("Services") + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.IdentityProfile", "IdentityProfile") + .WithMany() + .HasForeignKey("IdentityProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceIdentityProfileMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IdentityProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.QualityLevel", "QualityLevel") + .WithMany() + .HasForeignKey("QualityLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceQualityLevelMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QualityLevel"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceRoleMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceSupSchemeMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.SupplementaryScheme", "SupplementaryScheme") + .WithMany() + .HasForeignKey("SupplementarySchemeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + + b.Navigation("SupplementaryScheme"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Navigation("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Navigation("Services"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Navigation("CertificateReview") + .IsRequired(); + + b.Navigation("ProceedApplicationConsentToken") + .IsRequired(); + + b.Navigation("ServiceIdentityProfileMapping"); + + b.Navigation("ServiceQualityLevelMapping"); + + b.Navigation("ServiceRoleMapping"); + + b.Navigation("ServiceSupSchemeMapping"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DVSRegister.Data/Migrations/20241122155539_ModifyPublicInterestCheck.cs b/DVSRegister.Data/Migrations/20241122155539_ModifyPublicInterestCheck.cs new file mode 100644 index 00000000..64d78c02 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241122155539_ModifyPublicInterestCheck.cs @@ -0,0 +1,283 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + /// + public partial class ModifyPublicInterestCheck : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "IsUNFCApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsTradingAddressApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsTARICApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsSanctionListApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsProvidersWebpageApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsECCheckApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsDirectorshipsApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsDirectorshipsAndRelationApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsCompanyHouseNumberApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.AlterColumn( + name: "IsBannedPoliticalApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: true, + oldClrType: typeof(bool), + oldType: "boolean"); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 1, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2100)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 2, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 3, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 4, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 6, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 7, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "IsUNFCApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsTradingAddressApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsTARICApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsSanctionListApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsProvidersWebpageApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsECCheckApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsDirectorshipsApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsDirectorshipsAndRelationApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsCompanyHouseNumberApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "IsBannedPoliticalApproved", + table: "PublicInterestCheck", + type: "boolean", + nullable: false, + defaultValue: false, + oldClrType: typeof(bool), + oldType: "boolean", + oldNullable: true); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 1, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3429)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 2, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3432)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 3, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3433)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 4, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3434)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 6, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3435)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 7, + column: "CreatedTime", + value: new DateTime(2024, 11, 21, 16, 23, 37, 185, DateTimeKind.Utc).AddTicks(3436)); + } + } +} diff --git a/DVSRegister.Data/Migrations/20241216105741_AddPgTrgmExtension.Designer.cs b/DVSRegister.Data/Migrations/20241216105741_AddPgTrgmExtension.Designer.cs new file mode 100644 index 00000000..5ca7aab4 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241216105741_AddPgTrgmExtension.Designer.cs @@ -0,0 +1,1527 @@ +// +using System; +using System.Text.Json; +using DVSRegister.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using NpgsqlTypes; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + [DbContext(typeof(DVSRegisterDbContext))] + [Migration("20241216105741_AddPgTrgmExtension")] + partial class AddPgTrgmExtension + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DVSRegister.Data.Entities.Cab", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Cab"); + + b.HasData( + new + { + Id = 1, + CabName = "EY", + CreatedTime = new DateTime(2024, 12, 16, 10, 57, 40, 477, DateTimeKind.Utc).AddTicks(2864) + }, + new + { + Id = 2, + CabName = "DSIT", + CreatedTime = new DateTime(2024, 12, 16, 10, 57, 40, 477, DateTimeKind.Utc).AddTicks(2870) + }, + new + { + Id = 3, + CabName = "ACCS", + CreatedTime = new DateTime(2024, 12, 16, 10, 57, 40, 477, DateTimeKind.Utc).AddTicks(2872) + }, + new + { + Id = 4, + CabName = "Kantara", + CreatedTime = new DateTime(2024, 12, 16, 10, 57, 40, 477, DateTimeKind.Utc).AddTicks(2874) + }, + new + { + Id = 6, + CabName = "NQA", + CreatedTime = new DateTime(2024, 12, 16, 10, 57, 40, 477, DateTimeKind.Utc).AddTicks(2876) + }, + new + { + Id = 7, + CabName = "BSI", + CreatedTime = new DateTime(2024, 12, 16, 10, 57, 40, 477, DateTimeKind.Utc).AddTicks(2878) + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("CabId") + .HasColumnType("integer"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("CabId"); + + b.ToTable("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewStatus") + .HasColumnType("integer"); + + b.Property("Comments") + .HasColumnType("text"); + + b.Property("CommentsForIncorrect") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("InformationMatched") + .HasColumnType("boolean"); + + b.Property("IsAuthenticyVerifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabLogoCorrect") + .HasColumnType("boolean"); + + b.Property("IsCertificationScopeCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfExpiryCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfIssueCorrect") + .HasColumnType("boolean"); + + b.Property("IsGPG44Correct") + .HasColumnType("boolean"); + + b.Property("IsGPG45Correct") + .HasColumnType("boolean"); + + b.Property("IsLocationCorrect") + .HasColumnType("boolean"); + + b.Property("IsProviderDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsRolesCertifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceNameCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceProvisionCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceSummaryCorrect") + .HasColumnType("boolean"); + + b.Property("IsURLLinkToServiceCorrect") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviProviderProfileId") + .HasColumnType("integer"); + + b.Property("RejectionComments") + .HasColumnType("text"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("VerifiedUser") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProviProviderProfileId"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("CertificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CertificateReviewRejectionReason"); + + b.HasData( + new + { + Id = 1, + Reason = "Information is missing from the certificate" + }, + new + { + Id = 2, + Reason = "The certificate contains invalid information" + }, + new + { + Id = 3, + Reason = "The information submitted does not match the information on the certificate" + }, + new + { + Id = 4, + Reason = "The certificate or information submitted contains errors" + }, + new + { + Id = 5, + Reason = "Other" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewRejectionReasonId") + .HasColumnType("integer"); + + b.Property("CetificateReviewId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CertificateReviewRejectionReasonId"); + + b.HasIndex("CetificateReviewId"); + + b.ToTable("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("Action") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("AffectedColumns") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("DateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("EventType") + .IsRequired() + .HasColumnType("text"); + + b.Property("NewValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("OldValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("PrimaryKey") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("TableName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Team") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EventLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.IdentityProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("IdentityProfile"); + + b.HasData( + new + { + Id = 1, + IdentityProfileName = "L1A " + }, + new + { + Id = 2, + IdentityProfileName = "L1B " + }, + new + { + Id = 3, + IdentityProfileName = "L1C " + }, + new + { + Id = 4, + IdentityProfileName = "L2A " + }, + new + { + Id = 5, + IdentityProfileName = "L2B " + }, + new + { + Id = 6, + IdentityProfileName = "L3A " + }, + new + { + Id = 7, + IdentityProfileName = "M1A " + }, + new + { + Id = 8, + IdentityProfileName = "M1B " + }, + new + { + Id = 9, + IdentityProfileName = "M1C " + }, + new + { + Id = 10, + IdentityProfileName = "M1D " + }, + new + { + Id = 11, + IdentityProfileName = "M2A " + }, + new + { + Id = 12, + IdentityProfileName = "M2B " + }, + new + { + Id = 13, + IdentityProfileName = "M2C " + }, + new + { + Id = 14, + IdentityProfileName = "M3A " + }, + new + { + Id = 15, + IdentityProfileName = "H1A " + }, + new + { + Id = 16, + IdentityProfileName = "H1B " + }, + new + { + Id = 17, + IdentityProfileName = "H1C " + }, + new + { + Id = 18, + IdentityProfileName = "H2A " + }, + new + { + Id = 19, + IdentityProfileName = "H2B " + }, + new + { + Id = 20, + IdentityProfileName = "H2C " + }, + new + { + Id = 21, + IdentityProfileName = "H2D " + }, + new + { + Id = 22, + IdentityProfileName = "H2E " + }, + new + { + Id = 23, + IdentityProfileName = "H3A " + }, + new + { + Id = 24, + IdentityProfileName = "V1A " + }, + new + { + Id = 25, + IdentityProfileName = "V1B " + }, + new + { + Id = 26, + IdentityProfileName = "V1C " + }, + new + { + Id = 27, + IdentityProfileName = "V1D " + }, + new + { + Id = 28, + IdentityProfileName = "V2A " + }, + new + { + Id = 29, + IdentityProfileName = "V2B " + }, + new + { + Id = 30, + IdentityProfileName = "V2C " + }, + new + { + Id = 31, + IdentityProfileName = "V2D " + }, + new + { + Id = 32, + IdentityProfileName = "V3A " + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text"); + + b.Property("LogTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PublicInterestCheckId") + .HasColumnType("integer"); + + b.Property("ReviewType") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PublicInterestCheckId"); + + b.HasIndex("UserId"); + + b.ToTable("PICheckLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("ProceedApplicationConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("Token"); + + b.HasIndex("TokenId"); + + b.ToTable("ProceedPublishConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEditedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyRegistrationNumber") + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("DUNSNumber") + .HasColumnType("text"); + + b.Property("HasParentCompany") + .HasColumnType("boolean"); + + b.Property("HasRegistrationNumber") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ParentCompanyLocation") + .HasColumnType("text"); + + b.Property("ParentCompanyRegisteredName") + .HasColumnType("text"); + + b.Property("PrimaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderStatus") + .HasColumnType("integer"); + + b.Property("ProviderTelephoneNumber") + .HasColumnType("text"); + + b.Property("ProviderWebsiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublicContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("RegisteredName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "RegisteredName", "TradingName" }); + + b.Property("SecondaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("TradingName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("SearchVector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.ToTable("ProviderProfile"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IsBannedPoliticalApproved") + .HasColumnType("boolean"); + + b.Property("IsCompanyHouseNumberApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsAndRelationApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsApproved") + .HasColumnType("boolean"); + + b.Property("IsECCheckApproved") + .HasColumnType("boolean"); + + b.Property("IsProvidersWebpageApproved") + .HasColumnType("boolean"); + + b.Property("IsSanctionListApproved") + .HasColumnType("boolean"); + + b.Property("IsTARICApproved") + .HasColumnType("boolean"); + + b.Property("IsTradingAddressApproved") + .HasColumnType("boolean"); + + b.Property("IsUNFCApproved") + .HasColumnType("boolean"); + + b.Property("PrimaryCheckComment") + .HasColumnType("text"); + + b.Property("PrimaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PrimaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublicInterestCheckStatus") + .HasColumnType("integer"); + + b.Property("RejectionReason") + .HasColumnType("integer"); + + b.Property("RejectionReasons") + .HasColumnType("text"); + + b.Property("SecondaryCheckComment") + .HasColumnType("text"); + + b.Property("SecondaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SecondaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PrimaryCheckUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SecondaryCheckUserId"); + + b.HasIndex("ServiceId"); + + b.ToTable("PublicInterestCheck"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.QualityLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Level") + .IsRequired() + .HasColumnType("text"); + + b.Property("QualityType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("QualityLevel"); + + b.HasData( + new + { + Id = 1, + Level = "Low", + QualityType = 1 + }, + new + { + Id = 2, + Level = "Medium", + QualityType = 1 + }, + new + { + Id = 3, + Level = "High", + QualityType = 1 + }, + new + { + Id = 4, + Level = "Low", + QualityType = 2 + }, + new + { + Id = 5, + Level = "Medium", + QualityType = 2 + }, + new + { + Id = 6, + Level = "High", + QualityType = 2 + }, + new + { + Id = 7, + Level = "Very High", + QualityType = 2 + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("Services") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ProviderProfileId"); + + b.ToTable("RegisterPublishLog"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + Order = 1, + RoleName = "Identity Service Provider (IDSP)" + }, + new + { + Id = 2, + Order = 2, + RoleName = "Attribute Service Provider (ASP)" + }, + new + { + Id = 3, + Order = 3, + RoleName = "Orchestration Service Provider (OSP)" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConformityExpiryDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConformityIssueDate") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("FileLink") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileSizeInKb") + .HasColumnType("decimal(10, 1)"); + + b.Property("HasGPG44") + .HasColumnType("boolean"); + + b.Property("HasGPG45") + .HasColumnType("boolean"); + + b.Property("HasSupplementarySchemes") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SearchVector") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("tsvector") + .HasAnnotation("Npgsql:TsVectorConfig", "english") + .HasAnnotation("Npgsql:TsVectorProperties", new[] { "ServiceName" }); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ServiceStatus") + .HasColumnType("integer"); + + b.Property("WebSiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SearchVector"); + + NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); + + b.ToTable("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IdentityProfileId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceIdentityProfileMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("QualityLevelId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("QualityLevelId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceQualityLevelMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceRoleMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("SupplementarySchemeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("SupplementarySchemeId"); + + b.ToTable("ServiceSupSchemeMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.SupplementaryScheme", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("SchemeName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("SupplementaryScheme"); + + b.HasData( + new + { + Id = 1, + Order = 2, + SchemeName = "Right to Work" + }, + new + { + Id = 2, + Order = 1, + SchemeName = "Right to Rent" + }, + new + { + Id = 3, + Order = 3, + SchemeName = "Disclosure and Barring Service" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.Property("CompanyId") + .HasColumnType("integer"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("TimeStamp") + .HasColumnType("timestamp without time zone"); + + b.Property("TrustMarkNumber") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("text") + .HasComputedColumnSql("LPAD(\"CompanyId\"::VARCHAR(4), 4, '0') || LPAD(\"ServiceNumber\"::VARCHAR(2), 2, '0')", true); + + b.HasKey("CompanyId", "ServiceNumber"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TrustMarkNumber") + .IsUnique(); + + b.HasIndex("ProviderProfileId", "ServiceId") + .IsUnique(); + + b.ToTable("TrustmarkNumber", t => + { + t.HasCheckConstraint("CK_CompanyId", "\"CompanyId\" BETWEEN 200 AND 9999"); + + t.HasCheckConstraint("CK_ServiceNumber", "\"ServiceNumber\" BETWEEN 1 AND 99"); + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.HasOne("DVSRegister.Data.Entities.Cab", "Cab") + .WithMany() + .HasForeignKey("CabId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cab"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "ProviderProfile") + .WithMany() + .HasForeignKey("ProviProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("CertificateReview") + .HasForeignKey("DVSRegister.Data.Entities.CertificateReview", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.CertificateReviewRejectionReason", "CertificateReviewRejectionReason") + .WithMany() + .HasForeignKey("CertificateReviewRejectionReasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.CertificateReview", "CetificateReview") + .WithMany("CertificateReviewRejectionReasonMapping") + .HasForeignKey("CetificateReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CertificateReviewRejectionReason"); + + b.Navigation("CetificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.HasOne("DVSRegister.Data.Entities.PublicInterestCheck", "PublicInterestCheck") + .WithMany() + .HasForeignKey("PublicInterestCheckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicInterestCheck"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("ProceedApplicationConsentToken") + .HasForeignKey("DVSRegister.Data.Entities.ProceedApplicationConsentToken", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.HasOne("DVSRegister.Data.Entities.User", "PrimaryCheckUser") + .WithMany() + .HasForeignKey("PrimaryCheckUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "SecondaryCheckUser") + .WithMany() + .HasForeignKey("SecondaryCheckUserId"); + + b.HasOne("DVSRegister.Data.Entities.Service", "PreRegistration") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PreRegistration"); + + b.Navigation("PrimaryCheckUser"); + + b.Navigation("Provider"); + + b.Navigation("SecondaryCheckUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany("Services") + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.IdentityProfile", "IdentityProfile") + .WithMany() + .HasForeignKey("IdentityProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceIdentityProfileMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IdentityProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.QualityLevel", "QualityLevel") + .WithMany() + .HasForeignKey("QualityLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceQualityLevelMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QualityLevel"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceRoleMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceSupSchemeMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.SupplementaryScheme", "SupplementaryScheme") + .WithMany() + .HasForeignKey("SupplementarySchemeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + + b.Navigation("SupplementaryScheme"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Navigation("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Navigation("Services"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Navigation("CertificateReview") + .IsRequired(); + + b.Navigation("ProceedApplicationConsentToken") + .IsRequired(); + + b.Navigation("ServiceIdentityProfileMapping"); + + b.Navigation("ServiceQualityLevelMapping"); + + b.Navigation("ServiceRoleMapping"); + + b.Navigation("ServiceSupSchemeMapping"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DVSRegister.Data/Migrations/20241216105741_AddPgTrgmExtension.cs b/DVSRegister.Data/Migrations/20241216105741_AddPgTrgmExtension.cs new file mode 100644 index 00000000..fd5f9730 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241216105741_AddPgTrgmExtension.cs @@ -0,0 +1,21 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + /// + public partial class AddPgTrgmExtension : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("CREATE EXTENSION IF NOT EXISTS pg_trgm;"); + } + + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql("DROP EXTENSION IF EXISTS pg_trgm;"); + } + } +} diff --git a/DVSRegister.Data/Migrations/20241216112717_RemoveSearchVector.Designer.cs b/DVSRegister.Data/Migrations/20241216112717_RemoveSearchVector.Designer.cs new file mode 100644 index 00000000..7b0e72df --- /dev/null +++ b/DVSRegister.Data/Migrations/20241216112717_RemoveSearchVector.Designer.cs @@ -0,0 +1,1504 @@ +// +using System; +using System.Text.Json; +using DVSRegister.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + [DbContext(typeof(DVSRegisterDbContext))] + [Migration("20241216112717_RemoveSearchVector")] + partial class RemoveSearchVector + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("DVSRegister.Data.Entities.Cab", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabName") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.ToTable("Cab"); + + b.HasData( + new + { + Id = 1, + CabName = "EY", + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5909) + }, + new + { + Id = 2, + CabName = "DSIT", + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5911) + }, + new + { + Id = 3, + CabName = "ACCS", + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5912) + }, + new + { + Id = 4, + CabName = "Kantara", + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5913) + }, + new + { + Id = 6, + CabName = "NQA", + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5914) + }, + new + { + Id = 7, + CabName = "BSI", + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5915) + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("CabId") + .HasColumnType("integer"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.HasKey("Id"); + + b.HasIndex("CabId"); + + b.ToTable("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewStatus") + .HasColumnType("integer"); + + b.Property("Comments") + .HasColumnType("text"); + + b.Property("CommentsForIncorrect") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("InformationMatched") + .HasColumnType("boolean"); + + b.Property("IsAuthenticyVerifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsCabLogoCorrect") + .HasColumnType("boolean"); + + b.Property("IsCertificationScopeCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfExpiryCorrect") + .HasColumnType("boolean"); + + b.Property("IsDateOfIssueCorrect") + .HasColumnType("boolean"); + + b.Property("IsGPG44Correct") + .HasColumnType("boolean"); + + b.Property("IsGPG45Correct") + .HasColumnType("boolean"); + + b.Property("IsLocationCorrect") + .HasColumnType("boolean"); + + b.Property("IsProviderDetailsCorrect") + .HasColumnType("boolean"); + + b.Property("IsRolesCertifiedCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceNameCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceProvisionCorrect") + .HasColumnType("boolean"); + + b.Property("IsServiceSummaryCorrect") + .HasColumnType("boolean"); + + b.Property("IsURLLinkToServiceCorrect") + .HasColumnType("boolean"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviProviderProfileId") + .HasColumnType("integer"); + + b.Property("RejectionComments") + .HasColumnType("text"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("VerifiedUser") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ProviProviderProfileId"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("CertificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReason", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Reason") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("CertificateReviewRejectionReason"); + + b.HasData( + new + { + Id = 1, + Reason = "Information is missing from the certificate" + }, + new + { + Id = 2, + Reason = "The certificate contains invalid information" + }, + new + { + Id = 3, + Reason = "The information submitted does not match the information on the certificate" + }, + new + { + Id = 4, + Reason = "The certificate or information submitted contains errors" + }, + new + { + Id = 5, + Reason = "Other" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CertificateReviewRejectionReasonId") + .HasColumnType("integer"); + + b.Property("CetificateReviewId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CertificateReviewRejectionReasonId"); + + b.HasIndex("CetificateReviewId"); + + b.ToTable("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Event", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("Action") + .IsRequired() + .HasColumnType("text"); + + b.Property("ActorId") + .IsRequired() + .HasColumnType("text"); + + b.Property("AffectedColumns") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("DateTime") + .HasColumnType("timestamp without time zone"); + + b.Property("EventType") + .IsRequired() + .HasColumnType("text"); + + b.Property("NewValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("OldValues") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("PrimaryKey") + .IsRequired() + .HasColumnType("jsonb"); + + b.Property("TableName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Team") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("EventLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.IdentityProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("IdentityProfile"); + + b.HasData( + new + { + Id = 1, + IdentityProfileName = "L1A " + }, + new + { + Id = 2, + IdentityProfileName = "L1B " + }, + new + { + Id = 3, + IdentityProfileName = "L1C " + }, + new + { + Id = 4, + IdentityProfileName = "L2A " + }, + new + { + Id = 5, + IdentityProfileName = "L2B " + }, + new + { + Id = 6, + IdentityProfileName = "L3A " + }, + new + { + Id = 7, + IdentityProfileName = "M1A " + }, + new + { + Id = 8, + IdentityProfileName = "M1B " + }, + new + { + Id = 9, + IdentityProfileName = "M1C " + }, + new + { + Id = 10, + IdentityProfileName = "M1D " + }, + new + { + Id = 11, + IdentityProfileName = "M2A " + }, + new + { + Id = 12, + IdentityProfileName = "M2B " + }, + new + { + Id = 13, + IdentityProfileName = "M2C " + }, + new + { + Id = 14, + IdentityProfileName = "M3A " + }, + new + { + Id = 15, + IdentityProfileName = "H1A " + }, + new + { + Id = 16, + IdentityProfileName = "H1B " + }, + new + { + Id = 17, + IdentityProfileName = "H1C " + }, + new + { + Id = 18, + IdentityProfileName = "H2A " + }, + new + { + Id = 19, + IdentityProfileName = "H2B " + }, + new + { + Id = 20, + IdentityProfileName = "H2C " + }, + new + { + Id = 21, + IdentityProfileName = "H2D " + }, + new + { + Id = 22, + IdentityProfileName = "H2E " + }, + new + { + Id = 23, + IdentityProfileName = "H3A " + }, + new + { + Id = 24, + IdentityProfileName = "V1A " + }, + new + { + Id = 25, + IdentityProfileName = "V1B " + }, + new + { + Id = 26, + IdentityProfileName = "V1C " + }, + new + { + Id = 27, + IdentityProfileName = "V1D " + }, + new + { + Id = 28, + IdentityProfileName = "V2A " + }, + new + { + Id = 29, + IdentityProfileName = "V2B " + }, + new + { + Id = 30, + IdentityProfileName = "V2C " + }, + new + { + Id = 31, + IdentityProfileName = "V2D " + }, + new + { + Id = 32, + IdentityProfileName = "V3A " + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text"); + + b.Property("LogTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PublicInterestCheckId") + .HasColumnType("integer"); + + b.Property("ReviewType") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PublicInterestCheckId"); + + b.HasIndex("UserId"); + + b.ToTable("PICheckLogs"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId") + .IsUnique(); + + b.ToTable("ProceedApplicationConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("Token") + .IsRequired() + .HasColumnType("text"); + + b.Property("TokenId") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("Token"); + + b.HasIndex("TokenId"); + + b.ToTable("ProceedPublishConsentToken"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabEditedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyRegistrationNumber") + .HasColumnType("text"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("DUNSNumber") + .HasColumnType("text"); + + b.Property("HasParentCompany") + .HasColumnType("boolean"); + + b.Property("HasRegistrationNumber") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ParentCompanyLocation") + .HasColumnType("text"); + + b.Property("ParentCompanyRegisteredName") + .HasColumnType("text"); + + b.Property("PrimaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("PrimaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderStatus") + .HasColumnType("integer"); + + b.Property("ProviderTelephoneNumber") + .HasColumnType("text"); + + b.Property("ProviderWebsiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublicContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("RegisteredName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactEmail") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactJobTitle") + .IsRequired() + .HasColumnType("text"); + + b.Property("SecondaryContactTelephoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("TradingName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.ToTable("ProviderProfile"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IsBannedPoliticalApproved") + .HasColumnType("boolean"); + + b.Property("IsCompanyHouseNumberApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsAndRelationApproved") + .HasColumnType("boolean"); + + b.Property("IsDirectorshipsApproved") + .HasColumnType("boolean"); + + b.Property("IsECCheckApproved") + .HasColumnType("boolean"); + + b.Property("IsProvidersWebpageApproved") + .HasColumnType("boolean"); + + b.Property("IsSanctionListApproved") + .HasColumnType("boolean"); + + b.Property("IsTARICApproved") + .HasColumnType("boolean"); + + b.Property("IsTradingAddressApproved") + .HasColumnType("boolean"); + + b.Property("IsUNFCApproved") + .HasColumnType("boolean"); + + b.Property("PrimaryCheckComment") + .HasColumnType("text"); + + b.Property("PrimaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("PrimaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublicInterestCheckStatus") + .HasColumnType("integer"); + + b.Property("RejectionReason") + .HasColumnType("integer"); + + b.Property("RejectionReasons") + .HasColumnType("text"); + + b.Property("SecondaryCheckComment") + .HasColumnType("text"); + + b.Property("SecondaryCheckTime") + .HasColumnType("timestamp without time zone"); + + b.Property("SecondaryCheckUserId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("PrimaryCheckUserId"); + + b.HasIndex("ProviderProfileId"); + + b.HasIndex("SecondaryCheckUserId"); + + b.HasIndex("ServiceId"); + + b.ToTable("PublicInterestCheck"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.QualityLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Level") + .IsRequired() + .HasColumnType("text"); + + b.Property("QualityType") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("QualityLevel"); + + b.HasData( + new + { + Id = 1, + Level = "Low", + QualityType = 1 + }, + new + { + Id = 2, + Level = "Medium", + QualityType = 1 + }, + new + { + Id = 3, + Level = "High", + QualityType = 1 + }, + new + { + Id = 4, + Level = "Low", + QualityType = 2 + }, + new + { + Id = 5, + Level = "Medium", + QualityType = 2 + }, + new + { + Id = 6, + Level = "High", + QualityType = 2 + }, + new + { + Id = 7, + Level = "Very High", + QualityType = 2 + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProviderName") + .HasColumnType("text"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("Services") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ProviderProfileId"); + + b.ToTable("RegisterPublishLog"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Role"); + + b.HasData( + new + { + Id = 1, + Order = 1, + RoleName = "Identity Service Provider (IDSP)" + }, + new + { + Id = 2, + Order = 2, + RoleName = "Attribute Service Provider (ASP)" + }, + new + { + Id = 3, + Order = 3, + RoleName = "Orchestration Service Provider (OSP)" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CabUserId") + .HasColumnType("integer"); + + b.Property("CompanyAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("ConformityExpiryDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConformityIssueDate") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("FileLink") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileSizeInKb") + .HasColumnType("decimal(10, 1)"); + + b.Property("HasGPG44") + .HasColumnType("boolean"); + + b.Property("HasGPG45") + .HasColumnType("boolean"); + + b.Property("HasSupplementarySchemes") + .HasColumnType("boolean"); + + b.Property("ModifiedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("PublishedTime") + .HasColumnType("timestamp without time zone"); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ServiceStatus") + .HasColumnType("integer"); + + b.Property("WebSiteAddress") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CabUserId"); + + b.HasIndex("ProviderProfileId"); + + b.ToTable("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("IdentityProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("IdentityProfileId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceIdentityProfileMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("QualityLevelId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("QualityLevelId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceQualityLevelMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("ServiceId"); + + b.ToTable("ServiceRoleMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("SupplementarySchemeId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("ServiceId"); + + b.HasIndex("SupplementarySchemeId"); + + b.ToTable("ServiceSupSchemeMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.SupplementaryScheme", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Order") + .HasColumnType("integer"); + + b.Property("SchemeName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("SupplementaryScheme"); + + b.HasData( + new + { + Id = 1, + Order = 2, + SchemeName = "Right to Work" + }, + new + { + Id = 2, + Order = 1, + SchemeName = "Right to Rent" + }, + new + { + Id = 3, + Order = 3, + SchemeName = "Disclosure and Barring Service" + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.Property("CompanyId") + .HasColumnType("integer"); + + b.Property("ServiceNumber") + .HasColumnType("integer"); + + b.Property("ProviderProfileId") + .HasColumnType("integer"); + + b.Property("ServiceId") + .HasColumnType("integer"); + + b.Property("TimeStamp") + .HasColumnType("timestamp without time zone"); + + b.Property("TrustMarkNumber") + .IsRequired() + .ValueGeneratedOnAddOrUpdate() + .HasColumnType("text") + .HasComputedColumnSql("LPAD(\"CompanyId\"::VARCHAR(4), 4, '0') || LPAD(\"ServiceNumber\"::VARCHAR(2), 2, '0')", true); + + b.HasKey("CompanyId", "ServiceNumber"); + + b.HasIndex("ServiceId"); + + b.HasIndex("TrustMarkNumber") + .IsUnique(); + + b.HasIndex("ProviderProfileId", "ServiceId") + .IsUnique(); + + b.ToTable("TrustmarkNumber", t => + { + t.HasCheckConstraint("CK_CompanyId", "\"CompanyId\" BETWEEN 200 AND 9999"); + + t.HasCheckConstraint("CK_ServiceNumber", "\"ServiceNumber\" BETWEEN 1 AND 99"); + }); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("CreatedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ModifiedDate") + .HasColumnType("timestamp without time zone"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("User"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("text"); + + b.Property("Xml") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CabUser", b => + { + b.HasOne("DVSRegister.Data.Entities.Cab", "Cab") + .WithMany() + .HasForeignKey("CabId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Cab"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "ProviderProfile") + .WithMany() + .HasForeignKey("ProviProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("CertificateReview") + .HasForeignKey("DVSRegister.Data.Entities.CertificateReview", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReviewRejectionReasonMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.CertificateReviewRejectionReason", "CertificateReviewRejectionReason") + .WithMany() + .HasForeignKey("CertificateReviewRejectionReasonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.CertificateReview", "CetificateReview") + .WithMany("CertificateReviewRejectionReasonMapping") + .HasForeignKey("CetificateReviewId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CertificateReviewRejectionReason"); + + b.Navigation("CetificateReview"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PICheckLogs", b => + { + b.HasOne("DVSRegister.Data.Entities.PublicInterestCheck", "PublicInterestCheck") + .WithMany() + .HasForeignKey("PublicInterestCheckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PublicInterestCheck"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithOne("ProceedApplicationConsentToken") + .HasForeignKey("DVSRegister.Data.Entities.ProceedApplicationConsentToken", "ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProceedPublishConsentToken", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.PublicInterestCheck", b => + { + b.HasOne("DVSRegister.Data.Entities.User", "PrimaryCheckUser") + .WithMany() + .HasForeignKey("PrimaryCheckUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.User", "SecondaryCheckUser") + .WithMany() + .HasForeignKey("SecondaryCheckUserId"); + + b.HasOne("DVSRegister.Data.Entities.Service", "PreRegistration") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("PreRegistration"); + + b.Navigation("PrimaryCheckUser"); + + b.Navigation("Provider"); + + b.Navigation("SecondaryCheckUser"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.RegisterPublishLog", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.HasOne("DVSRegister.Data.Entities.CabUser", "CabUser") + .WithMany() + .HasForeignKey("CabUserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany("Services") + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CabUser"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceIdentityProfileMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.IdentityProfile", "IdentityProfile") + .WithMany() + .HasForeignKey("IdentityProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceIdentityProfileMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("IdentityProfile"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceQualityLevelMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.QualityLevel", "QualityLevel") + .WithMany() + .HasForeignKey("QualityLevelId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceQualityLevelMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QualityLevel"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceRoleMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceRoleMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ServiceSupSchemeMapping", b => + { + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany("ServiceSupSchemeMapping") + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.SupplementaryScheme", "SupplementaryScheme") + .WithMany() + .HasForeignKey("SupplementarySchemeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Service"); + + b.Navigation("SupplementaryScheme"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.TrustmarkNumber", b => + { + b.HasOne("DVSRegister.Data.Entities.ProviderProfile", "Provider") + .WithMany() + .HasForeignKey("ProviderProfileId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DVSRegister.Data.Entities.Service", "Service") + .WithMany() + .HasForeignKey("ServiceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Provider"); + + b.Navigation("Service"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.CertificateReview", b => + { + b.Navigation("CertificateReviewRejectionReasonMapping"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.ProviderProfile", b => + { + b.Navigation("Services"); + }); + + modelBuilder.Entity("DVSRegister.Data.Entities.Service", b => + { + b.Navigation("CertificateReview") + .IsRequired(); + + b.Navigation("ProceedApplicationConsentToken") + .IsRequired(); + + b.Navigation("ServiceIdentityProfileMapping"); + + b.Navigation("ServiceQualityLevelMapping"); + + b.Navigation("ServiceRoleMapping"); + + b.Navigation("ServiceSupSchemeMapping"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DVSRegister.Data/Migrations/20241216112717_RemoveSearchVector.cs b/DVSRegister.Data/Migrations/20241216112717_RemoveSearchVector.cs new file mode 100644 index 00000000..7e8d5dc0 --- /dev/null +++ b/DVSRegister.Data/Migrations/20241216112717_RemoveSearchVector.cs @@ -0,0 +1,148 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using NpgsqlTypes; + +#nullable disable + +namespace DVSRegister.Data.Migrations +{ + /// + public partial class RemoveSearchVector : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_Service_SearchVector", + table: "Service"); + + migrationBuilder.DropIndex( + name: "IX_ProviderProfile_SearchVector", + table: "ProviderProfile"); + + migrationBuilder.DropColumn( + name: "SearchVector", + table: "Service"); + + migrationBuilder.DropColumn( + name: "SearchVector", + table: "ProviderProfile"); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 1, + column: "CreatedTime", + value: new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5909)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 2, + column: "CreatedTime", + value: new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5911)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 3, + column: "CreatedTime", + value: new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5912)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 4, + column: "CreatedTime", + value: new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5913)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 6, + column: "CreatedTime", + value: new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5914)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 7, + column: "CreatedTime", + value: new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5915)); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "SearchVector", + table: "Service", + type: "tsvector", + nullable: false) + .Annotation("Npgsql:TsVectorConfig", "english") + .Annotation("Npgsql:TsVectorProperties", new[] { "ServiceName" }); + + migrationBuilder.AddColumn( + name: "SearchVector", + table: "ProviderProfile", + type: "tsvector", + nullable: false) + .Annotation("Npgsql:TsVectorConfig", "english") + .Annotation("Npgsql:TsVectorProperties", new[] { "RegisteredName", "TradingName" }); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 1, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2100)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 2, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 3, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 4, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 6, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.UpdateData( + table: "Cab", + keyColumn: "Id", + keyValue: 7, + column: "CreatedTime", + value: new DateTime(2024, 11, 22, 15, 55, 39, 258, DateTimeKind.Utc).AddTicks(2110)); + + migrationBuilder.CreateIndex( + name: "IX_Service_SearchVector", + table: "Service", + column: "SearchVector") + .Annotation("Npgsql:IndexMethod", "GIN"); + + migrationBuilder.CreateIndex( + name: "IX_ProviderProfile_SearchVector", + table: "ProviderProfile", + column: "SearchVector") + .Annotation("Npgsql:IndexMethod", "GIN"); + } + } +} diff --git a/DVSRegister.Data/Migrations/DVSRegisterDbContextModelSnapshot.cs b/DVSRegister.Data/Migrations/DVSRegisterDbContextModelSnapshot.cs index 65a62073..a82a5959 100644 --- a/DVSRegister.Data/Migrations/DVSRegisterDbContextModelSnapshot.cs +++ b/DVSRegister.Data/Migrations/DVSRegisterDbContextModelSnapshot.cs @@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; -using NpgsqlTypes; #nullable disable @@ -48,37 +47,37 @@ protected override void BuildModel(ModelBuilder modelBuilder) { Id = 1, CabName = "EY", - CreatedTime = new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9262) + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5909) }, new { Id = 2, CabName = "DSIT", - CreatedTime = new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9266) + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5911) }, new { Id = 3, CabName = "ACCS", - CreatedTime = new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9267) + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5912) }, new { Id = 4, CabName = "Kantara", - CreatedTime = new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9268) + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5913) }, new { Id = 6, CabName = "NQA", - CreatedTime = new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9269) + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5914) }, new { Id = 7, CabName = "BSI", - CreatedTime = new DateTime(2024, 11, 13, 17, 25, 45, 9, DateTimeKind.Utc).AddTicks(9270) + CreatedTime = new DateTime(2024, 12, 16, 11, 27, 16, 904, DateTimeKind.Utc).AddTicks(5915) }); }); @@ -131,49 +130,49 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("InformationMatched") .HasColumnType("boolean"); - b.Property("IsAuthenticyVerifiedCorrect") + b.Property("IsAuthenticyVerifiedCorrect") .HasColumnType("boolean"); - b.Property("IsCabDetailsCorrect") + b.Property("IsCabDetailsCorrect") .HasColumnType("boolean"); - b.Property("IsCabLogoCorrect") + b.Property("IsCabLogoCorrect") .HasColumnType("boolean"); - b.Property("IsCertificationScopeCorrect") + b.Property("IsCertificationScopeCorrect") .HasColumnType("boolean"); - b.Property("IsDateOfExpiryCorrect") + b.Property("IsDateOfExpiryCorrect") .HasColumnType("boolean"); - b.Property("IsDateOfIssueCorrect") + b.Property("IsDateOfIssueCorrect") .HasColumnType("boolean"); - b.Property("IsGPG44Correct") + b.Property("IsGPG44Correct") .HasColumnType("boolean"); - b.Property("IsGPG45Correct") + b.Property("IsGPG45Correct") .HasColumnType("boolean"); - b.Property("IsLocationCorrect") + b.Property("IsLocationCorrect") .HasColumnType("boolean"); - b.Property("IsProviderDetailsCorrect") + b.Property("IsProviderDetailsCorrect") .HasColumnType("boolean"); - b.Property("IsRolesCertifiedCorrect") + b.Property("IsRolesCertifiedCorrect") .HasColumnType("boolean"); - b.Property("IsServiceNameCorrect") + b.Property("IsServiceNameCorrect") .HasColumnType("boolean"); - b.Property("IsServiceProvisionCorrect") + b.Property("IsServiceProvisionCorrect") .HasColumnType("boolean"); - b.Property("IsServiceSummaryCorrect") + b.Property("IsServiceSummaryCorrect") .HasColumnType("boolean"); - b.Property("IsURLLinkToServiceCorrect") + b.Property("IsURLLinkToServiceCorrect") .HasColumnType("boolean"); b.Property("ModifiedDate") @@ -552,7 +551,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasKey("Id"); - b.HasIndex("ServiceId"); + b.HasIndex("ServiceId") + .IsUnique(); b.ToTable("ProceedApplicationConsentToken"); }); @@ -663,13 +663,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired() .HasColumnType("text"); - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasAnnotation("Npgsql:TsVectorConfig", "english") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "RegisteredName", "TradingName" }); - b.Property("SecondaryContactEmail") .IsRequired() .HasColumnType("text"); @@ -694,10 +687,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("CabUserId"); - b.HasIndex("SearchVector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - b.ToTable("ProviderProfile"); }); @@ -709,34 +698,34 @@ protected override void BuildModel(ModelBuilder modelBuilder) NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - b.Property("IsBannedPoliticalApproved") + b.Property("IsBannedPoliticalApproved") .HasColumnType("boolean"); - b.Property("IsCompanyHouseNumberApproved") + b.Property("IsCompanyHouseNumberApproved") .HasColumnType("boolean"); - b.Property("IsDirectorshipsAndRelationApproved") + b.Property("IsDirectorshipsAndRelationApproved") .HasColumnType("boolean"); - b.Property("IsDirectorshipsApproved") + b.Property("IsDirectorshipsApproved") .HasColumnType("boolean"); - b.Property("IsECCheckApproved") + b.Property("IsECCheckApproved") .HasColumnType("boolean"); - b.Property("IsProvidersWebpageApproved") + b.Property("IsProvidersWebpageApproved") .HasColumnType("boolean"); - b.Property("IsSanctionListApproved") + b.Property("IsSanctionListApproved") .HasColumnType("boolean"); - b.Property("IsTARICApproved") + b.Property("IsTARICApproved") .HasColumnType("boolean"); - b.Property("IsTradingAddressApproved") + b.Property("IsTradingAddressApproved") .HasColumnType("boolean"); - b.Property("IsUNFCApproved") + b.Property("IsUNFCApproved") .HasColumnType("boolean"); b.Property("PrimaryCheckComment") @@ -973,13 +962,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PublishedTime") .HasColumnType("timestamp without time zone"); - b.Property("SearchVector") - .IsRequired() - .ValueGeneratedOnAddOrUpdate() - .HasColumnType("tsvector") - .HasAnnotation("Npgsql:TsVectorConfig", "english") - .HasAnnotation("Npgsql:TsVectorProperties", new[] { "ServiceName" }); - b.Property("ServiceName") .IsRequired() .HasColumnType("text"); @@ -1000,10 +982,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("ProviderProfileId"); - b.HasIndex("SearchVector"); - - NpgsqlIndexBuilderExtensions.HasMethod(b.HasIndex("SearchVector"), "GIN"); - b.ToTable("Service"); }); @@ -1303,8 +1281,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("DVSRegister.Data.Entities.ProceedApplicationConsentToken", b => { b.HasOne("DVSRegister.Data.Entities.Service", "Service") - .WithMany() - .HasForeignKey("ServiceId") + .WithOne("ProceedApplicationConsentToken") + .HasForeignKey("DVSRegister.Data.Entities.ProceedApplicationConsentToken", "ServiceId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1506,6 +1484,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("CertificateReview") .IsRequired(); + b.Navigation("ProceedApplicationConsentToken") + .IsRequired(); + b.Navigation("ServiceIdentityProfileMapping"); b.Navigation("ServiceQualityLevelMapping"); diff --git a/DVSRegister.Data/Register/RegisterRepository.cs b/DVSRegister.Data/Register/RegisterRepository.cs index 7f1a1bae..b9ab096d 100644 --- a/DVSRegister.Data/Register/RegisterRepository.cs +++ b/DVSRegister.Data/Register/RegisterRepository.cs @@ -21,7 +21,9 @@ public async Task> GetProviders(List roles, List IQueryable providerQuery = context.ProviderProfile; providerQuery = providerQuery.Where(p => (p.ProviderStatus == ProviderStatusEnum.Published || p.ProviderStatus == ProviderStatusEnum.PublishedActionRequired) && - (string.IsNullOrEmpty(searchText) || p.SearchVector.Matches(searchText))) + (string.IsNullOrEmpty(searchText) + || EF.Functions.TrigramsSimilarity(p.RegisteredName.ToLower(), searchText.ToLower()) > .3 + || EF.Functions.TrigramsSimilarity(p.TradingName!.ToLower(), searchText.ToLower()) > .3)) .Include(p => p.Services).ThenInclude(ci => ci.ServiceRoleMapping) .Include(p => p.Services).ThenInclude(ci => ci.ServiceSupSchemeMapping) .OrderByDescending(p => p.PublishedTime) diff --git a/DVSRegister.sln b/DVSRegister.sln index 88e29a52..2c959d84 100644 --- a/DVSRegister.sln +++ b/DVSRegister.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DVSRegister.UnitTests", "DV EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DVSRegister.CommonUtility", "DVSRegister.CommonUtility\DVSRegister.CommonUtility.csproj", "{ABDD8283-1B81-4D5C-898E-59E338976411}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unit-testing", "Unit-testing\Unit-testing.csproj", "{08523FED-40BC-4BA7-88B2-B62AB9CEDEDF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {ABDD8283-1B81-4D5C-898E-59E338976411}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABDD8283-1B81-4D5C-898E-59E338976411}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABDD8283-1B81-4D5C-898E-59E338976411}.Release|Any CPU.Build.0 = Release|Any CPU + {08523FED-40BC-4BA7-88B2-B62AB9CEDEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {08523FED-40BC-4BA7-88B2-B62AB9CEDEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {08523FED-40BC-4BA7-88B2-B62AB9CEDEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {08523FED-40BC-4BA7-88B2-B62AB9CEDEDF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DVSRegister/Controllers/CabProviderController.cs b/DVSRegister/Controllers/CabProviderController.cs index 593fd611..fe482414 100644 --- a/DVSRegister/Controllers/CabProviderController.cs +++ b/DVSRegister/Controllers/CabProviderController.cs @@ -7,19 +7,19 @@ using DVSRegister.CommonUtility.Models.Enums; using DVSRegister.Extensions; using DVSRegister.Models.CAB; +using DVSRegister.Validations; using Microsoft.AspNetCore.Mvc; namespace DVSRegister.Controllers { - [Route("cab-service/create-profile")] + [Route("cab-service/create-profile")] [ValidCognitoToken] public class CabProviderController : Controller { - private readonly ICabService cabService; private readonly IUserService userService; - private string UserEmail => HttpContext.Session.Get("Email")??string.Empty; + private string UserEmail => HttpContext.Session.Get("Email") ?? string.Empty; public CabProviderController(ICabService cabService, IUserService userService) { @@ -29,9 +29,9 @@ public CabProviderController(ICabService cabService, IUserService userService) [HttpGet("before-you-start")] public IActionResult BeforeYouStart() - { + { return View(); - } + } #region Registered Name @@ -43,6 +43,7 @@ public IActionResult RegisteredName(bool fromSummaryPage) ProfileSummaryViewModel profileSummaryViewModel = GetProfileSummary(); return View("RegisteredName", profileSummaryViewModel); } + [HttpPost("reg-name")] public async Task SaveRegisteredName(ProfileSummaryViewModel profileSummaryViewModel) { @@ -51,7 +52,8 @@ public async Task SaveRegisteredName(ProfileSummaryViewModel prof if (!string.IsNullOrEmpty(profileSummaryViewModel.RegisteredName)) { - bool registeredNameExist = await cabService.CheckProviderRegisteredNameExists(profileSummaryViewModel.RegisteredName); + bool registeredNameExist = + await cabService.CheckProviderRegisteredNameExists(profileSummaryViewModel.RegisteredName); if (registeredNameExist) { ModelState.AddModelError("RegisteredName", Constants.RegisteredNameExistsError); @@ -69,8 +71,8 @@ public async Task SaveRegisteredName(ProfileSummaryViewModel prof { return View("RegisteredName", profileSummaryViewModel); } - } + #endregion @@ -83,6 +85,7 @@ public IActionResult TradingName(bool fromSummaryPage) ProfileSummaryViewModel profileSummaryViewModel = GetProfileSummary(); return View("TradingName", profileSummaryViewModel); } + [HttpPost("trading-name")] public IActionResult SaveTradingName(ProfileSummaryViewModel profileSummaryViewModel) { @@ -99,12 +102,13 @@ public IActionResult SaveTradingName(ProfileSummaryViewModel profileSummaryViewM { return View("TradingName", profileSummaryViewModel); } - } + #endregion #region HasCompanyRegistrationNumber + [HttpGet("company-number")] public IActionResult HasRegistrationNumber(bool fromSummaryPage) { @@ -122,7 +126,7 @@ public IActionResult SaveHasRegistrationNumber(ProfileSummaryViewModel profileSu profileSummaryViewModel.FromSummaryPage = false; if (ModelState["HasRegistrationNumber"].Errors.Count == 0) { - summaryViewModel.HasRegistrationNumber = profileSummaryViewModel.HasRegistrationNumber; + summaryViewModel.HasRegistrationNumber = profileSummaryViewModel.HasRegistrationNumber; if (Convert.ToBoolean(summaryViewModel.HasRegistrationNumber)) { summaryViewModel.DUNSNumber = null; @@ -140,10 +144,10 @@ public IActionResult SaveHasRegistrationNumber(ProfileSummaryViewModel profileSu { return View("HasRegistrationNumber", profileSummaryViewModel); } - } + #endregion - + #region Registration number [HttpGet("company-number-input")] @@ -162,7 +166,7 @@ public IActionResult SaveCompanyRegistrationNumber(ProfileSummaryViewModel profi if (ModelState["CompanyRegistrationNumber"].Errors.Count == 0) { ProfileSummaryViewModel profileSummary = GetProfileSummary(); - profileSummary.CompanyRegistrationNumber = profileSummaryViewModel.CompanyRegistrationNumber; + profileSummary.CompanyRegistrationNumber = profileSummaryViewModel.CompanyRegistrationNumber; HttpContext?.Session.Set("ProfileSummary", profileSummary); return fromSummaryPage ? RedirectToAction("ProfileSummary") : RedirectToAction("HasParentCompany"); } @@ -170,11 +174,12 @@ public IActionResult SaveCompanyRegistrationNumber(ProfileSummaryViewModel profi { return View("CompanyRegistrationNumber", profileSummaryViewModel); } - } + #endregion #region DUNSNumber + [HttpGet("duns-number")] public IActionResult DUNSNumber(bool fromSummaryPage) { @@ -191,7 +196,7 @@ public IActionResult SaveDUNSNumber(ProfileSummaryViewModel profileSummaryViewMo if (ModelState["DUNSNumber"].Errors.Count == 0) { ProfileSummaryViewModel profileSummary = GetProfileSummary(); - profileSummary.DUNSNumber = profileSummaryViewModel.DUNSNumber; + profileSummary.DUNSNumber = profileSummaryViewModel.DUNSNumber; HttpContext?.Session.Set("ProfileSummary", profileSummary); return fromSummaryPage ? RedirectToAction("ProfileSummary") : RedirectToAction("HasParentCompany"); } @@ -199,8 +204,8 @@ public IActionResult SaveDUNSNumber(ProfileSummaryViewModel profileSummaryViewMo { return View("DUNSNumber", profileSummaryViewModel); } - } + #endregion #region HasParentCompany @@ -219,12 +224,13 @@ public IActionResult SaveHasParentCompany(ProfileSummaryViewModel profileSummary ProfileSummaryViewModel summaryViewModel = GetProfileSummary(); bool fromSummaryPage = profileSummaryViewModel.FromSummaryPage; profileSummaryViewModel.FromSummaryPage = false; - profileSummaryViewModel.HasRegistrationNumber = summaryViewModel.HasRegistrationNumber; // required to add condition for back link + profileSummaryViewModel.HasRegistrationNumber = + summaryViewModel.HasRegistrationNumber; // required to add condition for back link if (ModelState["HasParentCompany"].Errors.Count == 0) { summaryViewModel.HasParentCompany = profileSummaryViewModel.HasParentCompany; if (Convert.ToBoolean(summaryViewModel.HasParentCompany)) - { + { HttpContext?.Session.Set("ProfileSummary", summaryViewModel); return RedirectToAction("ParentCompanyRegisteredName", new { fromSummaryPage = fromSummaryPage }); } @@ -240,7 +246,6 @@ public IActionResult SaveHasParentCompany(ProfileSummaryViewModel profileSummary { return View("HasParentCompany", profileSummaryViewModel); } - } #endregion @@ -255,7 +260,7 @@ public IActionResult ParentCompanyRegisteredName(bool fromSummaryPage) return View(summaryViewModel); } - + [HttpPost("parent-company-registered-name-input")] public IActionResult SaveParentCompanyRegisteredName(ProfileSummaryViewModel profileSummaryViewModel) { @@ -272,8 +277,8 @@ public IActionResult SaveParentCompanyRegisteredName(ProfileSummaryViewModel pro { return View("ParentCompanyRegisteredName", profileSummaryViewModel); } - } + #endregion #region Parent company location @@ -302,28 +307,54 @@ public IActionResult SaveParentCompanyLocation(ProfileSummaryViewModel profileSu { return View("ParentCompanyLocation", profileSummaryViewModel); } - } #endregion #region Primary Contact + [HttpGet("primary-contact-information")] public IActionResult PrimaryContact(bool fromSummaryPage) { - ViewBag.fromSummaryPage = fromSummaryPage; + ViewBag.fromSummaryPage = fromSummaryPage; ProfileSummaryViewModel profileSummaryViewModel = GetProfileSummary(); - ViewBag.hasParentCompany = profileSummaryViewModel.HasParentCompany; + ViewBag.hasParentCompany = profileSummaryViewModel.HasParentCompany; return View(profileSummaryViewModel.PrimaryContact); } + [HttpPost("primary-contact-information")] public IActionResult SavePrimaryContact(PrimaryContactViewModel primaryContactViewModel) { - bool fromSummaryPage = primaryContactViewModel.FromSummaryPage; + bool fromSummaryPage = primaryContactViewModel.FromSummaryPage; primaryContactViewModel.FromSummaryPage = false; + + ProfileSummaryViewModel profileSummary = GetProfileSummary(); + + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryContactViewModel.PrimaryContactEmail, + profileSummary.SecondaryContact?.SecondaryContactEmail, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactEmail", + "SecondaryContactEmail", + "Email address of secondary contact cannot be the same as primary contact" + ) + ); + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: primaryContactViewModel.PrimaryContactTelephoneNumber, + secondaryValue: profileSummary.SecondaryContact?.SecondaryContactTelephoneNumber, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactTelephoneNumber", + "SecondaryContactTelephoneNumber", + "Telephone number of secondary contact cannot be the same as primary contact" + ) + ); + if (ModelState.IsValid) { - ProfileSummaryViewModel profileSummary = GetProfileSummary(); profileSummary.PrimaryContact = primaryContactViewModel; HttpContext?.Session.Set("ProfileSummary", profileSummary); return fromSummaryPage ? RedirectToAction("ProfileSummary") : RedirectToAction("SecondaryContact"); @@ -333,9 +364,11 @@ public IActionResult SavePrimaryContact(PrimaryContactViewModel primaryContactVi return View("PrimaryContact", primaryContactViewModel); } } + #endregion #region Secondary Contact + [HttpGet("secondary-contact-information")] public IActionResult SecondaryContact(bool fromSummaryPage) { @@ -350,9 +383,33 @@ public IActionResult SaveSecondaryContact(SecondaryContactViewModel secondaryCon { bool fromSummaryPage = secondaryContactViewModel.FromSummaryPage; secondaryContactViewModel.FromSummaryPage = false; + + ProfileSummaryViewModel profileSummary = GetProfileSummary(); + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: profileSummary.PrimaryContact?.PrimaryContactEmail, + secondaryValue: secondaryContactViewModel.SecondaryContactEmail, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactEmail", + "SecondaryContactEmail", + "Email address of secondary contact cannot be the same as primary contact" + ) + ); + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: profileSummary.PrimaryContact?.PrimaryContactTelephoneNumber, + secondaryValue: secondaryContactViewModel.SecondaryContactTelephoneNumber, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactTelephoneNumber", + "SecondaryContactTelephoneNumber", + "Telephone number of secondary contact cannot be the same as primary contact" + ) + ); + if (ModelState.IsValid) { - ProfileSummaryViewModel profileSummary = GetProfileSummary(); profileSummary.SecondaryContact = secondaryContactViewModel; HttpContext?.Session.Set("ProfileSummary", profileSummary); return fromSummaryPage ? RedirectToAction("ProfileSummary") : RedirectToAction("PublicContactEmail"); @@ -362,6 +419,7 @@ public IActionResult SaveSecondaryContact(SecondaryContactViewModel secondaryCon return View("SecondaryContact", secondaryContactViewModel); } } + #endregion #region Public contact email @@ -390,11 +448,12 @@ public IActionResult SavePublicContactEmail(ProfileSummaryViewModel profileSumma { return View("PublicContactEmail", profileSummaryViewModel); } - } + #endregion #region Telephone number + [HttpGet("public-telephone")] public IActionResult TelephoneNumber(bool fromSummaryPage) { @@ -408,7 +467,7 @@ public IActionResult SaveTelephoneNumber(ProfileSummaryViewModel profileSummaryV { bool fromSummaryPage = profileSummaryViewModel.FromSummaryPage; profileSummaryViewModel.FromSummaryPage = false; - if (ModelState["ProviderTelephoneNumber"]?.Errors.Count ==0) + if (ModelState["ProviderTelephoneNumber"]?.Errors.Count == 0) { ProfileSummaryViewModel profileSummary = GetProfileSummary(); profileSummary.ProviderTelephoneNumber = profileSummaryViewModel.ProviderTelephoneNumber; @@ -420,9 +479,11 @@ public IActionResult SaveTelephoneNumber(ProfileSummaryViewModel profileSummaryV return View("TelephoneNumber", profileSummaryViewModel); } } + #endregion #region Website address + [HttpGet("public-website")] public IActionResult WebsiteAddress(bool fromSummaryPage) { @@ -448,6 +509,7 @@ public IActionResult SaveWebsiteAddress(ProfileSummaryViewModel profileSummaryVi return View("WebsiteAddress", profileSummaryViewModel); } } + #endregion @@ -459,14 +521,15 @@ public IActionResult ProfileSummary() ProfileSummaryViewModel summaryViewModel = GetProfileSummary(); return View(summaryViewModel); } + [HttpPost("check-answers")] public async Task SaveProfileSummary() { ProfileSummaryViewModel summaryViewModel = GetProfileSummary(); - string email = HttpContext?.Session.Get("Email")??string.Empty; + string email = HttpContext?.Session.Get("Email") ?? string.Empty; CabUserDto cabUserDto = await userService.GetUser(email); - ProviderProfileDto providerDto = MapViewModelToDto(summaryViewModel,cabUserDto.Id); - if(providerDto !=null) + ProviderProfileDto providerDto = MapViewModelToDto(summaryViewModel, cabUserDto.Id); + if (providerDto != null) { GenericResponse genericResponse = await cabService.SaveProviderProfile(providerDto, UserEmail); if (genericResponse.Success) @@ -482,7 +545,6 @@ public async Task SaveProfileSummary() { return RedirectToAction("CabHandleException", "Error"); } - } /// @@ -492,21 +554,22 @@ public async Task SaveProfileSummary() [HttpGet("profile-submitted")] public IActionResult InformationSubmitted() { - string email = HttpContext?.Session.Get("Email")??string.Empty; + string email = HttpContext?.Session.Get("Email") ?? string.Empty; HttpContext?.Session.Remove("ProfileSummary"); ViewBag.Email = email; return View(); - } + #endregion #region Edit Company Information + [HttpGet("edit-company-information")] public async Task EditCompanyInformation(int providerId) { int cabId = Convert.ToInt32(HttpContext?.Session.Get("CabId")); - if (cabId > 0 && providerId>0) + if (cabId > 0 && providerId > 0) { ProviderProfileDto providerProfileDto = await cabService.GetProvider(providerId, cabId); @@ -518,7 +581,7 @@ public async Task EditCompanyInformation(int providerId) RegisteredName = providerProfileDto.RegisteredName, TradingName = providerProfileDto.TradingName, HasRegistrationNumber = providerProfileDto.HasRegistrationNumber, - CompanyRegistrationNumber =providerProfileDto.CompanyRegistrationNumber, + CompanyRegistrationNumber = providerProfileDto.CompanyRegistrationNumber, DUNSNumber = providerProfileDto.DUNSNumber, HasParentCompany = providerProfileDto.HasParentCompany, ParentCompanyRegisteredName = providerProfileDto.ParentCompanyRegisteredName, @@ -532,36 +595,35 @@ public async Task EditCompanyInformation(int providerId) { return RedirectToAction("CabHandleException", "Error"); } - } else { return RedirectToAction("CabHandleException", "Error"); } - - - - } + [HttpPost("edit-company-information")] public async Task UpdateCompanyInformation(CompanyViewModel companyViewModel) { if (!string.IsNullOrEmpty(companyViewModel.RegisteredName)) { - bool registeredNameExist = await cabService.CheckProviderRegisteredNameExists(companyViewModel.RegisteredName, companyViewModel.ProviderId); + bool registeredNameExist = + await cabService.CheckProviderRegisteredNameExists(companyViewModel.RegisteredName, + companyViewModel.ProviderId); if (registeredNameExist) { ModelState.AddModelError("RegisteredName", Constants.RegisteredNameExistsError); } } + if (ModelState.IsValid) { ProviderProfileDto providerProfileDto = new() { Id = companyViewModel.ProviderId, RegisteredName = companyViewModel.RegisteredName, - TradingName = companyViewModel.TradingName??string.Empty, - CompanyRegistrationNumber =companyViewModel.CompanyRegistrationNumber, + TradingName = companyViewModel.TradingName ?? string.Empty, + CompanyRegistrationNumber = companyViewModel.CompanyRegistrationNumber, DUNSNumber = companyViewModel.DUNSNumber, ParentCompanyRegisteredName = companyViewModel.ParentCompanyRegisteredName, ParentCompanyLocation = companyViewModel.ParentCompanyLocation @@ -570,7 +632,8 @@ public async Task UpdateCompanyInformation(CompanyViewModel compa GenericResponse genericResponse = await cabService.UpdateCompanyInfo(providerProfileDto, UserEmail); if (genericResponse.Success) { - return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); + return RedirectToAction("ProviderProfileDetails", "Cab", + new { providerId = providerProfileDto.Id }); } else { @@ -581,16 +644,17 @@ public async Task UpdateCompanyInformation(CompanyViewModel compa { return View("EditCompanyInformation", companyViewModel); } - } + #endregion #region Edit primary contact + [HttpGet("edit-primary-contact")] public async Task EditPrimaryContact(int providerId) { int cabId = Convert.ToInt32(HttpContext?.Session.Get("CabId")); - if (cabId > 0 && providerId>0) + if (cabId > 0 && providerId > 0) { ProviderProfileDto providerProfileDto = await cabService.GetProvider(providerId, cabId); PrimaryContactViewModel primaryContactViewModel = new() @@ -598,7 +662,7 @@ public async Task EditPrimaryContact(int providerId) PrimaryContactFullName = providerProfileDto.PrimaryContactFullName, PrimaryContactEmail = providerProfileDto.PrimaryContactEmail, PrimaryContactJobTitle = providerProfileDto.PrimaryContactJobTitle, - PrimaryContactTelephoneNumber =providerProfileDto.PrimaryContactTelephoneNumber, + PrimaryContactTelephoneNumber = providerProfileDto.PrimaryContactTelephoneNumber, ProviderId = providerProfileDto.Id }; @@ -608,26 +672,57 @@ public async Task EditPrimaryContact(int providerId) { return RedirectToAction("CabHandleException", "Error"); } - } + [HttpPost("edit-primary-contact")] public async Task UpdatePrimaryContact(PrimaryContactViewModel primaryContactViewModel) - { - if (ModelState.IsValid) - { - ProviderProfileDto providerProfileDto = new() - { - PrimaryContactFullName = primaryContactViewModel.PrimaryContactFullName, - PrimaryContactEmail = primaryContactViewModel.PrimaryContactEmail, - PrimaryContactJobTitle =primaryContactViewModel.PrimaryContactJobTitle, - PrimaryContactTelephoneNumber = primaryContactViewModel.PrimaryContactTelephoneNumber, - Id = primaryContactViewModel.ProviderId - }; - - GenericResponse genericResponse = await cabService.UpdatePrimaryContact(providerProfileDto, UserEmail); - if (genericResponse.Success) - { - return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); + { + int cabId = Convert.ToInt32(HttpContext?.Session.Get("CabId")); + if (cabId <= 0 || primaryContactViewModel.ProviderId <= 0) + { + return RedirectToAction("CabHandleException", "Error"); + } + + // Fetch the latest provider data from the database + ProviderProfileDto providerProfileDto = await cabService.GetProvider(primaryContactViewModel.ProviderId, cabId); + if (providerProfileDto == null) + { + return RedirectToAction("CabHandleException", "Error"); + } + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: primaryContactViewModel.PrimaryContactEmail, + secondaryValue: providerProfileDto.SecondaryContactEmail, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactEmail", + "SecondaryContactEmail", + "Email address of secondary contact cannot be the same as primary contact" + ) + ); + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: primaryContactViewModel.PrimaryContactTelephoneNumber, + secondaryValue: providerProfileDto.SecondaryContactTelephoneNumber, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactTelephoneNumber", + "SecondaryContactTelephoneNumber", + "Telephone number of secondary contact cannot be the same as primary contact" + ) + ); + + if (ModelState.IsValid) + { + providerProfileDto.PrimaryContactFullName = primaryContactViewModel.PrimaryContactFullName; + providerProfileDto.PrimaryContactEmail = primaryContactViewModel.PrimaryContactEmail; + providerProfileDto.PrimaryContactJobTitle = primaryContactViewModel.PrimaryContactJobTitle; + providerProfileDto.PrimaryContactTelephoneNumber = primaryContactViewModel.PrimaryContactTelephoneNumber; + + GenericResponse genericResponse = await cabService.UpdatePrimaryContact(providerProfileDto, UserEmail); + if (genericResponse.Success) + { + return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); } else { @@ -638,16 +733,17 @@ public async Task UpdatePrimaryContact(PrimaryContactViewModel pr { return View("EditPrimaryContact", primaryContactViewModel); } - } + #endregion #region Edit secondary contact + [HttpGet("edit-secondary-contact")] public async Task EditSecondaryContact(int providerId) { int cabId = Convert.ToInt32(HttpContext?.Session.Get("CabId")); - if (cabId > 0 && providerId>0) + if (cabId > 0 && providerId > 0) { ProviderProfileDto providerProfileDto = await cabService.GetProvider(providerId, cabId); SecondaryContactViewModel secondaryContactViewModel = new() @@ -655,7 +751,7 @@ public async Task EditSecondaryContact(int providerId) SecondaryContactFullName = providerProfileDto.SecondaryContactFullName, SecondaryContactEmail = providerProfileDto.SecondaryContactEmail, SecondaryContactJobTitle = providerProfileDto.SecondaryContactJobTitle, - SecondaryContactTelephoneNumber =providerProfileDto.SecondaryContactTelephoneNumber, + SecondaryContactTelephoneNumber = providerProfileDto.SecondaryContactTelephoneNumber, ProviderId = providerProfileDto.Id }; @@ -665,25 +761,57 @@ public async Task EditSecondaryContact(int providerId) { return RedirectToAction("CabHandleException", "Error"); } - } + [HttpPost("edit-secondary-contact")] - public async Task UpdateSecondaryContact(SecondaryContactViewModel secondaryContactViewModel) - { - if (ModelState.IsValid) - { - ProviderProfileDto providerProfileDto = new() - { - SecondaryContactFullName = secondaryContactViewModel.SecondaryContactFullName, - SecondaryContactEmail = secondaryContactViewModel.SecondaryContactEmail, - SecondaryContactJobTitle =secondaryContactViewModel.SecondaryContactJobTitle, - SecondaryContactTelephoneNumber = secondaryContactViewModel.SecondaryContactTelephoneNumber, - Id = secondaryContactViewModel.ProviderId - }; - GenericResponse genericResponse = await cabService.UpdateSecondaryContact(providerProfileDto, UserEmail); - if (genericResponse.Success) - { - return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); + public async Task UpdateSecondaryContact(SecondaryContactViewModel secondaryContactViewModel) + { + int cabId = Convert.ToInt32(HttpContext?.Session.Get("CabId")); + if (cabId <= 0 || secondaryContactViewModel.ProviderId <= 0) + { + return RedirectToAction("CabHandleException", "Error"); + } + + // Fetch the latest provider data from the database + ProviderProfileDto providerProfileDto = await cabService.GetProvider(secondaryContactViewModel.ProviderId, cabId); + if (providerProfileDto == null) + { + return RedirectToAction("CabHandleException", "Error"); + } + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: providerProfileDto.PrimaryContactEmail, + secondaryValue: secondaryContactViewModel.SecondaryContactEmail, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactEmail", + "SecondaryContactEmail", + "Email address of secondary contact cannot be the same as primary contact" + ) + ); + + ValidationHelper.ValidateDuplicateFields( + ModelState, + primaryValue: providerProfileDto.PrimaryContactTelephoneNumber, + secondaryValue: secondaryContactViewModel.SecondaryContactTelephoneNumber, + new ValidationHelper.FieldComparisonConfig( + "PrimaryContactTelephoneNumber", + "SecondaryContactTelephoneNumber", + "Telephone number of secondary contact cannot be the same as primary contact" + ) + ); + + if (ModelState.IsValid) + { + providerProfileDto.SecondaryContactFullName = secondaryContactViewModel.SecondaryContactFullName; + providerProfileDto.SecondaryContactEmail = secondaryContactViewModel.SecondaryContactEmail; + providerProfileDto.SecondaryContactJobTitle = secondaryContactViewModel.SecondaryContactJobTitle; + providerProfileDto.SecondaryContactTelephoneNumber = secondaryContactViewModel.SecondaryContactTelephoneNumber; + + GenericResponse genericResponse = await cabService.UpdateSecondaryContact(providerProfileDto, UserEmail); + if (genericResponse.Success) + { + return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); } else { @@ -694,16 +822,17 @@ public async Task UpdateSecondaryContact(SecondaryContactViewMode { return View("EditSecondaryContact", secondaryContactViewModel); } - } + #endregion #region Edit public provider information + [HttpGet("edit-public-provider-information")] public async Task EditPublicProviderInformation(int providerId) { int cabId = Convert.ToInt32(HttpContext?.Session.Get("CabId")); - if (cabId > 0 && providerId>0) + if (cabId > 0 && providerId > 0) { ProviderProfileDto providerProfileDto = await cabService.GetProvider(providerId, cabId); PublicContactViewModel publicContactViewModel = new() @@ -719,12 +848,11 @@ public async Task EditPublicProviderInformation(int providerId) { return RedirectToAction("CabHandleException", "Error"); } - } + [HttpPost("edit-public-provider-information")] public async Task UpdatePublicProviderInformation(PublicContactViewModel publicContactViewModel) { - if (ModelState.IsValid) { ProviderProfileDto providerProfileDto = new() @@ -734,11 +862,13 @@ public async Task UpdatePublicProviderInformation(PublicContactVi ProviderWebsiteAddress = publicContactViewModel.ProviderWebsiteAddress, Id = publicContactViewModel.ProviderId }; - - GenericResponse genericResponse = await cabService.UpdatePublicProviderInformation(providerProfileDto, UserEmail); + + GenericResponse genericResponse = + await cabService.UpdatePublicProviderInformation(providerProfileDto, UserEmail); if (genericResponse.Success) { - return RedirectToAction("ProviderProfileDetails", "Cab", new { providerId = providerProfileDto.Id }); + return RedirectToAction("ProviderProfileDetails", "Cab", + new { providerId = providerProfileDto.Id }); } else { @@ -749,40 +879,47 @@ public async Task UpdatePublicProviderInformation(PublicContactVi { return View("EditPublicProviderInformation", publicContactViewModel); } - } + #endregion #region Private methods + private ProfileSummaryViewModel GetProfileSummary() { - ProfileSummaryViewModel model = HttpContext?.Session.Get("ProfileSummary") ?? new ProfileSummaryViewModel - { - PrimaryContact = new PrimaryContactViewModel(), - SecondaryContact = new SecondaryContactViewModel() - }; + ProfileSummaryViewModel model = HttpContext?.Session.Get("ProfileSummary") ?? + new ProfileSummaryViewModel + { + PrimaryContact = new PrimaryContactViewModel(), + SecondaryContact = new SecondaryContactViewModel() + }; return model; } private ProviderProfileDto MapViewModelToDto(ProfileSummaryViewModel model, int cabUserId) { - ProviderProfileDto providerDto = null; - if (model != null && !string.IsNullOrEmpty(model.RegisteredName) && model.HasRegistrationNumber!=null && model.HasParentCompany!=null - && !string.IsNullOrEmpty(model.PrimaryContact?.PrimaryContactFullName) && !string.IsNullOrEmpty(model?.PrimaryContact.PrimaryContactJobTitle) - && !string.IsNullOrEmpty(model.PrimaryContact?.PrimaryContactEmail) && !string.IsNullOrEmpty(model.PrimaryContact?.PrimaryContactTelephoneNumber) - && !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactFullName) && !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactJobTitle) - && !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactEmail) && !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactTelephoneNumber) - && !string.IsNullOrEmpty(model.PublicContactEmail) && !string.IsNullOrEmpty(model.ProviderWebsiteAddress) && cabUserId>0) + if (model != null && !string.IsNullOrEmpty(model.RegisteredName) && model.HasRegistrationNumber != null && + model.HasParentCompany != null + && !string.IsNullOrEmpty(model.PrimaryContact?.PrimaryContactFullName) && + !string.IsNullOrEmpty(model?.PrimaryContact.PrimaryContactJobTitle) + && !string.IsNullOrEmpty(model.PrimaryContact?.PrimaryContactEmail) && + !string.IsNullOrEmpty(model.PrimaryContact?.PrimaryContactTelephoneNumber) + && !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactFullName) && + !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactJobTitle) + && !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactEmail) && + !string.IsNullOrEmpty(model.SecondaryContact?.SecondaryContactTelephoneNumber) + && !string.IsNullOrEmpty(model.PublicContactEmail) && + !string.IsNullOrEmpty(model.ProviderWebsiteAddress) && cabUserId > 0) { providerDto = new(); providerDto.RegisteredName = model.RegisteredName; - providerDto.TradingName = model.TradingName??string.Empty; - providerDto.HasRegistrationNumber = model.HasRegistrationNumber??false; + providerDto.TradingName = model.TradingName ?? string.Empty; + providerDto.HasRegistrationNumber = model.HasRegistrationNumber ?? false; providerDto.CompanyRegistrationNumber = model.CompanyRegistrationNumber; providerDto.DUNSNumber = model.DUNSNumber; - providerDto.HasParentCompany = model.HasParentCompany??false; + providerDto.HasParentCompany = model.HasParentCompany ?? false; providerDto.ParentCompanyRegisteredName = model.ParentCompanyRegisteredName; providerDto.ParentCompanyLocation = model.ParentCompanyLocation; providerDto.PrimaryContactFullName = model.PrimaryContact.PrimaryContactFullName; @@ -793,7 +930,7 @@ private ProviderProfileDto MapViewModelToDto(ProfileSummaryViewModel model, int providerDto.SecondaryContactJobTitle = model.SecondaryContact.SecondaryContactJobTitle; providerDto.SecondaryContactEmail = model.SecondaryContact.SecondaryContactEmail; providerDto.SecondaryContactTelephoneNumber = model.SecondaryContact.SecondaryContactTelephoneNumber; - providerDto.PublicContactEmail= model.PublicContactEmail; + providerDto.PublicContactEmail = model.PublicContactEmail; providerDto.ProviderTelephoneNumber = model.ProviderTelephoneNumber; providerDto.ProviderWebsiteAddress = model.ProviderWebsiteAddress; providerDto.CabUserId = cabUserId; @@ -803,9 +940,8 @@ private ProviderProfileDto MapViewModelToDto(ProfileSummaryViewModel model, int return providerDto; - } - #endregion + #endregion } -} +} \ No newline at end of file diff --git a/DVSRegister/Controllers/ConsentController.cs b/DVSRegister/Controllers/ConsentController.cs index 6fba7265..2643584e 100644 --- a/DVSRegister/Controllers/ConsentController.cs +++ b/DVSRegister/Controllers/ConsentController.cs @@ -70,7 +70,7 @@ public async Task ProceedApplicationGiveConsent(ConsentViewModel c if (ModelState.IsValid) { - GenericResponse genericResponse = await consentService.UpdateServiceStatus(serviceDto.Id, email); + GenericResponse genericResponse = await consentService.UpdateServiceStatus(serviceDto.Id, email, serviceDto?.Provider?.RegisteredName??string.Empty, serviceDto?.ServiceName??string.Empty); if (genericResponse.Success) { await consentService.RemoveProceedApplicationConsentToken(tokenDetails.Token, tokenDetails.TokenId, email); @@ -130,18 +130,18 @@ public async Task Consent(string token) ServiceDto? serviceDto = await consentService.GetProviderAndCertificateDetailsByConsentToken(tokenDetails.Token, tokenDetails.TokenId); if(serviceDto== null || serviceDto?.ServiceStatus == ServiceStatusEnum.ReadyToPublish) { - return RedirectToAction(Constants.CommonErrorPath); + return RedirectToAction("ConsentErrorAlreadyAgreed"); } consentViewModel.Service = serviceDto; } else { - return RedirectToAction(Constants.CommonErrorPath); + return RedirectToAction("ConsentErrorURLExpired"); } } else { - return RedirectToAction(Constants.CommonErrorPath); + return RedirectToAction("ConsentError"); } @@ -171,7 +171,7 @@ public async Task GiveConsent(ConsentViewModel consentViewModel) } else { - return RedirectToAction(Constants.CommonErrorPath); + return RedirectToAction("ConsentError"); } } else @@ -184,12 +184,12 @@ public async Task GiveConsent(ConsentViewModel consentViewModel) else { await consentService.RemoveConsentToken(tokenDetails.Token, tokenDetails.TokenId, email); - return RedirectToAction(Constants.CommonErrorPath); + return RedirectToAction("ConsentErrorURLExpired"); } } else { - return RedirectToAction(Constants.CommonErrorPath); + return RedirectToAction("ConsentError"); } } @@ -199,9 +199,29 @@ public ActionResult ConsentSuccess() { return View(); } + + [HttpGet("consent-error-already-agreed")] + public ActionResult ConsentErrorAlreadyAgreed() + { + return View(); + } + + [HttpGet("consent-error")] + public ActionResult ConsentErrorError() + { + return View(); + } + + [HttpGet("consent-error-url-expired")] + public ActionResult ConsentErrorURLExpired() + { + return View(); + } + + #endregion - + } diff --git a/DVSRegister/DVSRegister.csproj b/DVSRegister/DVSRegister.csproj index 06cc8834..0e5f6a85 100644 --- a/DVSRegister/DVSRegister.csproj +++ b/DVSRegister/DVSRegister.csproj @@ -22,6 +22,8 @@ + + diff --git a/DVSRegister/Extensions/DateTimeExtensions.cs b/DVSRegister/Extensions/DateTimeExtensions.cs index ab845484..398ce009 100644 --- a/DVSRegister/Extensions/DateTimeExtensions.cs +++ b/DVSRegister/Extensions/DateTimeExtensions.cs @@ -7,6 +7,21 @@ namespace DVSRegister.Extensions { public static class DateTimeExtensions { + public static HtmlString FormatDateTime(DateTime? dateTime) + { + DateTime dateTimeValue = Convert.ToDateTime(dateTime); + TimeZoneInfo localTimeZone = TimeZoneInfo.Local; // Get local time zone + DateTime localTime = TimeZoneInfo.ConvertTimeFromUtc(dateTimeValue, localTimeZone); // Convert to local time + string time = (localTime.Hour, localTime.Minute) switch + { + (12, 0) => "Midday", + (0, 0) => "Midnight", + _ => localTime.ToString("h:mmtt").ToLower() + }; + + string date = localTime.ToString("d MMM yyyy"); + return new HtmlString($"{date}; {time}"); + } public static HtmlString FormatDateTime(DateTime? dateTime, string format ) { string date = Helper.GetLocalDateTime(dateTime, format); diff --git a/DVSRegister/Middleware/SecurityHeadersMiddleware.cs b/DVSRegister/Middleware/SecurityHeadersMiddleware.cs index 70d45a27..080aaf83 100644 --- a/DVSRegister/Middleware/SecurityHeadersMiddleware.cs +++ b/DVSRegister/Middleware/SecurityHeadersMiddleware.cs @@ -1,9 +1,11 @@ -namespace DVSRegister.Middleware +using Microsoft.AspNetCore.Html; + +namespace DVSRegister.Middleware { public class SecurityHeadersMiddleware { private readonly RequestDelegate _next; - private const string sources = "https://www.google-analytics.com https://ssl.google-analytics.com https://www.googletagmanager.com https://www.region1.google-analytics.com https://region1.google-analytics.com; "; + public SecurityHeadersMiddleware(RequestDelegate next) { _next = next; @@ -13,23 +15,30 @@ public async Task InvokeAsync(HttpContext context) { if (!context.Response.HasStarted) { - - context.Response.Headers["X-Frame-Options"] = "DENY"; + var nonce = Guid.NewGuid().ToString("N"); + context.Items["Nonce"] = nonce; + + context.Response.Headers["X-Frame-Options"] = "DENY"; context.Response.Headers["Cache-Control"] = "no-store, no-cache, must-revalidate, private"; context.Response.Headers["Pragma"] = "no-cache"; context.Response.Headers["Expires"] = "-1"; context.Response.Headers["Content-Security-Policy"] = - "script-src 'unsafe-inline' 'self' " + sources + "object-src 'none'; " + - "connect-src 'self' " + sources + - "img-src 'self' " + sources + - "style-src 'self'; " + - "base-uri 'self'; " + - "font-src 'self'; " + - "form-action 'self';"; + "base-uri 'none';" + + $"script-src 'nonce-{nonce}' 'unsafe-inline' 'strict-dynamic' https:; "; + } - + await _next(context); } + + + } + public static class SecurityContextExtensions + { + public static HtmlString GetScriptNonce(this HttpContext context) + { + return new HtmlString(Convert.ToString(context.Items["Nonce"])); + } } -} \ No newline at end of file +} diff --git a/DVSRegister/Models/CAB/Provider/CompanyViewModel.cs b/DVSRegister/Models/CAB/Provider/CompanyViewModel.cs index e665cac0..0fe2ca43 100644 --- a/DVSRegister/Models/CAB/Provider/CompanyViewModel.cs +++ b/DVSRegister/Models/CAB/Provider/CompanyViewModel.cs @@ -8,7 +8,7 @@ public class CompanyViewModel public int ProviderId { get; set; } [Required(ErrorMessage = "Enter the digital identity and attribute provider's registered name")] [MaximumLength(160, ErrorMessage = "The company's registered name must be less than 161 characters")] - [AcceptedCharacters(@"^[A-Za-z0-9 &@£$€¥#.,:;-]+$", ErrorMessage = "The company's registered name must contain only letters, numbers and accepted characters")] + [AcceptedCharacters(@"^[A-Za-zÀ-ž &@£$€¥(){}\[\]<>!«»“”'‘’?""/*=#%+0-9.,:;\\/-]+$", ErrorMessage = "The company's registered name must contain only letters, numbers and accepted characters.")] public string? RegisteredName { get; set; } public string? TradingName { get; set; } public bool? HasRegistrationNumber { get; set; } @@ -26,10 +26,12 @@ public class CompanyViewModel [RequiredIf("HasParentCompany",true, ErrorMessage = "Enter the registered name of your parent company")] [MaximumLength(160, ErrorMessage = "Your company's registered name must be less than 161 characters")] - [AcceptedCharacters(@"^[A-Za-z0-9 &@£$€¥#.,:;-]+$", ErrorMessage = "Your parent company's registered name must contain only letters, numbers and accepted characters.")] + [AcceptedCharacters(@"^[A-Za-zÀ-ž &@£$€¥(){}\[\]<>!«»“”'‘’?""/*=#%+0-9.,:;\\/-]+$", ErrorMessage = "Your parent company's registered name must contain only letters, numbers and accepted characters.")] public string? ParentCompanyRegisteredName { get; set; } [RequiredIf("HasParentCompany", true,ErrorMessage = "Enter the location of your parent company")] + [MaximumLength(160, ErrorMessage = "Your company's location must be less than 161 characters")] + [AcceptedCharacters(@"^[A-Za-z .,:-]+$", ErrorMessage = "Your parent company's location must contain only letters, numbers and accepted characters.")] public string? ParentCompanyLocation { get; set; } } } diff --git a/DVSRegister/Models/CAB/Provider/ProfileSummaryViewModel.cs b/DVSRegister/Models/CAB/Provider/ProfileSummaryViewModel.cs index 925006ba..af848e1d 100644 --- a/DVSRegister/Models/CAB/Provider/ProfileSummaryViewModel.cs +++ b/DVSRegister/Models/CAB/Provider/ProfileSummaryViewModel.cs @@ -7,7 +7,7 @@ public class ProfileSummaryViewModel { [Required(ErrorMessage = "Enter the digital identity and attribute provider's registered name")] [MaximumLength(160, ErrorMessage = "The company's registered name must be less than 161 characters")] - [AcceptedCharacters(@"^[A-Za-z0-9 &@£$€¥#.,:;-]+$", ErrorMessage = "The company's registered name must contain only letters, numbers and accepted characters")] + [AcceptedCharacters(@"^[A-Za-zÀ-ž &@£$€¥(){}\[\]<>!«»“”'‘’?""/*=#%+0-9.,:;\\/-]+$", ErrorMessage = "The company's registered name must contain only letters, numbers and accepted characters.")] public string? RegisteredName { get; set; } public string? TradingName { get; set; } @@ -29,10 +29,13 @@ public class ProfileSummaryViewModel [Required(ErrorMessage = "Enter the registered name of your parent company")] [MaximumLength(160, ErrorMessage = "Your company's registered name must be less than 161 characters")] - [AcceptedCharacters(@"^[A-Za-z0-9 &@£$€¥#.,:;-]+$", ErrorMessage = "Your parent company's registered name must contain only letters, numbers and accepted characters.")] + [AcceptedCharacters(@"^[A-Za-zÀ-ž &@£$€¥(){}\[\]<>!«»“”'‘’?""/*=#%+0-9.,:;\\/-]+$", ErrorMessage = "Your parent company's registered name must contain only letters, numbers and accepted characters.")] + public string? ParentCompanyRegisteredName { get; set; } [Required(ErrorMessage = "Enter the location of your parent company")] + [MaximumLength(160, ErrorMessage = "Your company's location must be less than 161 characters")] + [AcceptedCharacters(@"^[A-Za-z .,:-]+$", ErrorMessage = "Your parent company's location must contain only letters, numbers and accepted characters.")] public string? ParentCompanyLocation { get; set; } public PrimaryContactViewModel? PrimaryContact { get; set; } diff --git a/DVSRegister/Models/CAB/Service/ServiceSummaryViewModel.cs b/DVSRegister/Models/CAB/Service/ServiceSummaryViewModel.cs index 51ace03d..7f0b000e 100644 --- a/DVSRegister/Models/CAB/Service/ServiceSummaryViewModel.cs +++ b/DVSRegister/Models/CAB/Service/ServiceSummaryViewModel.cs @@ -10,7 +10,7 @@ public class ServiceSummaryViewModel [Required(ErrorMessage = "Enter the service name")] [MaximumLength(160, ErrorMessage = "The service name must be less than 161 characters.")] - [AcceptedCharacters(@"^[A-Za-z0-9 &@£$€¥#.,:;-]+$", ErrorMessage = "The service name must contain only letters, numbers and accepted characters.")] + [AcceptedCharacters(@"^[A-Za-z0-9 &@#().:-]+$", ErrorMessage = "The service name must contain only letters, numbers and accepted characters.")] public string? ServiceName { get; set; } [Required(ErrorMessage = "Enter the service website address")] diff --git a/DVSRegister/Program.cs b/DVSRegister/Program.cs index c815ca0d..f8727a14 100644 --- a/DVSRegister/Program.cs +++ b/DVSRegister/Program.cs @@ -51,7 +51,7 @@ app.UseMiddleware(); } -//app.UseMiddleware(); +app.UseMiddleware(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); diff --git a/DVSRegister/Validations/ValidationHelper.cs b/DVSRegister/Validations/ValidationHelper.cs new file mode 100644 index 00000000..7dc9727e --- /dev/null +++ b/DVSRegister/Validations/ValidationHelper.cs @@ -0,0 +1,30 @@ +namespace DVSRegister.Validations; + +using Microsoft.AspNetCore.Mvc.ModelBinding; + + +public class ValidationHelper +{ + public record FieldComparisonConfig( + string FirstFieldName, + string SecondFieldName, + string ErrorMessage + ); + + public static void ValidateDuplicateFields( + ModelStateDictionary modelState, + string? primaryValue, + string? secondaryValue, + FieldComparisonConfig config) + { + if (!string.IsNullOrEmpty(primaryValue) && + !string.IsNullOrEmpty(secondaryValue) && + primaryValue.Equals(secondaryValue, StringComparison.OrdinalIgnoreCase)) + { + modelState.AddModelError(config.SecondFieldName, config.ErrorMessage); + } + } + + + +} \ No newline at end of file diff --git a/DVSRegister/Views/Cab/ListProviders.cshtml b/DVSRegister/Views/Cab/ListProviders.cshtml index d1979d8b..95bd83ac 100644 --- a/DVSRegister/Views/Cab/ListProviders.cshtml +++ b/DVSRegister/Views/Cab/ListProviders.cshtml @@ -65,7 +65,7 @@ Registered name Trading name Services - Last updated + Last updated (UTC) @@ -96,7 +96,7 @@ - @item.LastUpdatedInfo.LastModifiedTime.ToString("dd MMM yyyy hh:mm tt") + @DateTimeExtensions.FormatDateTime(@item.LastUpdatedInfo.LastModifiedTime) diff --git a/DVSRegister/Views/Cab/ProviderOverview.cshtml b/DVSRegister/Views/Cab/ProviderOverview.cshtml index 7a919aa1..922ccc99 100644 --- a/DVSRegister/Views/Cab/ProviderOverview.cshtml +++ b/DVSRegister/Views/Cab/ProviderOverview.cshtml @@ -81,10 +81,10 @@
- Submission date + Submission date (UTC)
- @DateTimeExtensions.FormatDateTime(@item.CreatedTime, "dd MMM yyyy ; hh:mm tt") + @DateTimeExtensions.FormatDateTime(@item.CreatedTime)
diff --git a/DVSRegister/Views/Cab/ProviderServiceDetails.cshtml b/DVSRegister/Views/Cab/ProviderServiceDetails.cshtml index 6c0a7470..c23bf439 100644 --- a/DVSRegister/Views/Cab/ProviderServiceDetails.cshtml +++ b/DVSRegister/Views/Cab/ProviderServiceDetails.cshtml @@ -36,11 +36,13 @@
- Publication date + Publication date (UTC)
@if (@Model.PublishedTime != null) - @DateTimeExtensions.FormatDateTime(@Model.PublishedTime, "hh:mm tt; dd MMM yyyy") + { + @DateTimeExtensions.FormatDateTime(@Model.PublishedTime) + }
diff --git a/DVSRegister/Views/CabService/ServiceSummary.cshtml b/DVSRegister/Views/CabService/ServiceSummary.cshtml index e4498df7..4e0820a9 100644 --- a/DVSRegister/Views/CabService/ServiceSummary.cshtml +++ b/DVSRegister/Views/CabService/ServiceSummary.cshtml @@ -242,7 +242,7 @@

- @Model.FileName (Opens in a new tab) + @Model.FileName

diff --git a/DVSRegister/Views/Consent/ConsentError.cshtml b/DVSRegister/Views/Consent/ConsentError.cshtml new file mode 100644 index 00000000..7a859914 --- /dev/null +++ b/DVSRegister/Views/Consent/ConsentError.cshtml @@ -0,0 +1,24 @@ + +@{ + ViewData["Title"] = "Sorry, there is a problem with the service"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + +
+
+
+
+

Sorry, there is a problem with the service

+

+ Try again later. +

+

+ Your answer has not been saved. Follow the link you were sent via email and try and agree to publish your service details again. +

+

+ If you need further support, please contact digital.identity.register@dsit.gov.uk. +

+
+
+
+
diff --git a/DVSRegister/Views/Consent/ConsentErrorAlreadyAgreed.cshtml b/DVSRegister/Views/Consent/ConsentErrorAlreadyAgreed.cshtml new file mode 100644 index 00000000..d32210e2 --- /dev/null +++ b/DVSRegister/Views/Consent/ConsentErrorAlreadyAgreed.cshtml @@ -0,0 +1,24 @@ + +@{ + ViewData["Title"] = "You have already agreed to publish your service on the register"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + +
+
+
+
+

You have already agreed to publish your service on the registerd

+

+ You have already agreed to publish your service on the register of digital identity and attribute services and a confirmation email has been sent to you. +

+

+ You will receive an email confirming when your service has been published. This can take up to 5 working days. +

+

+ For further support or information, please contact digital.identity.register@dsit.gov.uk. +

+
+
+
+
diff --git a/DVSRegister/Views/Consent/ConsentErrorURLExpired.cshtml b/DVSRegister/Views/Consent/ConsentErrorURLExpired.cshtml new file mode 100644 index 00000000..dfc03f99 --- /dev/null +++ b/DVSRegister/Views/Consent/ConsentErrorURLExpired.cshtml @@ -0,0 +1,21 @@ + +@{ + ViewData["Title"] = "Your application has expired"; + Layout = "~/Views/Shared/_Layout.cshtml"; +} + +
+
+
+
+

Your application has expired

+

+ DSIT cannot publish your service on the register of digital identity and attribute services because your application has expired. +

+

+ For further support or information, please contact digital.identity.register@dsit.gov.uk. +

+
+
+
+
diff --git a/DVSRegister/Views/Consent/PartialViews/_ServiceDetailsView.cshtml b/DVSRegister/Views/Consent/PartialViews/_ServiceDetailsView.cshtml index 7ab94697..bd0ed9e1 100644 --- a/DVSRegister/Views/Consent/PartialViews/_ServiceDetailsView.cshtml +++ b/DVSRegister/Views/Consent/PartialViews/_ServiceDetailsView.cshtml @@ -97,21 +97,24 @@
} - @if (Model.ServiceIdentityProfileMapping != null) - { -
-
- GPG45 identity profiles -
-
+
+
+ GPG45 identity profiles +
+
+ @if (Model.ServiceIdentityProfileMapping != null && Model.ServiceIdentityProfileMapping.Any()) + { @foreach (var item in Model.ServiceIdentityProfileMapping) {
@item.IdentityProfile.IdentityProfileName
} -
-
- - } + } + else + { +
Not certified against GPG45
+ } + + @if (Model.HasSupplementarySchemes && Model.ServiceSupSchemeMapping != null) diff --git a/DVSRegister/Views/Login/MFARegistration.cshtml b/DVSRegister/Views/Login/MFARegistration.cshtml index 34772648..640bd6cc 100644 --- a/DVSRegister/Views/Login/MFARegistration.cshtml +++ b/DVSRegister/Views/Login/MFARegistration.cshtml @@ -48,7 +48,7 @@
0 ? "govuk-form-group--error" : "")"> @Html.ValidationMessageFor(m => m.MFACode, "", new { @class = "govuk-error-message" }) - @Html.TextBoxFor(m => m.MFACode, new { @class = "govuk-input", id = "mfacode", name = "mfa-code" }) + @Html.TextBoxFor(m => m.MFACode, new { @class = "govuk-input govuk-input--width-10", id = "mfacode", name = "mfa-code", @aria_describedby = "mfa-hint" })