From 78d0644d789df05a30f1f69c30ba1e348c590d2f Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 30 Sep 2021 22:41:17 +0530 Subject: [PATCH] Added model for `offers` table refs https://github.com/TryGhost/Team/issues/1088 - adds basic model definition for `offers` table --- core/server/models/offer.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 core/server/models/offer.js diff --git a/core/server/models/offer.js b/core/server/models/offer.js new file mode 100644 index 0000000000..6a50eee12f --- /dev/null +++ b/core/server/models/offer.js @@ -0,0 +1,13 @@ +const ghostBookshelf = require('./base'); + +const Offer = ghostBookshelf.Model.extend({ + tableName: 'offers', + + product() { + return this.belongsTo('Product', 'product_id', 'id'); + } +}); + +module.exports = { + Offer: ghostBookshelf.model('Offer', Offer) +};