Skip to content

Commit

Permalink
fix: lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
SajidHamza9 authored and MarioArnt committed Jan 30, 2024
1 parent 7c5d948 commit e52a163
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/base-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,15 +609,13 @@ export default abstract class Model<T> {
* @returns the result of the batch write operation.
*/
async batchWrite(items: { put: T[], delete: Keys | T[] }, options?: Partial<BatchWriteCommandInput>): Promise<BatchWriteCommandOutput[]> {
const writeRequests: any[] = [];
let output: BatchWriteCommandOutput[];
let params: BatchWriteCommandInput;
if (!this.tableName) {
throw new Error('Table name is not defined on your model');
}
if (!this.pk) {
throw new Error('Primary key is not defined on your model');
}
const writeRequests: any[] = [];
//Building put requests
items.put.forEach(item => {
if (!this.isValidItem(item)) {
Expand Down Expand Up @@ -666,7 +664,8 @@ export default abstract class Model<T> {
// Split the array of operations into batches of 25
const batches = this.splitBatch(writeRequests, 25);
//Make one BatchWrite request for every batch of 25 operations
output = await Promise.all(
let params: BatchWriteCommandInput;
const output: BatchWriteCommandOutput[] = await Promise.all(
batches.map(batch => {
params = {
RequestItems: {
Expand Down

0 comments on commit e52a163

Please sign in to comment.