Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging update #174

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
17116d0
Merge pull request #146 from LBHackney-IT/feature/hpt-297-spike
FaisalHackney Jul 24, 2024
cf88d13
Add HFSDatabaseObjects submodule for unit test database (#148)
adamtry Jul 25, 2024
3d4c12f
Load Cash File Entity Framework Rewrite (#149)
adamtry Jul 29, 2024
fea9dec
Speed up GenerateReportUseCase Tests (#150)
adamtry Jul 30, 2024
5318b17
Cut test times (#151)
adamtry Jul 30, 2024
7d52dd1
GetCashImport Procedure Test (#153)
adamtry Aug 2, 2024
b92e51e
trigger redeploy
adamtry Aug 9, 2024
f0da849
Merge pull request #157 from LBHackney-IT/trigger-redeploy
adamtry Aug 9, 2024
6c17794
wip
humulla Nov 6, 2024
afac969
wip
humulla Nov 6, 2024
54941e6
update TA endpoint
humulla Nov 13, 2024
e0ced2d
update column names
humulla Nov 13, 2024
b021c6d
update data type
humulla Nov 13, 2024
624482e
remove column from maTa
humulla Nov 13, 2024
7c7a932
fix enpoint
humulla Nov 13, 2024
7082f76
add more tests
humulla Nov 14, 2024
55d15ab
add if statement
humulla Nov 14, 2024
7e585c5
please work
humulla Nov 14, 2024
8daed3d
added key to table
humulla Nov 14, 2024
980721e
refactor code
humulla Nov 14, 2024
f974c2b
Readd filters
humulla Nov 14, 2024
e4264bb
action comments and more tests added1
humulla Nov 26, 2024
ccd934a
logging
humulla Nov 26, 2024
de64392
more pr comments
humulla Nov 27, 2024
c83ac79
move tests to correct place
humulla Nov 27, 2024
bd886ea
fix testes2
humulla Nov 27, 2024
f0dbc68
update field name
humulla Nov 28, 2024
24407f2
Merge pull request #159 from LBHackney-IT/update-hfs
humulla Nov 29, 2024
b6cffe6
change to fromQuery
humulla Dec 2, 2024
5381d64
add logging
humulla Dec 2, 2024
edc7dc9
more logging
humulla Dec 2, 2024
9283e23
split if statement
humulla Dec 2, 2024
460f6b6
trying to fix2
humulla Dec 2, 2024
ecaa07c
removed some logging
humulla Dec 2, 2024
7ab99ba
readded filters
humulla Dec 2, 2024
8900948
Merge pull request #160 from LBHackney-IT/update-hfs
humulla Dec 2, 2024
4445bda
save changes made to ispresent and isterminated
humulla Dec 3, 2024
5e94c9d
fix build
humulla Dec 3, 2024
d8504c3
update role
humulla Dec 3, 2024
d39b81d
remove filters
humulla Dec 3, 2024
6bbb4dc
added resource to new role
humulla Dec 3, 2024
1276f11
update permission
humulla Dec 3, 2024
551ca7c
create new lambda function for dynamodb stream
humulla Dec 3, 2024
88ca641
update logging
humulla Dec 3, 2024
84cd998
fixed build
humulla Dec 3, 2024
30c30ca
deserialize object
humulla Dec 4, 2024
75eee5d
aws conversion method
humulla Dec 4, 2024
1e5f4d3
IDynamodbContext
humulla Dec 4, 2024
0a383a0
more logging
humulla Dec 4, 2024
4c0bffc
created request object and tagref based on event values
humulla Dec 4, 2024
2abb7c6
more logging and call usecase
humulla Dec 4, 2024
e0a989c
more logging and call usecase
humulla Dec 4, 2024
566cc5d
more logging
humulla Dec 4, 2024
4b2d9bd
find tag ref
humulla Dec 4, 2024
1c08e81
Use serverless v4 to deploy
spikeheap Dec 4, 2024
ab28821
Remove deprecated version from docker-compose
spikeheap Dec 4, 2024
a58ad5e
Bump CircleCI orb versions
spikeheap Dec 4, 2024
fbd58a0
Update CI NodeJS to 20 (LTS)
spikeheap Dec 4, 2024
5729192
.NET 6 -> 8
spikeheap Dec 4, 2024
d9a8cbd
dotnet format
humulla Dec 4, 2024
b3f13eb
refactor
humulla Dec 5, 2024
c839840
refactor
humulla Dec 5, 2024
fe77f12
refactor
humulla Dec 5, 2024
c5dc3a1
change resource
humulla Dec 5, 2024
19503ee
update policy
humulla Dec 5, 2024
6d19c9d
update policy
humulla Dec 5, 2024
68ce418
update default date
humulla Dec 5, 2024
abee790
add logging
humulla Dec 5, 2024
384c5df
fix tests
humulla Dec 5, 2024
183f194
fix test2
humulla Dec 5, 2024
02f7828
extra condition for default date
humulla Dec 5, 2024
4ea1df6
default date
humulla Dec 5, 2024
482f4b7
readd filters
humulla Dec 5, 2024
7332a59
remove controller as it not needed
humulla Dec 5, 2024
1da159a
added comments
humulla Dec 5, 2024
d7be983
Define Serverless dependency versions
spikeheap Dec 9, 2024
7c106a5
added controller back in
humulla Dec 10, 2024
a8e770f
pr ready for review
humulla Dec 10, 2024
1ad1604
readded filters
humulla Dec 10, 2024
7e59df6
pr comment
humulla Dec 10, 2024
8b2b49b
refactor
humulla Dec 10, 2024
255b9ba
Merge pull request #161 from LBHackney-IT/update-hfs
humulla Dec 10, 2024
606654e
return not found if tag ref is null
humulla Dec 12, 2024
1e91a54
dotnet format
humulla Dec 12, 2024
88ee54d
add tests2
humulla Dec 18, 2024
893de72
split if function
humulla Dec 18, 2024
325175b
Merge pull request #167 from LBHackney-IT/update-ta-endpoint
humulla Dec 18, 2024
38b458d
Merge pull request #162 from LBHackney-IT/serverless4
spikeheap Jan 7, 2025
5cb3eed
Merge pull request #163 from LBHackney-IT/dotnet-upgrade
spikeheap Jan 8, 2025
956d126
🤦 Fix serverless deploy command
spikeheap Jan 8, 2025
164ccc1
Merge pull request #168 from LBHackney-IT/fix-serverless-command
spikeheap Jan 8, 2025
575fe88
🤦 Update all .Net refs to 8.0
spikeheap Jan 8, 2025
b3eac3f
Merge pull request #169 from LBHackney-IT/dotnet-8-fix
spikeheap Jan 14, 2025
443b430
Replacing CODEOWNERS
spikeheap Jan 27, 2025
1cbd805
Merge pull request #170 from LBHackney-IT/codeowners-2025
spikeheap Jan 27, 2025
e78a3f4
Update dev and staging lambda authorizer (#172)
LBHCallumM Mar 26, 2025
c57e557
Updated production authorizer ARN (#173)
adamtry Apr 1, 2025
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
35 changes: 15 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
version: 2.1

orbs:
aws-ecr: circleci/aws-ecr@3.0.0
aws-cli: circleci/aws-cli@0.1.9
aws-ecr: circleci/aws-ecr@9.3.7
aws-cli: circleci/aws-cli@5.1.1
aws_assume_role: lbh-hackit/[email protected]
node: circleci/[email protected]

executors:
docker-python:
Expand All @@ -14,7 +15,7 @@ executors:
- image: "hashicorp/terraform:light"
docker-dotnet:
docker:
- image: mcr.microsoft.com/dotnet/sdk:6.0
- image: mcr.microsoft.com/dotnet/sdk:8.0

references:
workspace_root: &workspace_root "~"
Expand Down Expand Up @@ -47,29 +48,20 @@ commands:
- *attach_workspace
- checkout
- setup_remote_docker
- run:
name: Install Node.js
command: |
curl -sL https://deb.nodesource.com/setup_18.x | bash -
apt-get update && apt-get install -y nodejs
- run:
name: Install serverless CLI
command: npm i -g serverless@^3
- run:
name: Install step function plugin
command: npm i serverless-step-functions
- node/install
- node/install-packages:
app-dir: HousingFinanceInterimApi
- run:
name: Build lambda
command: |
cd ./HousingFinanceInterimApi/
chmod +x ./build.sh
./build.sh
./build.sh
- run:
name: Deploy lambda
command: |
cd ./HousingFinanceInterimApi/
npm i serverless-associate-waf
sls deploy --stage <<parameters.stage>> --conceal
npx --yes serverless deploy --stage <<parameters.stage>> --conceal

jobs:
check-code-formatting:
Expand Down Expand Up @@ -127,7 +119,7 @@ jobs:
workflows:
check-and-deploy-development:
jobs:
- check-code-formatting
- check-code-formatting
- build-and-test:
context:
- api-nuget-token-context
Expand All @@ -141,11 +133,12 @@ workflows:
- deploy-to-development:
context:
- api-nuget-token-context
- "Serverless Framework"
requires:
- assume-role-development
- assume-role-development
filters:
branches:
only: development
only: development
check-and-deploy-staging-and-production:
jobs:
- build-and-test:
Expand All @@ -164,6 +157,7 @@ workflows:
- deploy-to-staging:
context:
- api-nuget-token-context
- "Serverless Framework"
requires:
- assume-role-staging
filters:
Expand All @@ -186,6 +180,7 @@ workflows:
- deploy-to-production:
context:
- api-nuget-token-context
- "Serverless Framework"
requires:
- permit-production-release
- assume-role-production
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "HFSDatabaseObjects"]
path = HFSDatabaseObjects
url = https://github.com/LBHackney-IT/HFSDatabaseObjects
27 changes: 0 additions & 27 deletions BaseApi.Tests/Properties/launchSettings.json

This file was deleted.

10 changes: 3 additions & 7 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# doc for this file https://help.github.com/articles/about-code-owners/
# This file specifies owners for pull request approval
# See https://help.github.com/articles/about-code-owners/

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.

* @FaisalHackney @Duslerke @LBHackney-IT/mtfh-finance
* @LBHackney-IT/housing-products
1 change: 1 addition & 0 deletions HFSDatabaseObjects
Submodule HFSDatabaseObjects added at 95a1e6
2 changes: 1 addition & 1 deletion HousingFinanceInterimApi.Tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0
FROM mcr.microsoft.com/dotnet/sdk:8.0

# disable microsoft telematry
ENV DOTNET_CLI_TELEMETRY_OPTOUT='true'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
<NoWarn>
CA1707 <!-- "Identifiers should not contain underscores" -->
</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,7 +18,7 @@
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Bogus" Version="25.0.4" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using AutoFixture;
using FluentAssertions;
using HousingFinanceInterimApi.V1.Boundary.Request;
using HousingFinanceInterimApi.V1.Controllers;
using HousingFinanceInterimApi.V1.UseCase.Interfaces;
using Microsoft.AspNetCore.Mvc;
using Moq;
using System.Threading.Tasks;
using Xunit;

namespace HousingFinanceInterimApi.Tests.V1.Controllers
{
public class TenancyAgreementControllerTests
{
private readonly TenancyAgreementController _classUnderTest;

private readonly Mock<IUpdateTAUseCase> _useCase;
private readonly Fixture _fixture = new Fixture();

public TenancyAgreementControllerTests()
{
_useCase = new Mock<IUpdateTAUseCase>();

_classUnderTest = new TenancyAgreementController(_useCase.Object);
}

[Fact]
public async Task UpdateTA_WhenValidRequest_ReturnsNoContent()
{
// Arrange
var query = _fixture.Create<string>();
var request = _fixture.Create<UpdateTARequest>();

// Act
var response = await _classUnderTest.DynamoDbStreamTrigger(query, request)
.ConfigureAwait(false);

// Assert
_useCase.Verify(x => x.ExecuteAsync(query, request), Times.Once);

response.Should().BeEquivalentTo(new NoContentResult());
}

[Fact]
public async Task ReturnBadRequestWhenNoTagRef()
{
// Arrange
var request = _fixture.Create<UpdateTARequest>();

// Act
var response = await _classUnderTest.DynamoDbStreamTrigger(null, request)
.ConfigureAwait(false);

// Assert

response.Should().BeEquivalentTo(new BadRequestObjectResult("No tagRef query parameter provided"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

namespace HousingFinanceInterimApi.Tests.V1.Infrastructure.DatabaseContext
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "This is a test class")]
public class AssetDetailsTests : IClassFixture<BaseContextTest>
{
private readonly HousingFinanceInterimApi.V1.Infrastructure.DatabaseContext _context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
using AutoFixture;
using Bogus;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;

namespace HousingFinanceInterimApi.Tests.V1.Infrastructure.DatabaseContext
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Security", "CA2100:Review SQL queries for security vulnerabilities", Justification = "This is a test class")]
public class DbConnectionException : Exception { public DbConnectionException(string message) : base(message) { } }

public class BaseContextTest : IDisposable
{
internal readonly HousingFinanceInterimApi.V1.Infrastructure.DatabaseContext _context;
internal readonly Fixture _fixture;
internal readonly Faker _faker;
internal List<Action> _cleanups;
private bool _disposed;

public BaseContextTest()
{
_context = CreateDbContext();
_fixture = new Fixture();
_faker = new Faker();
_cleanups = new List<Action>();
}

Expand All @@ -32,12 +34,12 @@ public void ExecuteProcedure(string procedureName)

private static HousingFinanceInterimApi.V1.Infrastructure.DatabaseContext CreateDbContext()
{
var connectionStringEnvVar = Environment.GetEnvironmentVariable("CONNECTION_STRING");
if (string.IsNullOrEmpty(connectionStringEnvVar))
throw new DbConnectionException("CONNECTION_STRING env var is not set");
// TODO: Implement a way to switch between SQL Server and Postgres
var Server = "127.0.0.1"; // TODO: Should fetch from env var when it has Docker support
var connectionString = $"Server={Server};Database=sow2b;User Id=sa;Password=password123!;";

var options = new DbContextOptionsBuilder<HousingFinanceInterimApi.V1.Infrastructure.DatabaseContext>()
.UseSqlServer(connectionStringEnvVar)
.UseSqlServer(connectionString)
.Options;

var context = new HousingFinanceInterimApi.V1.Infrastructure.DatabaseContext(options);
Expand All @@ -63,7 +65,10 @@ protected virtual void Dispose(bool disposing)
try
{
foreach (var cleanup in _cleanups)
{
cleanup();
_context.SaveChanges();
}
transaction.Commit();
}
catch (Exception)
Expand Down
Loading