From 382d7fa25f1f722a3e2ef96d871d405b3844d7ca Mon Sep 17 00:00:00 2001 From: Naz Date: Fri, 14 Jul 2023 14:08:58 +0800 Subject: [PATCH] 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 --- .../PostsDataRepositoryBookshelf.js | 23 ------------------- .../PostsDataRepositoryBookshelf.test.ts | 23 ------------------- 2 files changed, 46 deletions(-) delete mode 100644 ghost/core/core/server/services/collections/PostsDataRepositoryBookshelf.js delete mode 100644 ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts diff --git a/ghost/core/core/server/services/collections/PostsDataRepositoryBookshelf.js b/ghost/core/core/server/services/collections/PostsDataRepositoryBookshelf.js deleted file mode 100644 index 962db53bd5..0000000000 --- a/ghost/core/core/server/services/collections/PostsDataRepositoryBookshelf.js +++ /dev/null @@ -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} - **/ - async getBulk(ids) { - return await this.Post.fetchAll({ - filter: `id:[${ids.join(',')}]` - }); - } -} - -module.exports = PostsDataRepositoryBookshelf; diff --git a/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts b/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts deleted file mode 100644 index 13fe5ce69c..0000000000 --- a/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts +++ /dev/null @@ -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); - }); -});