blob: f0e82c577be2d46b701614a2e728d4bacfb78b0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import { Application } from '@feathersjs/express';
import { Params } from '@feathersjs/feathers';
import { Poll, User } from 'which-types';
export default class Profiles {
app!: Application;
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: profileUser._id
}
});
}
setup(app: Application): void {
this.app = app;
}
}
|