Skip to content

Commit 173b11b

Browse files
committed
chore: updated contracts readme
1 parent c20cf8b commit 173b11b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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
{

0 commit comments

Comments
 (0)