aboutsummaryrefslogtreecommitdiff
path: root/UserService.ts
blob: 0cbb64946a1e8e83bebf33a8da786ba2df7e3ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
interface User {
  info : {
    name: string;
    age: number;
    nationality: string;
    sex: string;
  }
}

export class UserService {
  users: User[] = [];

  async find (){
    return this.users;
  }

  async create(data: Pick<User, 'info'>){
    const user: User = {...data};
    this.users.push(user);
    return user;
  }
}