-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,005 additions
and
216 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,47 +1,45 @@ | ||
name: node.js CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- "feature/**" | ||
- "hotfixes" | ||
- "develop" | ||
- "main" | ||
pull_request: | ||
branches: | ||
- "develop" | ||
push: | ||
branches: | ||
- 'feature/**' | ||
- 'hotfixes' | ||
- 'develop' | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- 'develop' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Cache dependencies | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install Dependencies | ||
# 이전의 cache가 없다면 의존성을 설치합니다. | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: npm ci | ||
|
||
- name: Build Packages | ||
run: npm run build | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Cache dependencies | ||
id: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: '**/node_modules' | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install Dependencies | ||
run: npm install | ||
|
||
- name: Build Packages | ||
run: npm run build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { MutationOptions, useMutation, useQuery } from 'react-query'; | ||
import { instance } from '../axios'; | ||
import { BannerListResponse } from './response'; | ||
import { useToastStore } from '@team-return/design-system'; | ||
|
||
const router = '/banners'; | ||
|
||
export const useCreateBanners = ( | ||
detail_id: number, | ||
banner_type: string, | ||
start_date: string, | ||
end_date: string | ||
) => { | ||
const data = { | ||
detail_id, | ||
banner_type, | ||
start_date, | ||
end_date, | ||
}; | ||
const { append } = useToastStore(); | ||
|
||
return useMutation( | ||
async (banner_url: string) => | ||
instance.post(`${router}`, { ...data, banner_url }), | ||
{ | ||
onSuccess: () => { | ||
append({ | ||
title: '성공적으로 추가되었습니다.', | ||
message: '', | ||
type: 'GREEN', | ||
}); | ||
}, | ||
onError: () => { | ||
append({ | ||
title: '추가에 실패했습니다.', | ||
message: '', | ||
type: 'RED', | ||
}); | ||
}, | ||
} | ||
); | ||
}; | ||
|
||
export const useGetBannerList = (is_opened: boolean) => { | ||
const params = { | ||
is_opened, | ||
}; | ||
return useQuery(['getBannerList', is_opened], async () => { | ||
const { data } = await instance.get<BannerListResponse>( | ||
`${router}/teacher`, | ||
{ | ||
params, | ||
} | ||
); | ||
return data; | ||
}); | ||
}; | ||
|
||
export const useDeleteBanner = ( | ||
banner_id: number, | ||
options: MutationOptions | ||
) => { | ||
return useMutation( | ||
async () => { | ||
const { data } = await instance.delete(`${router}/${banner_id}`); | ||
return data; | ||
}, | ||
{ | ||
...options, | ||
} | ||
); | ||
}; |
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,10 @@ | ||
export interface DateProps { | ||
banner_url: string; | ||
start_date: string; | ||
end_date: string; | ||
banner_type: string; | ||
} | ||
|
||
export interface BannerProps { | ||
banner_id: number; | ||
} |
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,19 @@ | ||
export interface BannerListProps { | ||
id: number; | ||
banner_url: string; | ||
start_date: string; | ||
end_date: string; | ||
banner_type: string; | ||
} | ||
|
||
export interface BannerListResponse { | ||
banners: BannerListProps[]; | ||
} | ||
|
||
export interface BannerNameType { | ||
RECRUITMENT: string; | ||
BOOKMARK: string; | ||
NONE: string; | ||
INTERNSHIP: string; | ||
COMPANY: string; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
export interface PresignedUrlRequest { | ||
files: { | ||
type: string | ||
file_name: string | ||
}[] | ||
} | ||
files: FileInfoType[]; | ||
} | ||
|
||
export interface FileInfoType { | ||
type: string; | ||
file_name: string; | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export interface PresignedUrlResponse { | ||
urls: { | ||
file_path: string, | ||
pre_signed_url: string, | ||
}[] | ||
} | ||
urls: { | ||
file_path: string; | ||
pre_signed_url: string; | ||
}[]; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.