aboutsummaryrefslogtreecommitdiff
path: root/UserService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'UserService.ts')
-rw-r--r--UserService.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/UserService.ts b/UserService.ts
new file mode 100644
index 0000000..0cbb649
--- /dev/null
+++ b/UserService.ts
@@ -0,0 +1,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;
+ }
+} \ No newline at end of file