Skip to content

Commit

Permalink
🏷️ chore: funnel νŒ¨ν„΄μ— μ‚¬μš©ν•  νƒ€μž… μ •μ˜ #5
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMirror21 committed Oct 18, 2024
1 parent 17720d2 commit d2066c1
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions src/types/api/users.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// Enum types
enum Gender {
MALE = 'MALE',
FEMALE = 'FEMALE',
NONE = 'NONE',
}

enum Nationality {
SOUTH_KOREA = 'SOUTH_KOREA',
JAPAN = 'JAPAN',
CHINA = 'CHINA',
VIETNAME = 'VIETNAME',
UZBEKISTAN = 'UZBEKISTAN',
}

enum Visa {
'D-2-1' = 'D-2-1',
'D-2-2' = 'D-2-2',
'D-2-3' = 'D-2-3',
'D-2-4' = 'D-2-4',
'D-2-6' = 'D-2-6',
'D-2-7' = 'D-2-7',
'D-2-8' = 'D-2-8',
'D-4-1' = 'D-4-1',
'D-4-7' = 'D-4-7',
'F-2' = 'F-2',
}

enum Language {
KOREAN = 'KOREAN',
VIETNAMESE = 'VIETNAMESE',
UZBEK = 'UZBEK',
TURKISH = 'TURKISH',
ENGLISH = 'ENGLISH',
}

// Type for user info with undefinedable fields
export type UserInfo = {
id: string | undefined;
email: string | undefined;
marketing_allow: boolean | undefined;
first_name: string | undefined;
last_name: string | undefined;
gender: Gender | undefined;
birth: string | undefined; // Format: yyyy/mm/dd
nationality: Nationality | undefined;
visa: Visa | undefined;
phone_number: string | undefined;
}

// Type for address with undefinedable fields
type Address = {
address_name: string | undefined;
region_1depth_name: string | undefined;
region_2depth_name: string | undefined;
region_3depth_name: string | undefined;
region_4depth_name: string | undefined;
address_detail: string | undefined;
longitude: number | undefined;
latitude: number | undefined;
}

// Main type for the API request body with undefinedable fields
export type UserInfoRequestBody = {
temporary_token: string | undefined;
user_info: UserInfo;
address: Address;
language: Language | undefined;
}

// Initial state for UserInfo
export const initialUserInfo: UserInfo = {
id: undefined,
email: undefined,
marketing_allow: undefined,
first_name: undefined,
last_name: undefined,
gender: undefined,
birth: undefined,
nationality: undefined,
visa: undefined,
phone_number: undefined,
}

// Initial state for Address
export const initialAddress: Address = {
address_name: undefined,
region_1depth_name: undefined,
region_2depth_name: undefined,
region_3depth_name: undefined,
region_4depth_name: undefined,
address_detail: undefined,
longitude: undefined,
latitude: undefined,
}

// Initial state for UserInfoRequestBody
export const initialUserInfoRequestBody: UserInfoRequestBody = {
temporary_token: undefined,
user_info: initialUserInfo,
address: initialAddress,
language: undefined,
}

0 comments on commit d2066c1

Please sign in to comment.