Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ea6c755
First pass at gateway
Jan 26, 2026
6077bcf
Merge branch 'main' into feature/gateway
Feb 2, 2026
ca9fcfe
Merge branch 'main' into feature/gateway
Feb 4, 2026
253d911
Update to first go at testing
Feb 10, 2026
2e58db3
Reapply "Update from main"
Feb 10, 2026
c345717
Add escape for gateway/complete
Feb 10, 2026
9acda48
Merge branch 'main' into feature/gateway
Feb 10, 2026
98d5895
Include create script
Feb 10, 2026
ce023eb
Add no conflict, and comment out droptables
Feb 10, 2026
667d106
Move options centrally, introduce Gov.Notify
Feb 10, 2026
deee504
Merge branch 'main' into feature/gateway
Feb 11, 2026
ff8e156
Include app secrets
Feb 11, 2026
f8a273a
Merge branch 'main' into feature/gateway
Feb 11, 2026
cf645b7
Unbind tf boolean
Feb 11, 2026
80f62c4
Better logging on Email
Feb 11, 2026
f4d383b
Add logging to EmailService
Feb 11, 2026
f9c1d2c
Fix key references
Feb 11, 2026
b59e16d
Enforce gateway day expiry from KeyVault
Feb 12, 2026
89c4dc0
WIP update.
Mar 11, 2026
18af5f0
Migrate gateway to new data access methods
Mar 11, 2026
e2cdb82
Working updated
Mar 12, 2026
0e48739
Update content from team
Mar 12, 2026
b12402e
Update text from Joe
Mar 13, 2026
385caab
Remove seed from manual deploy
Mar 13, 2026
64243c0
Merge branch 'main' into feature/gateway
Mar 13, 2026
5d33dfe
Update from main
Mar 13, 2026
e86d75b
Update to include back and some refactor
Mar 17, 2026
f8c9a65
Merge branch 'main' into feature/gateway
Mar 17, 2026
a2554d6
Fix addition of new KeyVault key
Mar 17, 2026
abf9f75
Update pipeline to run directly
Mar 17, 2026
61c7b56
Comment out second upload, introduce optional backup that isn't neede…
Mar 17, 2026
c7bc0f2
Correct logic
Mar 17, 2026
271c838
Update changes from ticket
Mar 26, 2026
1eb118e
Minor fixes
Mar 26, 2026
b12052d
Merge from main
Mar 26, 2026
8a611c7
Restore yml to sync with main
Mar 26, 2026
08dafb0
Attempt to make the pipeline work
Mar 26, 2026
e91b2a2
Update pipeline to pass in variables and fix email root
Mar 26, 2026
669adaa
Merge branch 'main' into feature/gateway
Mar 30, 2026
d669ecd
Merge main and update list of LAs
Mar 30, 2026
2113bbd
Merge branch 'main' into feature/gateway
Apr 1, 2026
143e1ff
Update to include tests, merge from main, and add helpful sql scripts.
Apr 1, 2026
45c502a
Update export gateway script
Apr 1, 2026
a509a39
Include some test data for ITHC
Apr 2, 2026
8f0d5a3
Merge from main
Apr 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -515,3 +515,6 @@ SAPPub.Web/keys/*
/SAPData/DataMap/CleanedFiles/*.csv
/SAPData/DataMap/SourceFiles/*.csv
/SAPData/Sql/tablemapping.csv

#exclude any reporting csvs
/scripts/output/*.csv
70 changes: 70 additions & 0 deletions SAPData/Sql/05_gateway.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
-- ================================================================
-- 05_gateway.sql
-- Tables for the gateway service
-- ================================================================

DROP TABLE IF EXISTS public.gateway_user CASCADE;
DROP TABLE IF EXISTS public.gateway_user_audit CASCADE;
DROP TABLE IF EXISTS public.gateway_page_view_audit CASCADE;
DROP TABLE IF EXISTS public.gateway_local_authority CASCADE;
DROP TABLE IF EXISTS public.gateway_settings CASCADE;

CREATE TABLE IF NOT EXISTS public.gateway_user
(
"Id" uuid NOT NULL,
"EmailAddress" text COLLATE pg_catalog."default",
"LocalAuthorityId" uuid NOT NULL,
"CookiePrefs" boolean,
"TimerStartedOn" timestamp without time zone NOT NULL,
"CreatedOn" timestamp without time zone,
"ModifiedOn" timestamp without time zone,
"AuditIPAddress" text COLLATE pg_catalog."default",
"IsDeleted" boolean,
CONSTRAINT gateway_user_pkey PRIMARY KEY ("Id")
);

CREATE TABLE IF NOT EXISTS public.gateway_user_audit
(
"Id" uuid NOT NULL,
"UserId" uuid NOT NULL,
"LoginDateTime" timestamp without time zone,
"UserAction" text not null,
"CreatedOn" timestamp without time zone,
"ModifiedOn" timestamp without time zone,
"AuditIPAddress" text COLLATE pg_catalog."default",
"IsDeleted" boolean,
CONSTRAINT gateway_user_audit_pkey PRIMARY KEY ("Id")
);

CREATE TABLE IF NOT EXISTS public.gateway_local_authority
(
"Id" uuid NOT NULL,
"LocalAuthorityName" text COLLATE pg_catalog."default",
"MaxSessions" integer,
"CreatedOn" timestamp without time zone,
"ModifiedOn" timestamp without time zone,
"AuditIPAddress" text COLLATE pg_catalog."default",
"IsDeleted" boolean,
CONSTRAINT gateway_local_authority_pkey PRIMARY KEY ("Id"),
CONSTRAINT gateway_local_authority_unique_name UNIQUE ("LocalAuthorityName")
);


CREATE TABLE IF NOT EXISTS public.gateway_settings
(
"Id" uuid NOT NULL,
"SettingName" text COLLATE pg_catalog."default",
"SettingValue" text COLLATE pg_catalog."default",
"CreatedOn" timestamp without time zone,
"ModifiedOn" timestamp without time zone,
"AuditIPAddress" text COLLATE pg_catalog."default",
"IsDeleted" boolean,
CONSTRAINT gateway_global_settings_pkey PRIMARY KEY ("Id"),
CONSTRAINT gateway_global_settings_unique_name UNIQUE ("SettingName")
);

INSERT INTO public.gateway_settings(
"Id", "SettingName", "SettingValue", "CreatedOn", "ModifiedOn", "AuditIPAddress", "IsDeleted")
VALUES (gen_random_uuid(), 'GlobalEnable', 'true', now(), now(), '::1', FALSE)
ON CONFLICT ("SettingName") DO NOTHING;

1 change: 1 addition & 0 deletions SAPData/Sql/run_all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
\ir 03_v_la_subject_entries.sql
\ir 03_v_la_urls.sql
\ir 04_indexes.sql
\ir 05_gateway.sql
--\ir 05_validation.sql


Expand Down
9 changes: 9 additions & 0 deletions SAPPub.Core/Entities/Configuration/EmailOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace SAPPub.Web.Models.Config
{
public class EmailOptions
{
public string ApiKey { get; set; } = string.Empty;
public string GatewayTemplate { get; set; } = string.Empty;
public string ApplicationRoot { get; set; } = string.Empty;
}
}
8 changes: 8 additions & 0 deletions SAPPub.Core/Entities/Configuration/GatewayOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace SAPPub.Web.Models.Config
{
public class GatewayOptions
{
public bool Enabled { get; set; }
public int AllowedDays { get; set; }
}
}
14 changes: 14 additions & 0 deletions SAPPub.Core/Entities/Gateway/GatewayLocalAuthority.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Entities.Gateway
{
public class GatewayLocalAuthority : GatewayMetadata
{
public string LocalAuthorityName { get; set; } = string.Empty;
public int MaxSessions { get; set; }
}
}
16 changes: 16 additions & 0 deletions SAPPub.Core/Entities/Gateway/GatewayMetadata.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Entities.Gateway
{
public class GatewayMetadata
{
public Guid Id { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime ModifiedOn { get; set; }
public bool IsDeleted { get; set; }
}
}
14 changes: 14 additions & 0 deletions SAPPub.Core/Entities/Gateway/GatewaySettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Entities.Gateway
{
public class GatewaySettings
{
public string SettingName { get; set; } = string.Empty;
public string SettingValue { get; set; } = string.Empty;
}
}
16 changes: 16 additions & 0 deletions SAPPub.Core/Entities/Gateway/GatewayUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Entities.Gateway
{
public class GatewayUser : GatewayMetadata
{
public string EmailAddress { get; set; } = string.Empty;
public Guid LocalAuthorityId { get; set; }
public bool CookiePrefs { get; set; }
public DateTime TimerStartedOn { get; set; }
}
}
15 changes: 15 additions & 0 deletions SAPPub.Core/Entities/Gateway/GatewayUserAudit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Entities.Gateway
{
public class GatewayUserAudit : GatewayMetadata
{
public Guid UserId { get; set; }
public DateTime LoginDateTime { get; set; }
public string UserAction { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Repositories.Gateway
{
public interface IGatewayLocalAuthorityRepository
{
Task<GatewayLocalAuthority?> GetByIdAsync(Guid id, CancellationToken ct = default);
Task<IEnumerable<GatewayLocalAuthority>> GetAllAsync(CancellationToken ct = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SAPPub.Core.Entities.Gateway;
using SAPPub.Core.Interfaces.Repositories.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Repositories.Gateway
{
public interface IGatewaySettingsRepository : IGenericRepository<GatewaySettings>
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Repositories.Gateway
{
public interface IGatewayUserAuditRepository
{
Task<bool> InsertAsync(GatewayUserAudit user);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Repositories.Gateway
{
public interface IGatewayUserRepository
{
Task<bool> InsertAsync(GatewayUser user);
Task<GatewayUser?> GetByIdAsync(Guid id, CancellationToken ct = default);
Task<IEnumerable<GatewayUser>> GetAllAsync(CancellationToken ct = default);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ public interface IGenericRepository<T>
Task<T?> ReadSingleAsync(object parameters, CancellationToken ct = default);
Task<IEnumerable<T>> ReadManyAsync(object parameters, CancellationToken ct = default);
Task<IEnumerable<T>> ReadPageAsync(int page, int take, CancellationToken ct = default);
Task<bool> WriteAsync(object? writeObject, CancellationToken ct = default);
Task<bool> UpdateAsync(object? updateObject, CancellationToken ct = default);
}
}
13 changes: 13 additions & 0 deletions SAPPub.Core/Interfaces/Repositories/IEmailRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Repositories
{
public interface IEmailRepository
{
void SendGatewayEmail(string emailAddress, string localAuthorityName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Services.Gateway
{
public interface IGatewayLocalAuthorityService
{
Task<GatewayLocalAuthority?> GetByName(string laName);
Task<GatewayLocalAuthority?> GetById(Guid Id);

}
}
14 changes: 14 additions & 0 deletions SAPPub.Core/Interfaces/Services/Gateway/IGatewaySettingsService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Services.Gateway
{
public interface IGatewaySettingsService
{
Task<bool> IsServiceLive();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Services.Gateway
{
public interface IGatewayUserAuditService
{
void Insert(Guid userId, string action);
}
}
14 changes: 14 additions & 0 deletions SAPPub.Core/Interfaces/Services/Gateway/IGatewayUserLAService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Services.Gateway
{
public interface IGatewayUserLAService
{
Task<bool> CanRegisterNewUsers(Guid laId);
}
}
18 changes: 18 additions & 0 deletions SAPPub.Core/Interfaces/Services/Gateway/IGatewayUserService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using SAPPub.Core.Entities.Gateway;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Services.Gateway
{
public interface IGatewayUserService
{
Task<IEnumerable<GatewayUser>> GetAllAsync();
Task<GatewayUser?> GetByEmailAsync(string email);
Task<GatewayUser?> GetById(Guid id);
Task<Guid> InsertAsync(GatewayUser user);
Task<bool> IsUserExpiredAsync(Guid id);
}
}
13 changes: 13 additions & 0 deletions SAPPub.Core/Interfaces/Services/IEmailService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SAPPub.Core.Interfaces.Services
{
public interface IEmailService
{
void SendGatewayEmail(string emailAddress, string localAuthorityName);
}
}
2 changes: 2 additions & 0 deletions SAPPub.Core/SAPPub.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<ItemGroup>
<PackageReference Include="IeuanWalker.GeoUK" Version="1.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
</ItemGroup>

</Project>
Loading
Loading