Skip to content

Commit 05538e6

Browse files
committed
refactor: updated shared resources and references to properties
1 parent 3db2f32 commit 05538e6

12 files changed

Lines changed: 33 additions & 17 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
**/.aws-sam/
44
*.DotSettings.user
55
.vscode/*
6-
UnicornProperties.sln.DotSettings.user
6+
UnicornApprovals.sln.DotSettings.user
77
**/cdk.out/
88
**/obj/**

Unicorn.Contracts/ContractsService.Test/ContractsService.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.1" />
11+
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
1212
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.1" />
13-
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
13+
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="3.0.0" />
1414
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.404.11" />
1515
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
1616
<PackageReference Include="NBuilder" Version="6.1.0" />

Unicorn.Contracts/ContractsService/ContractsService.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.1" />
13+
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
1414
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
1515
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.1" />
1616
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="2.0.0" />

Unicorn.Contracts/README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@
44

55
## Architecture overview
66

7-
Unicorn Contract manages the contractual relationship between the customers and the Unicorn Properties agency. It's primary function is to allow Unicorn Properties agents to create a new contract for a property listing, and to have the contract approved once it's ready.
7+
The **Unicorn Contracts** service manages contractual relationships between customers and Unicorn Properties agency. The service handles standard terms and conditions, property service rates, fees, and additional services.
88

9-
The architecture is fairly straight forward. An API exposes the create contract and update contract methods. This information is recorded in a Amazon DynamoDB table which will contain all latest information about the contract and it's status.
9+
Each property can have only one active contract. Properties use their address as a unique identifier instead of a GUID, which correlates across services.
1010

11-
Each time a new contract is created or updated, Unicorn Contracts publishes a `ContractStatusChanged` event to Amazon EventBridge signalling changes to the contract status. These events are consumed by **Unicorn Properties**, so it can track changes to contracts, without needing to take a direct dependency on Unicorn Contracts and it's database.
11+
For example: `usa/anytown/main-street/111`.
1212

13-
Here is an example of an event that is published to EventBridge:
13+
The contract workflow operates as follows:
14+
15+
1. Agents submit contract creation/update commands through the Contracts API
16+
1. The API sends requests to Amazon SQS
17+
1. A Contracts function processes the queue messages and updates Amazon DynamoDB
18+
1. DynamoDB Streams captures contract changes
19+
1. Amazon EventBridge Pipes transforms the DynamoDB records into ContractStatusChanged events
20+
1. Unicorn Approvals consumes these events to track contract changes without direct database dependencies
21+
22+
An example of `ContractStatusChanged` event:
1423

1524
```json
1625
{

Unicorn.Shared/uni-prop-namespaces.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Outputs:
3535
Description: Unicorn Contracts namespace parameter
3636
Value: !Ref UnicornContractsNamespaceParam
3737

38-
UnicornPropertiesNamespace:
38+
UnicornApprovalsNamespace:
3939
Description: Unicorn Properties namespace parameter
4040
Value: !Ref UnicornApprovalsNamespaceParam
4141

Unicorn.Web/ApprovalService.Tests/ApprovalService.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
<ItemGroup>
1212
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.1" />
13-
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.1" />
13+
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
1414
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.1" />
1515
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
16-
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
16+
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="3.0.0" />
1717
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.404.11" />
1818
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
1919
<PackageReference Include="NBuilder" Version="6.1.0" />

Unicorn.Web/ApprovalService/ApprovalService.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ItemGroup>
1212
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.1" />
1313
<PackageReference Include="Amazon.Lambda.CloudWatchEvents" Version="4.4.0" />
14-
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.1" />
14+
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
1515
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
1616
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="2.0.0" />
1717
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="2.0.0" />

Unicorn.Web/Common/Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<ItemGroup>
1212
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.1" />
1313
<PackageReference Include="Amazon.Lambda.CloudWatchEvents" Version="4.4.0" />
14-
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.1" />
14+
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
1515
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.404.11" />
1616
<PackageReference Include="AWSSDK.XRay" Version="3.7.401.102" />
1717
<PackageReference Include="AWSXRayRecorder.Handlers.AwsSdk" Version="2.13.0" />

Unicorn.Web/Integration/subscriptions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Resources:
2020
Name: unicorn.web-PublicationEvaluationCompleted
2121
Description: PublicationEvaluationCompleted subscription
2222
EventBusName:
23-
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornPropertiesEventBusArn}}"
23+
Fn::Sub: "{{resolve:ssm:/uni-prop/${Stage}/UnicornApprovalsEventBusArn}}"
2424
EventPattern:
2525
source:
2626
- "{{resolve:ssm:/uni-prop/UnicornApprovalsNamespace}}"

Unicorn.Web/SearchService.Tests/SearchService.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.1" />
12+
<PackageReference Include="Amazon.Lambda.Core" Version="2.6.0" />
1313
<PackageReference Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.1" />
14-
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
14+
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="3.0.0" />
1515
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.404.11" />
1616
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
1717
<PackageReference Include="NSubstitute" Version="5.3.0" />

0 commit comments

Comments
 (0)