0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added member relation to events (#12656)

refs https://github.com/TryGhost/Ghost/issues/12602

When listing site-wide event, we want to include member information so
that we can contextualise the event when displaying it.
This commit is contained in:
Fabien 'egg' O'Carroll 2021-02-16 16:14:20 +00:00 committed by GitHub
parent 33bd36b4d6
commit 27b9e4ae04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 2 deletions

View file

@ -2,7 +2,11 @@ const errors = require('@tryghost/errors');
const ghostBookshelf = require('./base');
const MemberEmailChangeEvent = ghostBookshelf.Model.extend({
tableName: 'members_email_change_events'
tableName: 'members_email_change_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
}
}, {
async edit() {
throw new errors.IncorrectUsageError('Cannot edit MemberEmailChangeEvent');

View file

@ -2,7 +2,11 @@ const errors = require('@tryghost/errors');
const ghostBookshelf = require('./base');
const MemberLoginEvent = ghostBookshelf.Model.extend({
tableName: 'members_login_events'
tableName: 'members_login_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
}
}, {
async edit() {
throw new errors.IncorrectUsageError('Cannot edit MemberLoginEvent');

View file

@ -3,6 +3,11 @@ const ghostBookshelf = require('./base');
const MemberPaidSubscriptionEvent = ghostBookshelf.Model.extend({
tableName: 'members_paid_subscription_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
},
customQuery(qb, options) {
if (options.aggregateMRRDeltas) {
if (options.limit || options.filter) {

View file

@ -3,6 +3,11 @@ const ghostBookshelf = require('./base');
const MemberPaymentEvent = ghostBookshelf.Model.extend({
tableName: 'members_payment_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
},
customQuery(qb, options) {
if (options.aggregatePaymentVolume) {
if (options.limit || options.filter) {

View file

@ -3,6 +3,11 @@ const ghostBookshelf = require('./base');
const MemberStatusEvent = ghostBookshelf.Model.extend({
tableName: 'members_status_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
},
customQuery(qb, options) {
if (options.aggregateStatusCounts) {
if (options.limit || options.filter) {

View file

@ -3,6 +3,11 @@ const ghostBookshelf = require('./base');
const MemberSubscribeEvent = ghostBookshelf.Model.extend({
tableName: 'members_subscribe_events',
member() {
return this.belongsTo('Member', 'member_id', 'id');
},
customQuery(qb, options) {
if (options.aggregateSubscriptionDeltas) {
if (options.limit || options.filter) {