Skip to content

Commit f2573a2

Browse files
committed
refactor: move Profiles class to separate file
1 parent fb88914 commit f2573a2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

services/profile/profile.class.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Poll, PollSchema } from "../../models/polls/poll.schema";
2+
import PollModel from '../../models/polls/poll.model';
3+
4+
export default class Profiles {
5+
async get(id: string, params: any): Promise<PollSchema[]> {
6+
return PollModel.find({ authorId: id });
7+
}
8+
};
9+
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
1-
import {User} from '../../models/users/user.schema';
2-
import {Poll} from "../../models/polls/poll.schema";
3-
import {Application} from "@feathersjs/express";
4-
5-
export class ProfileService {
6-
user: User = Object;
7-
saved_polls: Poll[] = [];
8-
9-
async find () {
10-
return [this.user, this.saved_polls];
11-
}
12-
}
1+
import { Application } from "@feathersjs/express";
2+
import Profiles from './profile.class';
133

144
export default (app: Application): void => {
15-
app.use('/profile', new ProfileService());
16-
};
5+
app.use('/profile', new Profiles());
6+
};
7+

0 commit comments

Comments
 (0)