aboutsummaryrefslogtreecommitdiff
path: root/UserService.ts
blob: 57a883c358dd0d3e67498a1d7c9f926375cd8a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
interface User {
  name: string;
  avatarUrl?: string;
  age?: number;
}

export class UserService {
  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;
  }
}