2023-06-01 14:16:24 +03:00
|
|
|
import {InMemoryRepository} from '@tryghost/in-memory-repository';
|
2023-07-27 16:03:14 +03:00
|
|
|
import {CollectionPost} from '../../src/CollectionPost';
|
2023-06-01 14:16:24 +03:00
|
|
|
|
2023-07-27 16:03:14 +03:00
|
|
|
export class PostsRepositoryInMemory extends InMemoryRepository<string, CollectionPost & {deleted: false}> {
|
2023-06-01 14:16:24 +03:00
|
|
|
protected toPrimitive(entity: CollectionPost): object {
|
|
|
|
return {
|
|
|
|
id: entity.id,
|
|
|
|
featured: entity.featured,
|
2023-07-27 16:03:14 +03:00
|
|
|
published_at: entity.published_at,
|
|
|
|
tags: entity.tags.map(tag => tag.slug)
|
2023-06-01 14:16:24 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|