From 02b0da08155c6615a48b8d7f49648c19c1600020 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 28 Jun 2020 16:18:20 +0300 Subject: feat: create feedback service --- services/feedback/feedback.hooks.ts | 10 ++++++++++ services/feedback/feedback.service.ts | 13 +++++++++++++ services/index.ts | 2 ++ 3 files changed, 25 insertions(+) create mode 100644 services/feedback/feedback.hooks.ts create mode 100644 services/feedback/feedback.service.ts (limited to 'services') diff --git a/services/feedback/feedback.hooks.ts b/services/feedback/feedback.hooks.ts new file mode 100644 index 0000000..04f3af1 --- /dev/null +++ b/services/feedback/feedback.hooks.ts @@ -0,0 +1,10 @@ +import { HookContext } from '@feathersjs/feathers'; +import requireAuth from '../../hooks/requireAuth'; +import signAuthority from '../../hooks/signAuthority'; + +export default { + before: { + create: [requireAuth, signAuthority] + } +}; + diff --git a/services/feedback/feedback.service.ts b/services/feedback/feedback.service.ts new file mode 100644 index 0000000..a15ede9 --- /dev/null +++ b/services/feedback/feedback.service.ts @@ -0,0 +1,13 @@ +import { Application } from '@feathersjs/express'; +import service from 'feathers-mongoose'; +import Model from '../../models/feedback/feedback.model'; + +import hooks from './feedback.hooks'; + +const FeebackService = service({ Model }); + +export default (app: Application): void => { + app.use('/feedback', FeebackService); + app.service('feedback').hooks(hooks); +}; + diff --git a/services/index.ts b/services/index.ts index 1763a17..e5ea703 100644 --- a/services/index.ts +++ b/services/index.ts @@ -5,6 +5,7 @@ import Profiles from './profiles/profiles.service'; import Votes from './votes/votes.service'; import Auth from './auth/auth.service'; import Feed from './feed/feed.service'; +import Feedback from './feedback/feedback.service'; import tryAuthenticate from '../hooks/tryAuthenticate'; import logging from '../hooks/logging'; @@ -17,6 +18,7 @@ export default (app: Application): void => { app.configure(Profiles); app.configure(Votes); app.configure(Feed); + app.configure(Feedback); app.hooks({ before: { -- cgit v1.2.3