mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Switched to bookshelf repository
This commit is contained in:
parent
4ffdab3c82
commit
2808df7f87
@ -1,7 +1,7 @@
|
||||
const {
|
||||
CollectionsService,
|
||||
CollectionsRepositoryInMemory
|
||||
CollectionsService
|
||||
} = require('@tryghost/collections');
|
||||
const BookshelfCollectionsRepository = require('./BookshelfCollectionsRepository');
|
||||
const labs = require('../../../shared/labs');
|
||||
|
||||
class CollectionsServiceWrapper {
|
||||
@ -9,9 +9,10 @@ class CollectionsServiceWrapper {
|
||||
api;
|
||||
|
||||
constructor() {
|
||||
const postsRepository = require('./PostsRepository').getInstance();
|
||||
const collectionsRepositoryInMemory = new CollectionsRepositoryInMemory();
|
||||
const DomainEvents = require('@tryghost/domain-events');
|
||||
const postsRepository = require('./PostsRepository').getInstance();
|
||||
const models = require('../../models');
|
||||
const collectionsRepositoryInMemory = new BookshelfCollectionsRepository(models.Collection);
|
||||
|
||||
const collectionsService = new CollectionsService({
|
||||
collectionsRepository: collectionsRepositoryInMemory,
|
||||
@ -19,7 +20,7 @@ class CollectionsServiceWrapper {
|
||||
DomainEvents: DomainEvents,
|
||||
slugService: {
|
||||
async generate(input) {
|
||||
return input.toLowerCase().trim().replace(/^[^a-z0-9A-Z_]+/, '').replace(/[^a-z0-9A-Z_]+$/, '').replace(/[^a-z0-9A-Z_]+/g, '-');
|
||||
return models.Collection.generateSlug(models.Collection, input, {});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -88,6 +88,7 @@ describe('Posts API', function () {
|
||||
let agent;
|
||||
|
||||
before(async function () {
|
||||
mockManager.mockLabsEnabled('collections', true);
|
||||
agent = await agentProvider.getAdminAPIAgent();
|
||||
await fixtureManager.init('posts');
|
||||
await agent.loginAsOwner();
|
||||
|
Loading…
Reference in New Issue
Block a user