forked from Giveth/feathers-giveth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added completion-requests and reviewer-requests services (Giveth#7)
* spacing for readme * readme styling * spacing failed * completion-requests and reviewer-requests services
- Loading branch information
Showing
14 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
6 changes: 6 additions & 0 deletions
6
src/services/completion-requests/completion-requests.filters.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
33
src/services/completion-requests/completion-requests.hooks.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
29
src/services/completion-requests/completion-requests.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
29
src/services/reviewer-requests/reviewer-requests.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); | ||
}); |