Skip to content

Commit 24ff209

Browse files
committed
feat: finish profile services
1 parent f2573a2 commit 24ff209

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

services/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { Application } from '@feathersjs/express';
22
import Users from './users/users.service';
33
import Polls from './polls/polls.service';
4-
import Profile from './profile/profile.service';
4+
import Profiles from './profiles/profiles.service';
55

66
export default (app: Application): void => {
77
app.configure(Users);
88
app.configure(Polls);
9-
app.configure(Profile);
9+
app.configure(Profiles);
1010
};
1111

services/profile/profile.service.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

services/profile/profile.class.ts renamed to services/profiles/profiles.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PollModel from '../../models/polls/poll.model';
33

44
export default class Profiles {
55
async get(id: string, params: any): Promise<PollSchema[]> {
6-
return PollModel.find({ authorId: id });
6+
return PollModel.find({ authorId: id }).lean<Poll>();
77
}
88
};
99

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import {
2+
expandAuthorManyHook,
3+
} from '../../hooks/expandAuthor';
4+
5+
export default {
6+
after: {
7+
get: [expandAuthorManyHook],
8+
}
9+
};
10+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Application } from "@feathersjs/express";
2+
import Profiles from './profiles.class';
3+
4+
import hooks from './profiles.hooks';
5+
6+
export default (app: Application): void => {
7+
app.use('/profiles', new Profiles());
8+
app.service('profiles').hooks(hooks);
9+
};
10+

0 commit comments

Comments
 (0)