diff options
Diffstat (limited to 'services/users')
-rw-r--r-- | services/users/users.class.ts | 20 | ||||
-rw-r--r-- | services/users/users.service.ts | 7 |
2 files changed, 5 insertions, 22 deletions
diff --git a/services/users/users.class.ts b/services/users/users.class.ts deleted file mode 100644 index db6b5a9..0000000 --- a/services/users/users.class.ts +++ /dev/null @@ -1,20 +0,0 @@ -interface User { - name: string; - avatarUrl?: string; - age?: number; -} - -export default class Users { - users: User[] = []; - - async find (){ - return this.users; - } - - async create(data: Pick<User, 'name' | 'avatarUrl' | 'age'>){ - const user: User = { ...data }; - this.users.push(user); - return user; - } -} - diff --git a/services/users/users.service.ts b/services/users/users.service.ts index bf608fe..47dac3d 100644 --- a/services/users/users.service.ts +++ b/services/users/users.service.ts @@ -1,7 +1,10 @@ import { Application } from '@feathersjs/express'; -import Users from './users.class'; +import Model from '../../models/users/user.model'; +import service from 'feathers-mongoose'; + +const UserService = service({ Model }); export default (app: Application): void => { - app.use('/users', new Users()); + app.use('/users', UserService); }; |