mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-18 02:21:47 -05:00
Added email_spam_complaint_events table and model
refs https://github.com/TryGhost/Team/issues/2318 As with our other events, we've disabled destroy and edit static methods on the bookshelf model.
This commit is contained in:
parent
83be54af42
commit
ba5b8ea33d
6 changed files with 73 additions and 2 deletions
|
@ -44,7 +44,8 @@ const BACKUP_TABLES = [
|
|||
'redirects',
|
||||
'members_click_events',
|
||||
'members_feedback',
|
||||
'suppressions'
|
||||
'suppressions',
|
||||
'email_spam_complaint_events'
|
||||
];
|
||||
|
||||
// NOTE: exposing only tables which are going to be included in a "default" export file
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
const {addTable} = require('../../utils');
|
||||
|
||||
module.exports = addTable('email_spam_complaint_events', {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||
email_id: {type: 'string', maxlength: 24, nullable: false, references: 'emails.id'},
|
||||
email_address: {type: 'string', maxlength: 191, nullable: false, unique: false},
|
||||
created_at: {type: 'dateTime', nullable: false}
|
||||
});
|
|
@ -966,5 +966,12 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
created_at: {type: 'dateTime', nullable: false}
|
||||
},
|
||||
email_spam_complaint_events: {
|
||||
id: {type: 'string', maxlength: 24, nullable: false, primary: true},
|
||||
member_id: {type: 'string', maxlength: 24, nullable: false, references: 'members.id', cascadeDelete: true},
|
||||
email_id: {type: 'string', maxlength: 24, nullable: false, references: 'emails.id'},
|
||||
email_address: {type: 'string', maxlength: 191, nullable: false, unique: false, validations: {isEmail: true}},
|
||||
created_at: {type: 'dateTime', nullable: false}
|
||||
}
|
||||
};
|
||||
|
|
22
ghost/core/core/server/models/email-spam-complaint-event.js
Normal file
22
ghost/core/core/server/models/email-spam-complaint-event.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const errors = require('@tryghost/errors');
|
||||
const ghostBookshelf = require('./base');
|
||||
|
||||
const EmailSpamComplaintEvent = ghostBookshelf.Model.extend({
|
||||
tableName: 'email_spam_complaint_events'
|
||||
}, {
|
||||
async edit() {
|
||||
throw new errors.IncorrectUsageError({
|
||||
message: 'Cannot edit EmailSpamComplaintEvent'
|
||||
});
|
||||
},
|
||||
|
||||
async destroy() {
|
||||
throw new errors.IncorrectUsageError({
|
||||
message: 'Cannot destroy EmailSpamComplaintEvent'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
EmailSpamComplaintEvent: ghostBookshelf.model('EmailSpamComplaintEvent', EmailSpamComplaintEvent)
|
||||
};
|
|
@ -35,7 +35,7 @@ const validateRouteSettings = require('../../../../../core/server/services/route
|
|||
*/
|
||||
describe('DB version integrity', function () {
|
||||
// Only these variables should need updating
|
||||
const currentSchemaHash = 'ded409c0ead434761073836b8b6975c6';
|
||||
const currentSchemaHash = '7376b855d023c40d1c0ff5770d1d01fd';
|
||||
const currentFixturesHash = 'dcb7ba7c66b4b98d6c26a722985e756a';
|
||||
const currentSettingsHash = '9acce72858e75420b831297718595bbd';
|
||||
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
const EmailSpamComplaintEvent = require('../../../../core/server/models/email-spam-complaint-event');
|
||||
const assert = require('assert');
|
||||
|
||||
describe('EmailSpamComplaintEvent', function () {
|
||||
describe('destroy', function () {
|
||||
it('rejects', async function () {
|
||||
let threw = false;
|
||||
try {
|
||||
await EmailSpamComplaintEvent.destroy({id: 'blah'});
|
||||
threw = false;
|
||||
} catch (err) {
|
||||
threw = true;
|
||||
} finally {
|
||||
assert(threw);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('edit', function () {
|
||||
it('rejects', async function () {
|
||||
let threw = false;
|
||||
try {
|
||||
await EmailSpamComplaintEvent.edit({reason: 'fuck'}, {id: 'blah'});
|
||||
threw = false;
|
||||
} catch (err) {
|
||||
threw = true;
|
||||
} finally {
|
||||
assert(threw);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue