LOC Loans

Storage

environment

table_name

location

test

test-loc-service

us-west-2

prod

prod-loc-service

us-east-2

Keys

  • PK - USER#<user_id>

  • SK - LOAN#<loan_id>

  • GSI1PK - USER#<user_id>#STATUS#<loan_status>

  • GSI1SK - LOAN#DATE#<created_date>#LOAN#<loan_id>

  • GSI2PK - USER#<user_id>

  • GSI2SK - LOAN#CREDITLINE#<line_id>#DATE#<created_date>#LOAN#<loan_id>

Query Patterns

Query Index Conditions SK

Get loan by user_id and loan_id

Primary

PK = USER#user_id

SK = LOAN#loan_id

List all loans for a given user_id and line_id

GSI2

GSI2PK = USER#user_id

GSI2SK begins with LOAN#CREDITLINE#line_id

List all loans for a given user and line_id in a given status

GSI2

GSI2PK = USER#user_id

GSI2SK begins with LOAN#CREDITLINE#line_id

List all loans for a given user and a given status

GSI1

GSI1PK = USER#user_id#STATUS#<status>

GSI1SK begins with LOAN