0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Fixed Offer entity types in OfferBookshelfRepository

JSDoc has a problem with using values as types across repositories, rather than
getting `Offer` as the type we end up with `typeof Offer` as the type - which is
incorrect. Instead we use `import` syntax inside of JSDoc which resolves correctly
This commit is contained in:
Fabien "egg" O'Carroll 2023-09-01 13:24:46 +07:00 committed by Fabien 'egg' O'Carroll
parent 127c61d4c6
commit 84e6026408

View file

@ -91,7 +91,7 @@ class OfferBookshelfRepository {
* @private
* @param {import('bookshelf').Model<any>} model
* @param {BaseOptions} options
* @returns {Promise<Offer>}
* @returns {Promise<import('@tryghost/members-offers').Offer>}
*/
async mapToOffer(model, options) {
const json = model.toJSON();
@ -123,7 +123,7 @@ class OfferBookshelfRepository {
/**
* @param {string} id
* @param {BaseOptions} [options]
* @returns {Promise<Offer>}
* @returns {Promise<import('@tryghost/members-offers').Offer>}
*/
async getById(id, options) {
const model = await this.OfferModel.findOne({id}, {
@ -141,7 +141,7 @@ class OfferBookshelfRepository {
/**
* @param {string} id stripe_coupon_id
* @param {BaseOptions} [options]
* @returns {Promise<Offer>}
* @returns {Promise<import('@tryghost/members-offers').Offer>}
*/
async getByStripeCouponId(id, options) {
const model = await this.OfferModel.findOne({stripe_coupon_id: id}, {
@ -158,7 +158,7 @@ class OfferBookshelfRepository {
/**
* @param {ListOptions} options
* @returns {Promise<Offer[]>}
* @returns {Promise<import('@tryghost/members-offers').Offer[]>}
*/
async getAll(options) {
const models = await this.OfferModel.findAll({