Skip to content

Commit 2bcea68

Browse files
committed
Update dynamo DB logging and add typename
1 parent 717792a commit 2bcea68

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/repositories/file/DynamoDBRepository.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ class DynamoDBRepository implements FileRepository {
3333
ReturnConsumedCapacity: this.isDebugModeEnabled ? 'TOTAL' : 'NONE',
3434
});
3535

36-
const result = await this.dynamoDB.send(command);
36+
const response = await this.dynamoDB.send(command);
37+
38+
logger.silly(`${this.constructor.name}.get.response`, response);
39+
logger.debug(`${this.constructor.name}.get.consumedCapacity`, response.ConsumedCapacity);
3740

38-
const item = unmarshall(result.Item);
41+
const item = unmarshall(response.Item);
3942

4043
return item as LocalFile;
4144
}
@@ -47,6 +50,7 @@ class DynamoDBRepository implements FileRepository {
4750
id: uuidv4(),
4851
thumbnails: [],
4952
cacheable: false,
53+
typename: 'File',
5054
...params,
5155
createdAt: new Date().toISOString(),
5256
}
@@ -60,7 +64,8 @@ class DynamoDBRepository implements FileRepository {
6064

6165
const response = await this.dynamoDB.send(command);
6266

63-
logger.silly(`${this.constructor.name}.create.result`, response);
67+
logger.silly(`${this.constructor.name}.create.response`, response);
68+
logger.debug(`${this.constructor.name}.create.consumedCapacity`, response.ConsumedCapacity);
6469

6570
return item as LocalFile;
6671
}
@@ -87,7 +92,8 @@ class DynamoDBRepository implements FileRepository {
8792

8893
const response = await this.dynamoDB.send(command);
8994

90-
logger.silly(`${this.constructor.name}.find.result`, response);
95+
logger.silly(`${this.constructor.name}.find.response`, response);
96+
logger.debug(`${this.constructor.name}.find.consumedCapacity`, response.ConsumedCapacity);
9197

9298
return response.Responses[this.tableName].map(item => unmarshall(item)) as LocalFile[];
9399
}
@@ -128,6 +134,7 @@ class DynamoDBRepository implements FileRepository {
128134
const response = await this.dynamoDB.send(command);
129135

130136
logger.silly(`${this.constructor.name}.update.response`, response);
137+
logger.debug(`${this.constructor.name}.update.consumedCapacity`, response.ConsumedCapacity);
131138

132139
const item = unmarshall(response.Attributes);
133140

@@ -169,6 +176,7 @@ class DynamoDBRepository implements FileRepository {
169176
const response = await this.dynamoDB.send(command);
170177

171178
logger.silly(`${this.constructor.name}.delete.response`, response);
179+
logger.debug(`${this.constructor.name}.delete.consumedCapacity`, response.ConsumedCapacity);
172180

173181
if ('Item' in response === false) {
174182
return undefined;

0 commit comments

Comments
 (0)