Removed unnecessary getBulk
in PostsRepository
refs https://github.com/TryGhost/Arch/issues/16 - The method ended up being used only once, so it makes no sense to complicate the interface without any gain.
This commit is contained in:
parent
8635f4efeb
commit
fe4c0b18cf
@ -105,7 +105,6 @@ type QueryOptions = {
|
||||
|
||||
interface PostsRepository {
|
||||
getAll(options: QueryOptions): Promise<CollectionPost[]>;
|
||||
getBulk(ids: string[], transaction?: Knex.Transaction): Promise<CollectionPost[]>;
|
||||
}
|
||||
|
||||
export class CollectionsService {
|
||||
@ -392,8 +391,10 @@ export class CollectionsService {
|
||||
}
|
||||
|
||||
async updatePostsInCollections(postIds: string[], collections: Collection[], transaction: Knex.Transaction) {
|
||||
const posts = await this.postsRepository.getBulk(postIds, transaction);
|
||||
|
||||
const posts = await this.postsRepository.getAll({
|
||||
filter: `id:[${postIds.join(',')}]`,
|
||||
transaction: transaction
|
||||
});
|
||||
|
||||
for (const collection of collections) {
|
||||
for (const post of posts) {
|
||||
|
@ -10,10 +10,4 @@ export class PostsRepositoryInMemory extends InMemoryRepository<string, Collecti
|
||||
tags: entity.tags.map(tag => tag.slug)
|
||||
};
|
||||
}
|
||||
|
||||
async getBulk(ids: string[]) {
|
||||
return this.getAll({
|
||||
filter: `id:[${ids.join(',')}]`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user