Fakultas Ilmu Komputer UI

models.ts 1.24 KB
Newer Older
1
import { DietProfileResponse } from 'services/dietelaQuiz/models';
2
import { CartResponse, TransactionStatus } from 'services/payment/models';
3

4
5
6
7
export interface GoogleLoginRequest {
  access_token: string;
}

8
9
10
11
12
13
14
export interface RegistrationRequest {
  name: string;
  email: string;
  password1: string;
  password2: string;
}

15
16
17
18
export enum UserRole {
  CLIENT = 'client',
  NUTRITIONIST = 'nutritionist',
  ADMIN = 'admin',
19
20
}

21
22
23
24
export interface User {
  id: number | null;
  email: string;
  name: string;
25
  role: UserRole | null;
26
27
  phone_number: string | null;
  deadline: string | null;
28
29
30
}

export interface AuthUserResponse extends User {
31
  transaction_status: TransactionStatus | null;
32
  is_finished_onboarding: boolean;
Wulan Mantiri's avatar
Wulan Mantiri committed
33
  cart_id: number | null;
Wulan Mantiri's avatar
Wulan Mantiri committed
34
35
36
37
  nutritionist: {
    full_name_and_degree: string;
    phone_number: string | null;
  } | null;
38
39
40
41
42
43
}

export interface LoginRequest {
  email: string;
  password: string;
  role: UserRole;
44
45
}

46
export interface LoginResponse {
47
48
  access_token: string;
  refresh_token: string;
49
  user: AuthUserResponse;
50
}
51
52
53
54
55
56
57
58
59
60
61
62

export interface LinkUserDataRequest {
  email: string;
  diet_profile_id: number;
  cart_id: number;
}

export interface LinkUserDataResponse {
  user: User;
  diet_profile: DietProfileResponse;
  cart: CartResponse;
}