aboutsummaryrefslogtreecommitdiff
path: root/services/users/users.class.ts
blob: db6b5a952e7700f34643e01a5aef90ee8a85fb1b (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 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;
  }
}