Skip to content

Commit ffbdf54

Browse files
committed
Added code sample
1 parent b293196 commit ffbdf54

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,22 @@ export interface Order {
124124
}
125125
```
126126

127-
I had to write a few converter functions to map a Typescript object into a DynamoDB item and viceversa. An example of the Customer object being converted to a DynamoDB item is the following:
127+
I had to write a few converter functions to map a domain model object into a DynamoDB item and viceversa. An example of the _Customer_ object being converted to a DynamoDB item is the following:
128128

129129
```js
130+
interface DynamoDBItem {
131+
pk: string;
132+
sk: string;
133+
type: string;
134+
}
135+
136+
export interface CustomerDynamoDBItem extends DynamoDBItem {
137+
name: string;
138+
lastName: string;
139+
isPrime: boolean;
140+
address: any;
141+
}
142+
130143
function toItem(customer: Customer): CustomerDynamoDBItem {
131144
return {
132145
pk: `Customer#${customer.customerId}`,

0 commit comments

Comments
 (0)