mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Imported Bookshelf type into plugin JSDocs
no issue - the `Bookshelf` type wasn't being imported anywhere and editors were showing warnings for the missing type - also fixes use of `Bookshelf.Model` - this doesn't work if we declare `Bookshelf` using a `@typedef` and the preferred syntax is using an array index - note: it still complains because we're calling functions that are only declared in our custom Bookshelf Model but this is a step in the right direction
This commit is contained in:
parent
de9960fc45
commit
0cd9acabec
@ -3,6 +3,9 @@ const Promise = require('bluebird');
|
||||
const _ = require('lodash');
|
||||
const errors = require('@tryghost/errors');
|
||||
|
||||
/**
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
module.exports = function (Bookshelf) {
|
||||
const ParentModel = Bookshelf.Model;
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
const customQueryPlug = function customQueryPlug(Bookshelf) {
|
||||
const Model = Bookshelf.Model.extend({
|
||||
// override this on the model itself
|
||||
|
@ -47,6 +47,7 @@ function load(options) {
|
||||
* a join to "eager loaded" relation. An exaple of such loading is when
|
||||
* there is a need to order by fields in the related table.
|
||||
*
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
module.exports = function eagerLoadPlugin(Bookshelf) {
|
||||
const modelPrototype = Bookshelf.Model.prototype;
|
||||
|
@ -80,6 +80,9 @@ const EXPANSIONS = {
|
||||
}]
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
const filter = function filter(Bookshelf) {
|
||||
const Model = Bookshelf.Model.extend({
|
||||
// Cached copy of the filters setup for this model instance
|
||||
|
@ -22,6 +22,9 @@ const addHasPostsWhere = (tableName, config) => {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
const hasPosts = function hasPosts(Bookshelf) {
|
||||
const modelPrototype = Bookshelf.Model.prototype;
|
||||
|
||||
|
@ -2,6 +2,9 @@ const _debug = require('ghost-ignition').debug._base;
|
||||
const debug = _debug('ghost-query');
|
||||
const _ = require('lodash');
|
||||
|
||||
/**
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
module.exports = function (Bookshelf) {
|
||||
const modelProto = Bookshelf.Model.prototype;
|
||||
const countQueryBuilder = {
|
||||
|
@ -1,5 +1,8 @@
|
||||
const _ = require('lodash');
|
||||
|
||||
/**
|
||||
* @param {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
const orderPlugin = function orderPlugin(Bookshelf) {
|
||||
Bookshelf.Model = Bookshelf.Model.extend({
|
||||
orderAttributes() {},
|
||||
|
@ -99,7 +99,7 @@ paginationUtils = {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Bookshelf.Model} model instance of Bookshelf model
|
||||
* @param {Bookshelf['Model']} model instance of Bookshelf model
|
||||
* @param {string} propertyName property to be inspected and included in the relation
|
||||
*/
|
||||
handleRelation: function handleRelation(model, propertyName) {
|
||||
@ -268,6 +268,10 @@ const pagination = function pagination(bookshelf) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {import('bookshelf')} Bookshelf
|
||||
*/
|
||||
|
||||
/**
|
||||
* ## Export pagination plugin
|
||||
* @api public
|
||||
|
Loading…
Reference in New Issue
Block a user