diff options
-rw-r--r-- | UserService.ts | 16 | ||||
-rw-r--r-- | app.ts | 6 |
2 files changed, 9 insertions, 13 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 +} + @@ -46,10 +46,8 @@ app.service('polls').create({ }); app.service('users').create({ - info: { name: 'John Doe', age: 20, - nationality: 'Belarus', - sex: 'male' - } + avatarUrl: 'https://github.com/ilyayudovin.png' }); + |