From e9d0438f6c02664c652a593c686564361fa0de6b Mon Sep 17 00:00:00 2001 From: eug-vs Date: Tue, 9 Jun 2020 14:16:15 +0300 Subject: refactor: structurize feathers app --- services/users/users.class.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 services/users/users.class.ts (limited to 'services/users/users.class.ts') diff --git a/services/users/users.class.ts b/services/users/users.class.ts new file mode 100644 index 0000000..db6b5a9 --- /dev/null +++ b/services/users/users.class.ts @@ -0,0 +1,20 @@ +interface User { + name: string; + avatarUrl?: string; + age?: number; +} + +export default class Users { + users: User[] = []; + + async find (){ + return this.users; + } + + async create(data: Pick){ + const user: User = { ...data }; + this.users.push(user); + return user; + } +} + -- cgit v1.2.3