aboutsummaryrefslogtreecommitdiff
path: root/services/users
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-09 19:23:44 +0300
committereug-vs <eug-vs@keemail.me>2020-06-09 19:23:44 +0300
commitde9771959850f193f173616b73099c3ae6f010c9 (patch)
tree65262d9badbc46f99d8644705c4aeed62e5373ca /services/users
parent39d637a817460ee62a0a6667abd6afc5b6898895 (diff)
downloadwhich-api-de9771959850f193f173616b73099c3ae6f010c9.tar.gz
feat!: integrate mongoDB
Diffstat (limited to 'services/users')
-rw-r--r--services/users/users.class.ts20
-rw-r--r--services/users/users.service.ts7
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);
};