aboutsummaryrefslogtreecommitdiff
path: root/UserService.ts
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2020-06-09 13:48:11 +0300
committereug-vs <eug-vs@keemail.me>2020-06-09 13:48:11 +0300
commit53c7ec8572d80c75828702b2a103269136785b4a (patch)
treebd11b2524c7a7fda9dff6214776a3b9b6ed6863b /UserService.ts
parentabe7c3220c40031b9adecf9b27ab7141b7d3f736 (diff)
downloadwhich-api-53c7ec8572d80c75828702b2a103269136785b4a.tar.gz
refactor: change User interface
Diffstat (limited to 'UserService.ts')
-rw-r--r--UserService.ts16
1 files changed, 7 insertions, 9 deletions
diff --git a/UserService.ts b/UserService.ts
index 0cbb649..57a883c 100644
--- a/UserService.ts
+++ b/UserService.ts
@@ -1,10 +1,7 @@
interface User {
- info : {
- name: string;
- age: number;
- nationality: string;
- sex: string;
- }
+ name: string;
+ avatarUrl?: string;
+ age?: number;
}
export class UserService {
@@ -14,9 +11,10 @@ export class UserService {
return this.users;
}
- async create(data: Pick<User, 'info'>){
- const user: User = {...data};
+ async create(data: Pick<User, 'name' | 'avatarUrl' | 'age'>){
+ const user: User = { ...data };
this.users.push(user);
return user;
}
-} \ No newline at end of file
+}
+