Skip to content

Commit

Permalink
added completion-requests and reviewer-requests services (Giveth#7)
Browse files Browse the repository at this point in the history
* spacing for readme

* readme styling

* spacing failed

* completion-requests and reviewer-requests services
  • Loading branch information
ojones authored Aug 3, 2017
1 parent e1dff88 commit 9708816
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Each of these services are available via rest or websocket:
givers
donations
milestones
reviewer-requests
completion-requests
projects
causes
skunkworks
Expand Down
12 changes: 12 additions & 0 deletions src/models/completion-requests.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const NeDB = require('nedb');
const path = require('path');

module.exports = function (app) {
const dbPath = app.get('nedb');
const Model = new NeDB({
filename: path.join(dbPath, 'completion-requests.db'),
autoload: true
});

return Model;
};
12 changes: 12 additions & 0 deletions src/models/ms-completion-request.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const NeDB = require('nedb');
const path = require('path');

module.exports = function (app) {
const dbPath = app.get('nedb');
const Model = new NeDB({
filename: path.join(dbPath, 'ms-completion-request.db'),
autoload: true
});

return Model;
};
12 changes: 12 additions & 0 deletions src/models/reviewer-request.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const NeDB = require('nedb');
const path = require('path');

module.exports = function (app) {
const dbPath = app.get('nedb');
const Model = new NeDB({
filename: path.join(dbPath, 'reviewer-request.db'),
autoload: true
});

return Model;
};
12 changes: 12 additions & 0 deletions src/models/reviewer-requests.model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const NeDB = require('nedb');
const path = require('path');

module.exports = function (app) {
const dbPath = app.get('nedb');
const Model = new NeDB({
filename: path.join(dbPath, 'reviewer-requests.db'),
autoload: true
});

return Model;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint no-console: 1 */
console.warn('You are using the default filter for the completion-requests service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console

module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
return data;
};
33 changes: 33 additions & 0 deletions src/services/completion-requests/completion-requests.hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@


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: []
}
};
29 changes: 29 additions & 0 deletions src/services/completion-requests/completion-requests.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Initializes the `completion-requests` service on path `/completion-requests`
const createService = require('feathers-nedb');
const createModel = require('../../models/completion-requests.model');
const hooks = require('./completion-requests.hooks');
const filters = require('./completion-requests.filters');

module.exports = function () {
const app = this;
const Model = createModel(app);
const paginate = app.get('paginate');

const options = {
name: 'completion-requests',
Model,
paginate
};

// Initialize our service with any options it requires
app.use('/completion-requests', createService(options));

// Get our initialized service so that we can register hooks and filters
const service = app.service('completion-requests');

service.hooks(hooks);

if (service.filter) {
service.filter(filters);
}
};
4 changes: 4 additions & 0 deletions src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ const causes = require('./causes/causes.service.js');
const projects = require('./projects/projects.service.js');
const milestones = require('./milestones/milestones.service.js');
const givers = require('./givers/givers.service.js');
const reviewerRequests = require('./reviewer-requests/reviewer-requests.service.js');
const completionRequests = require('./completion-requests/completion-requests.service.js');
module.exports = function () {
const app = this; // eslint-disable-line no-unused-vars
app.configure(skunkworks);
app.configure(causes);
app.configure(projects);
app.configure(milestones);
app.configure(givers);
app.configure(reviewerRequests);
app.configure(completionRequests);
};
6 changes: 6 additions & 0 deletions src/services/reviewer-requests/reviewer-requests.filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint no-console: 1 */
console.warn('You are using the default filter for the reviewer-requests service. For more information about event filters see https://docs.feathersjs.com/api/events.html#event-filtering'); // eslint-disable-line no-console

module.exports = function (data, connection, hook) { // eslint-disable-line no-unused-vars
return data;
};
33 changes: 33 additions & 0 deletions src/services/reviewer-requests/reviewer-requests.hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@


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: []
}
};
29 changes: 29 additions & 0 deletions src/services/reviewer-requests/reviewer-requests.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Initializes the `reviewer-requests` service on path `/reviewer-requests`
const createService = require('feathers-nedb');
const createModel = require('../../models/reviewer-requests.model');
const hooks = require('./reviewer-requests.hooks');
const filters = require('./reviewer-requests.filters');

module.exports = function () {
const app = this;
const Model = createModel(app);
const paginate = app.get('paginate');

const options = {
name: 'reviewer-requests',
Model,
paginate
};

// Initialize our service with any options it requires
app.use('/reviewer-requests', createService(options));

// Get our initialized service so that we can register hooks and filters
const service = app.service('reviewer-requests');

service.hooks(hooks);

if (service.filter) {
service.filter(filters);
}
};
10 changes: 10 additions & 0 deletions test/services/completion-requests.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const assert = require('assert');
const app = require('../../src/app');

describe('\'completion-requests\' service', () => {
it('registered the service', () => {
const service = app.service('completion-requests');

assert.ok(service, 'Registered the service');
});
});
10 changes: 10 additions & 0 deletions test/services/reviewer-requests.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const assert = require('assert');
const app = require('../../src/app');

describe('\'reviewer-requests\' service', () => {
it('registered the service', () => {
const service = app.service('reviewer-requests');

assert.ok(service, 'Registered the service');
});
});

0 comments on commit 9708816

Please sign in to comment.