Add empty owner service

parent 9f7f3ed6
const siteConfiguration = require('./site-configuration/site-configuration.service.js')
const owner = require('./owner/owner.service.js');
module.exports = function (app) {
app.configure(siteConfiguration)
app.configure(owner);
}
/* eslint-disable no-unused-vars */
class Service {
constructor (options) {
this.options = options || {};
}
async find (params) {
return [];
}
async get (id, params) {
return {
id, text: `A new message with ID: ${id}!`
};
}
async create (data, params) {
if (Array.isArray(data)) {
return await Promise.all(data.map(current => this.create(current)));
}
return data;
}
async update (id, data, params) {
return data;
}
async patch (id, data, params) {
return data;
}
async remove (id, params) {
return { id };
}
}
module.exports = function (options) {
return new Service(options);
};
module.exports.Service = Service;
module.exports = {
before: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
after: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
},
error: {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
}
};
// Initializes the `owner` service on path `/owner`
const createService = require('./owner.class.js');
const hooks = require('./owner.hooks');
module.exports = function (app) {
const paginate = app.get('paginate');
const options = {
name: 'owner',
paginate
};
// Initialize our service with any options it requires
app.use('/owner', createService(options));
// Get our initialized service so that we can register hooks and filters
const service = app.service('owner');
service.hooks(hooks);
};
const assert = require('assert');
const app = require('../../server/app');
describe('\'owner\' service', () => {
it('registered the service', () => {
const service = app.service('owner');
assert.ok(service, 'Registered the service');
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment