From f2573a28748a3c7983b730be2c775e024d0cdaa0 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 12 Jun 2020 17:00:48 +0300 Subject: refactor: move Profiles class to separate file --- services/profile/profile.class.ts | 9 +++++++++ services/profile/profile.service.ts | 19 +++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 services/profile/profile.class.ts diff --git a/services/profile/profile.class.ts b/services/profile/profile.class.ts new file mode 100644 index 0000000..d4e7b02 --- /dev/null +++ b/services/profile/profile.class.ts @@ -0,0 +1,9 @@ +import { Poll, PollSchema } from "../../models/polls/poll.schema"; +import PollModel from '../../models/polls/poll.model'; + +export default class Profiles { + async get(id: string, params: any): Promise { + return PollModel.find({ authorId: id }); + } +}; + diff --git a/services/profile/profile.service.ts b/services/profile/profile.service.ts index 4a12def..752983c 100644 --- a/services/profile/profile.service.ts +++ b/services/profile/profile.service.ts @@ -1,16 +1,7 @@ -import {User} from '../../models/users/user.schema'; -import {Poll} from "../../models/polls/poll.schema"; -import {Application} from "@feathersjs/express"; - -export class ProfileService { - user: User = Object; - saved_polls: Poll[] = []; - - async find () { - return [this.user, this.saved_polls]; - } -} +import { Application } from "@feathersjs/express"; +import Profiles from './profile.class'; export default (app: Application): void => { - app.use('/profile', new ProfileService()); -}; \ No newline at end of file + app.use('/profile', new Profiles()); +}; + -- cgit v1.2.3