-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from boocam-project/feature/resume
Feat: 스터디 및 자기소개서 API 연결
- Loading branch information
Showing
44 changed files
with
3,491 additions
and
67 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { ENDPOINTS } from './apiConfig'; | ||
import { instance } from './client'; | ||
|
||
export interface Resume { | ||
id: number; | ||
title: string; | ||
content: string; | ||
writer: string; | ||
likeCount: number; | ||
viewCount: number; | ||
createdAt: string | null; | ||
lastModifiedAt: string | null; | ||
deletedAt: string | null; | ||
} | ||
|
||
export interface CreateResumeData { | ||
title: string; | ||
content: string; | ||
} | ||
|
||
class ResumeService { | ||
private endpoint = ENDPOINTS.resume; | ||
|
||
getResumes = async () => { | ||
const response = await instance.get<{ data: Resume[] }>(`${this.endpoint}`); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
getResume = async (id: number) => { | ||
const response = await instance.get<{ data: Resume }>(`${this.endpoint}/${id}`); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
update = async (resume: CreateResumeData, id: number) => { | ||
const response = await instance.put(`${this.endpoint}/${id}`, resume); | ||
|
||
return response.data; | ||
}; | ||
|
||
delete = async (id: number) => { | ||
const response = await instance.delete(`${this.endpoint}/${id}`); | ||
|
||
return response.data; | ||
}; | ||
|
||
create = async (resume: CreateResumeData) => { | ||
const response = await instance.post(`${this.endpoint}`, resume); | ||
|
||
return response.data; | ||
}; | ||
|
||
like = async (id: number) => { | ||
const response = await instance.post(`${this.endpoint}/${id}/like`); | ||
|
||
return response.data; | ||
}; | ||
} | ||
|
||
export default new ResumeService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import { ENDPOINTS } from './apiConfig'; | ||
import { instance } from './client'; | ||
|
||
interface getStudiesParams { | ||
page?: number; | ||
pageSize?: number; | ||
orderBy?: string; | ||
} | ||
|
||
interface StudyResponse { | ||
code: number; | ||
message: string; | ||
data: { | ||
totalPages: number; | ||
isLastPage: boolean; | ||
totalStudies: number; | ||
studies: Study[]; | ||
}; | ||
} | ||
|
||
interface Study { | ||
id: number; | ||
title: string; | ||
content: string; | ||
skill: string; | ||
total: number; | ||
current: number; | ||
applicant: number; | ||
recruitmentStart: string; | ||
recruitmentEnd: string; | ||
progressStart: string; | ||
progressEnd: string; | ||
contact: string; | ||
nickname: string; | ||
categories: number[]; | ||
} | ||
|
||
export interface CreateStudyData { | ||
title: string; | ||
content: string; | ||
skill: string; | ||
total: number; | ||
recruitmentEnd: string; | ||
progressStart: string; | ||
progressEnd: string; | ||
contact: string; | ||
categoryIds: number[]; | ||
} | ||
export interface StudyApplication { | ||
id: number; | ||
status: string; | ||
studyId: number; | ||
applicantId: number; | ||
nickname: string; | ||
message: string; | ||
createdAt: string; | ||
updatedAt: string | null; | ||
deletedAt: string | null; | ||
} | ||
|
||
export interface StudySuggestionsData { | ||
totalPages: number; | ||
isLastPage: boolean; | ||
totalStudySuggestions: number; | ||
studySuggestions: StudySuggestion[]; | ||
} | ||
|
||
export interface StudySuggestion { | ||
studySuggestionId: number; | ||
status: string; | ||
studyId: number; | ||
memberId: number; | ||
nickname: string; | ||
message: string; | ||
createdAt: string; | ||
updatedAt: string | null; | ||
deletedAt: string | null; | ||
} | ||
|
||
class StudyService { | ||
private endpoint = ENDPOINTS.studies; | ||
|
||
getStudies = async ({ page = 0, pageSize = 10, orderBy = 'latest' }: getStudiesParams) => { | ||
const response = await instance.get<StudyResponse>(`${this.endpoint}`, { | ||
params: { | ||
page, | ||
pageSize, | ||
orderBy, | ||
}, | ||
}); | ||
|
||
return response.data; | ||
}; | ||
|
||
getStudy = async (id: number) => { | ||
const response = await instance.get<{ data: Study }>(`${this.endpoint}/${id}`); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
getCategories = async () => { | ||
const response = await instance.get<{ data: { id: number; name: string }[] }>( | ||
ENDPOINTS.categories | ||
); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
create = async (study: CreateStudyData) => { | ||
const response = await instance.post<{ data: string }>(`${this.endpoint}`, study); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
update = async (study: CreateStudyData, id: number) => { | ||
const response = await instance.put<{ data: string }>(`${this.endpoint}/${id}`, study); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
delete = async (studyId: number) => { | ||
const response = await instance.delete(`${this.endpoint}/${studyId}`); | ||
|
||
return response.data; | ||
}; | ||
|
||
apply = async (id: number, message: string) => { | ||
const response = await instance.post<{ data: { studyApplicationId: number } }>( | ||
`${this.endpoint}/${id}`, | ||
{ | ||
message, | ||
} | ||
); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
getApplications = async (studyId?: number, pageSize: number = 10, page: number = 0) => { | ||
const response = await instance.get<{ data: StudyApplication[] }>( | ||
`${this.endpoint}/applications`, | ||
{ | ||
params: { | ||
studyId, | ||
pageSize, | ||
page, | ||
}, | ||
} | ||
); | ||
|
||
return response.data.data; | ||
}; | ||
|
||
getSuggestions = async (id?: number, pageSize: number = 10, page: number = 0) => { | ||
const response = await instance.get<{ data: StudySuggestionsData }>( | ||
`${this.endpoint}/suggestions`, | ||
{ | ||
params: { | ||
id, | ||
pageSize, | ||
page, | ||
}, | ||
} | ||
); | ||
|
||
return response.data.data; | ||
}; | ||
} | ||
|
||
export default new StudyService(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.