Ghost/ghost/custom-theme-settings-service/lib/CustomThemeSettingsBREADService.js
Fabien "egg" O'Carroll 104f84f252 Added eslint rule for file naming convention
As discussed with the product team we want to enforce kebab-case file names for
all files, with the exception of files which export a single class, in which
case they should be PascalCase and reflect the class which they export.

This will help find classes faster, and should push better naming for them too.

Some files and packages have been excluded from this linting, specifically when
a library or framework depends on the naming of a file for the functionality
e.g. Ember, knex-migrator, adapter-manager
2023-05-09 12:34:34 -04:00

30 lines
755 B
JavaScript

module.exports = class CustomThemeSettingsBREADService {
/**
* @param {Object} options
* @param {Object} options.model - Bookshelf model for custom theme settings
*/
constructor({model}) {
this.Model = model;
}
async browse(data, options = {}) {
return this.Model.findAll(data, options);
}
async read(data, options = {}) {
return this.Model.findOne(data, options);
}
async edit(data, options = {}) {
return this.Model.edit(data, Object.assign({}, options, {method: 'update'}));
}
async add(data, options = {}) {
return this.Model.add(data, options);
}
async destroy(data, options = {}) {
return this.Model.destroy(data, options);
}
};