mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added getAll method to BookshelfMentionRepository
This is necessary to support the getMentionReport method in MentionsAPI
This commit is contained in:
parent
0262083bb0
commit
018e2654c5
1 changed files with 11 additions and 0 deletions
|
@ -12,6 +12,7 @@ const logging = require('@tryghost/logging');
|
|||
|
||||
/**
|
||||
* @typedef {import('@tryghost/webmentions/lib/MentionsAPI').GetPageOptions} GetPageOptions
|
||||
* @typedef {import('@tryghost/webmentions/lib/MentionsAPI').GetAllOptions} GetAllOptions
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -84,6 +85,16 @@ module.exports = class BookshelfMentionRepository {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GetAllOptions} options
|
||||
* @returns {Promise<import('@tryghost/webmentions/lib/Mention')[]>}
|
||||
*/
|
||||
async getAll(options) {
|
||||
const models = await this.#MentionModel.findAll(options);
|
||||
|
||||
return await Promise.all(models.map(model => this.#modelToMention(model)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {URL} source
|
||||
* @param {URL} target
|
||||
|
|
Loading…
Add table
Reference in a new issue