Skip to content

Commit

Permalink
starting to resolve lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vsun757 committed Feb 26, 2024
1 parent 2c2f67f commit fe8027d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 40 deletions.
7 changes: 6 additions & 1 deletion app/repository/collection-index-repository.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
const CollectionIndex = require('../models/collection-index-model');
class CollectionIndexRepository {

constructor(model) {
this.model = model;
}

}
module.exports = CollectionIndexRepository;
module.exports = CollectionIndexRepository(CollectionIndex);
64 changes: 26 additions & 38 deletions app/services/collection-indexes-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ class CollectionIndexService {


async retrieveAll(options) {
try {
const collectionIndexes = await CollectionIndex.find()
.skip(options.offset)
.limit(options.limit)
.lean()
.exec();

return collectionIndexes;
} catch (err) {
throw err;
}
};
const collectionIndexes = await CollectionIndex.find()
.skip(options.offset)
.limit(options.limit)
.lean()
.exec();

return collectionIndexes;
}


async retrieveById(id) {
Expand All @@ -60,7 +56,7 @@ class CollectionIndexService {
throw err;
}
}
};
}


async create(data) {
Expand All @@ -85,7 +81,7 @@ class CollectionIndexService {
throw err;
}
}
};
}


async updateFull(id, data) {
Expand Down Expand Up @@ -117,24 +113,20 @@ class CollectionIndexService {
throw err;
}
}
};
}


async delete(id) {
try {
if (!id) {
const error = new Error(this.errors.missingParameter);
error.parameterName = 'id';
throw error;
}

const collectionIndex = await CollectionIndex.findOneAndRemove({ "collection_index.id": id });

return collectionIndex; // Note: collectionIndex is null if not found
} catch (err) {
throw err;
if (!id) {
const error = new Error(this.errors.missingParameter);
error.parameterName = 'id';
throw error;
}
};

const collectionIndex = await CollectionIndex.findOneAndRemove({ "collection_index.id": id });

return collectionIndex; // Note: collectionIndex is null if not found
}


/**
Expand Down Expand Up @@ -171,21 +163,17 @@ class CollectionIndexService {
throw err;
}
}
};
}


async refresh(id) {
try {
// Do nothing for now
await new Promise(resolve => process.nextTick(resolve));
return {};
} catch (err) {
throw err;
}
};

// Do nothing for now
await new Promise(resolve => process.nextTick(resolve));
return {};
}

}



module.exports = new CollectionIndexService(null, CollectionIndexRepository);

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fe8027d

Please sign in to comment.