diff options
Diffstat (limited to 'services/profiles')
-rw-r--r-- | services/profiles/profiles.class.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/services/profiles/profiles.class.ts b/services/profiles/profiles.class.ts index a6de474..f0e82c5 100644 --- a/services/profiles/profiles.class.ts +++ b/services/profiles/profiles.class.ts @@ -1,16 +1,20 @@ import { Application } from '@feathersjs/express'; import { Params } from '@feathersjs/feathers'; -import { Poll } from 'which-types'; +import { Poll, User } from 'which-types'; export default class Profiles { app!: Application; - async get(id: string, params: Params): Promise<Poll[]> { + async get(username: string, params: Params): Promise<Poll[]> { + const profileUser = await this.app.service('users').find({ + query: { username } + }).then((results: User[]) => results[0]); + return this.app.service('polls').find({ ...params, query: { - authorId: id + authorId: profileUser._id } }); } |