Removed unused collections repositories

no issue

- These repositories were leftover from first phases of collections development. Not needed any longer as we have more specialized bookshelf repositories in the core code
This commit is contained in:
Naz 2023-07-14 14:08:58 +08:00 committed by naz
parent 25fb1c43c2
commit 382d7fa25f
2 changed files with 0 additions and 46 deletions

View File

@ -1,23 +0,0 @@
class PostsDataRepositoryBookshelf {
Post;
/**
* @param {Object} deps
* @param {import('../../models/post')} deps.Post
*/
constructor(deps) {
this.Post = deps.Post;
}
/**
* @param {string[]} ids
* @returns {Promise<import('../../models/post')>}
**/
async getBulk(ids) {
return await this.Post.fetchAll({
filter: `id:[${ids.join(',')}]`
});
}
}
module.exports = PostsDataRepositoryBookshelf;

View File

@ -1,23 +0,0 @@
const sinon = require('sinon');
const assert = require('assert/strict');
const {PostsDataRepositoryBookshelf} = require('../../../../../core/server/services/collections/PostsDataRepositoryBookshelf');
describe('PostsDataRepositoryBookshelf', function () {
let Post;
beforeEach(async function () {
Post = {
fetchAll: sinon.stub().resolves([])
};
});
it('Can fetch posts by ids', async function () {
const repository = new PostsDataRepositoryBookshelf({
Post: Post
});
await repository.getBulk(['1', '2']);
assert.ok(Post.fetchAll.calledOnce);
});
});