import { api, ApiResponse } from '../index'; import { TUserItem } from '../../types/users'; export interface UserDetailResponseDto extends TUserItem { bio?: string; location?: string; website_url?: string; linkedin_url?: string; github_url?: string; twitter_url?: string; skills?: string[]; career_status?: string; experience?: Array<{ id: string; company: string; position: string; duration: string; period: string; }>; education?: Array<{ id: string; institution: string; degree: string; field: string; period: string; }>; } export interface UserUpdateRequestDto { fullname?: string; bio?: string; location?: string; website_url?: string; linkedin_url?: string; github_url?: string; twitter_url?: string; skills?: string[]; phone_number?: string; birthdate?: string; gender?: string; career_status?: string; avatar?: string; cv_url?: string; phone_for_verification?: string; domicile?: string; experience?: Array<{ id: string; company: string; position: string; duration: string; period: string; }>; education?: Array<{ id: string; institution: string; degree: string; field: string; period: string; }>; } export interface UserService { getUserMe(): Promise; getUserById(id: string): Promise; updateUserMe(data: UserUpdateRequestDto): Promise; updateUserById(id: string, data: UserUpdateRequestDto): Promise; } export const userService: UserService = { async getUserMe() { const response = await api.get>('/users/me'); return response.data.data; }, async getUserById(id: string) { const response = await api.get>(`/users/detail/${id}`); return response.data.data; }, async updateUserMe(data: UserUpdateRequestDto) { const response = await api.put>('/users/update/me', data); return response.data.data; }, async updateUserById(id: string, data: UserUpdateRequestDto) { const response = await api.put>(`/users/${id}`, data); return response.data.data; }, };