diff options
-rw-r--r-- | services/index.ts | 4 | ||||
-rw-r--r-- | services/profile/profile.service.ts | 7 | ||||
-rw-r--r-- | services/profiles/profiles.class.ts (renamed from services/profile/profile.class.ts) | 2 | ||||
-rw-r--r-- | services/profiles/profiles.hooks.ts | 10 | ||||
-rw-r--r-- | services/profiles/profiles.service.ts | 10 |
5 files changed, 23 insertions, 10 deletions
diff --git a/services/index.ts b/services/index.ts index 9cd77c3..d946e9d 100644 --- a/services/index.ts +++ b/services/index.ts @@ -1,11 +1,11 @@ import { Application } from '@feathersjs/express'; import Users from './users/users.service'; import Polls from './polls/polls.service'; -import Profile from './profile/profile.service'; +import Profiles from './profiles/profiles.service'; export default (app: Application): void => { app.configure(Users); app.configure(Polls); - app.configure(Profile); + app.configure(Profiles); }; diff --git a/services/profile/profile.service.ts b/services/profile/profile.service.ts deleted file mode 100644 index 752983c..0000000 --- a/services/profile/profile.service.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Application } from "@feathersjs/express"; -import Profiles from './profile.class'; - -export default (app: Application): void => { - app.use('/profile', new Profiles()); -}; - diff --git a/services/profile/profile.class.ts b/services/profiles/profiles.class.ts index d4e7b02..8954f74 100644 --- a/services/profile/profile.class.ts +++ b/services/profiles/profiles.class.ts @@ -3,7 +3,7 @@ import PollModel from '../../models/polls/poll.model'; export default class Profiles { async get(id: string, params: any): Promise<PollSchema[]> { - return PollModel.find({ authorId: id }); + return PollModel.find({ authorId: id }).lean<Poll>(); } }; diff --git a/services/profiles/profiles.hooks.ts b/services/profiles/profiles.hooks.ts new file mode 100644 index 0000000..b022aff --- /dev/null +++ b/services/profiles/profiles.hooks.ts @@ -0,0 +1,10 @@ +import { + expandAuthorManyHook, +} from '../../hooks/expandAuthor'; + +export default { + after: { + get: [expandAuthorManyHook], + } +}; + diff --git a/services/profiles/profiles.service.ts b/services/profiles/profiles.service.ts new file mode 100644 index 0000000..3422352 --- /dev/null +++ b/services/profiles/profiles.service.ts @@ -0,0 +1,10 @@ +import { Application } from "@feathersjs/express"; +import Profiles from './profiles.class'; + +import hooks from './profiles.hooks'; + +export default (app: Application): void => { + app.use('/profiles', new Profiles()); + app.service('profiles').hooks(hooks); +}; + |