2023-06-01 14:16:24 +03:00
|
|
|
import {InMemoryRepository} from '@tryghost/in-memory-repository';
|
|
|
|
|
|
|
|
type CollectionPost = {
|
|
|
|
id: string;
|
2023-06-05 12:22:51 +03:00
|
|
|
slug: string;
|
2023-06-01 14:16:24 +03:00
|
|
|
featured: boolean;
|
|
|
|
published_at: Date;
|
|
|
|
deleted: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export class PostsRepositoryInMemory extends InMemoryRepository<string, CollectionPost> {
|
|
|
|
protected toPrimitive(entity: CollectionPost): object {
|
|
|
|
return {
|
|
|
|
id: entity.id,
|
2023-06-05 12:22:51 +03:00
|
|
|
slug: entity.slug,
|
2023-06-01 14:16:24 +03:00
|
|
|
featured: entity.featured,
|
|
|
|
published_at: entity.published_at
|
|
|
|
};
|
|
|
|
}
|
2023-06-13 09:50:27 +03:00
|
|
|
|
|
|
|
getBulk(ids: string[]): Promise<CollectionPost[]> {
|
|
|
|
return this.getAll({
|
|
|
|
filter: `id:[${ids.join(',')}]`
|
|
|
|
});
|
|
|
|
}
|
2023-06-01 14:16:24 +03:00
|
|
|
}
|