diff options
author | Eugene Sokolov <eug-vs@keemail.me> | 2020-06-27 18:33:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-27 18:33:02 +0300 |
commit | 990edc953d734b1f1621fc0f5161c1eb978a3ea0 (patch) | |
tree | a8759f1d34e55d809a5b702fdca60a82117e1a2e /services/profiles/profiles.class.ts | |
parent | 08994137ddbeee5c3d407c215575e9681fd3962b (diff) | |
parent | 0a6a6be1b43635c60e76669ac2a7ee8581d9b183 (diff) | |
download | which-api-990edc953d734b1f1621fc0f5161c1eb978a3ea0.tar.gz |
Merge pull request #14 from which-ecosystem/feed
Feed endpoint
Diffstat (limited to 'services/profiles/profiles.class.ts')
-rw-r--r-- | services/profiles/profiles.class.ts | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/services/profiles/profiles.class.ts b/services/profiles/profiles.class.ts index 52d6b47..3461cbc 100644 --- a/services/profiles/profiles.class.ts +++ b/services/profiles/profiles.class.ts @@ -1,9 +1,20 @@ -import { PollSchema } from '../../models/polls/poll.schema'; -import PollModel from '../../models/polls/poll.model'; +import { Application } from '@feathersjs/express'; +import { Poll } from 'which-types'; + export default class Profiles { - async get(id: string): Promise<PollSchema[]> { - return PollModel.find({ authorId: id }).lean(); + app!: Application; + + async get(id: string): Promise<Poll[]> { + return this.app.service('polls').find({ + query: { + authorId: id + } + }); + } + + setup(app: Application): void { + this.app = app; } } |