-
Notifications
You must be signed in to change notification settings - Fork 0
feat-web-28,21 방문자 및 관리자 메인페이지 api 추가 #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PJW03
wants to merge
4
commits into
develop
Choose a base branch
from
feature-WEB-28
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,54 @@ | ||
| import instance from './instance'; | ||
|
|
||
| export const getVisitorMain = async () => { | ||
| const response = await instance.get('/api/v1/visitor/main'); | ||
| return response.data?.data; | ||
| }; | ||
|
|
||
| /** | ||
| * (관리자) 주요활동 카드 수정 | ||
| * @param {number} cardId - 수정할 카드 ID | ||
| * @param {{ title: string, content: string }} data | ||
| * @returns {Promise<Object>} { cardId, title, content, cardOrder } | ||
| */ | ||
| export const updateActivityCard = async (cardId, { title, content }) => { | ||
| const response = await instance.patch(`/api/v1/admin/main/activity/${cardId}`, { title, content }); | ||
| return response.data?.data; | ||
| }; | ||
|
|
||
| /** | ||
| * (관리자) 주요활동 카드 초기화 | ||
| * @param {number} cardId - 초기화할 카드 ID | ||
| * @returns {Promise} | ||
| */ | ||
| export const clearActivityCard = (cardId) => | ||
| instance.patch(`/api/v1/admin/main/activity/${cardId}/clear`); | ||
|
|
||
| /** | ||
| * (관리자) 프로젝트 생성 | ||
| * @param {{ year, projectName, award, activity, startDate, endDate, participantCount, techStacks, description, photoKeys }} data | ||
| * @returns {Promise<Object>} { projectId, year, projectName, award, activity, startDate, endDate, participantCount, techStacks, description, photos } | ||
| */ | ||
| export const createProject = async (data) => { | ||
| const response = await instance.post('/api/v1/admin/project', data); | ||
| return response.data?.data; | ||
| }; | ||
|
|
||
| /** | ||
| * (관리자) 프로젝트 수정 | ||
| * keepPhotoIds로 유지할 기존 사진을, newPhotoKeys로 새로 추가할 사진의 objectKey를 전달한다. | ||
| * @param {number} projectId | ||
| * @param {{ year, projectName, award, activity, startDate, endDate, participantCount, techStacks, description, keepPhotoIds, newPhotoKeys }} data | ||
| * @returns {Promise<Object>} { projectId, year, projectName, award, activity, startDate, endDate, participantCount, techStacks, description, photos } | ||
| */ | ||
| export const updateProject = async (projectId, data) => { | ||
| const response = await instance.patch(`/api/v1/admin/project/${projectId}`, data); | ||
| return response.data?.data; | ||
| }; | ||
|
|
||
| /** | ||
| * (관리자) 프로젝트 삭제 | ||
| * @param {number} projectId | ||
| * @returns {Promise} | ||
| */ | ||
| export const deleteProject = (projectId) => instance.delete(`/api/v1/admin/project/${projectId}`); |
This file contains hidden or 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,36 @@ | ||
| import instance from './instance'; | ||
|
|
||
| /** | ||
| * Presigned 업로드 URL 발급 | ||
| * @param {'logo'|'project'} type - 업로드 대상 유형 | ||
| * @returns {Promise<{ uploadUrl: string, objectKey: string }>} | ||
| */ | ||
| export const getUploadUrl = async (type) => { | ||
| const response = await instance.get('/api/v1/files/upload-url', { params: { type } }); | ||
| return response.data?.data; | ||
| }; | ||
|
|
||
| /** | ||
| * 발급받은 Presigned URL에 파일을 MinIO로 직접 업로드 | ||
| * instance를 거치지 않는다 — baseURL/Authorization 헤더가 MinIO 요청에는 맞지 않기 때문. | ||
| * @param {string} uploadUrl | ||
| * @param {File} file | ||
| */ | ||
| const uploadFileToPresignedUrl = async (uploadUrl, file) => { | ||
| const response = await fetch(uploadUrl, { method: 'PUT', body: file }); | ||
| if (!response.ok) { | ||
| throw new Error('파일 업로드에 실패했습니다.'); | ||
| } | ||
| }; | ||
|
|
||
| /** | ||
| * 파일을 업로드하고 objectKey를 반환한다. | ||
| * @param {'logo'|'project'} type | ||
| * @param {File} file | ||
| * @returns {Promise<string>} objectKey | ||
| */ | ||
| export const uploadFile = async (type, file) => { | ||
| const { uploadUrl, objectKey } = await getUploadUrl(type); | ||
| await uploadFileToPresignedUrl(uploadUrl, file); | ||
| return objectKey; | ||
| }; |
This file contains hidden or 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,3 @@ | ||
| export const HOME_CONTENT_FETCH_ERROR_MESSAGE = '콘텐츠를 불러오지 못했습니다.'; | ||
| export const ACTIVITY_CARD_UPDATE_ERROR_MESSAGE = '카드 수정에 실패했습니다.'; | ||
| export const ACTIVITY_CARD_CLEAR_ERROR_MESSAGE = '카드 초기화에 실패했습니다.'; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.