Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
은지 committed Jun 9, 2024
2 parents b796b8c + 048d539 commit 6709a6c
Show file tree
Hide file tree
Showing 44 changed files with 2,001 additions and 559 deletions.
78 changes: 38 additions & 40 deletions .github/workflows/CI.yml
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
50 changes: 50 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions src/Apis/Applications/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
useMutation,
MutationOptions,
useQuery,
} from 'react-query';
import { useMutation, MutationOptions, useQuery } from 'react-query';
import { instance } from '../axios';
import { ApplicantInfoQueryStringType } from './request';
import { ApplicationResponse, InternshipStudentResponse } from './response';
Expand Down Expand Up @@ -101,3 +97,11 @@ export const useRejectApplication = (
}
);
};

/**지원서 총 개수 조회 */
export const useApplicationCount = () => {
return useQuery(['applicationCount'], async () => {
const { data } = await instance.get(`${router}/count`);
return data;
});
};
72 changes: 72 additions & 0 deletions src/Apis/Banners/index.ts
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,
}
);
};
10 changes: 10 additions & 0 deletions src/Apis/Banners/request.ts
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;
}
19 changes: 19 additions & 0 deletions src/Apis/Banners/response.ts
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;
}
8 changes: 8 additions & 0 deletions src/Apis/Companies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,11 @@ export const useChangeCompanyInfo = (
}
);
};

/**기업 총 개수 조회 */
export const useCompanyCount = () => {
return useQuery(['CompanyCount'], async () => {
const { data } = await instance.get(`${router}/count`);
return data;
});
};
41 changes: 14 additions & 27 deletions src/Apis/Files/index.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,36 @@
import { useMutation } from 'react-query';
// import { PresignedUrlRequest } from "./request"
import { PresignedUrlResponse } from './response';
import { instance } from '../axios';
import axios from 'axios';

// export const usePresignedUrl = () => {
// return useMutation(
// async (attachments: File[]) => {
// const files = attachments.map((item) => ({
// type: 'EXTENSION_FILE',
// file_name: item.name,
// }));

// const data = await instance.post(`${process.env.REACT_APP_BASE_URL}/files/pre-signed`, {files});

// return data;
// }, {
// onSuccess: ({data}) => {
// console.log(data);
// }
// }
// )
// }
// propsData: PresignedUrlRequest/
const EXTENSION_FILE = 'EXTENSION_FILE';

export const usePresignedUrl = () => {
return useMutation(
async (attachments: File[]) => {
const files = attachments.map((item) => ({
type: 'EXTENSION_FILE',
type: EXTENSION_FILE,
file_name: item.name,
}));

const { data: presignedUrls } =
await instance.post<PresignedUrlResponse>(
`${process.env.REACT_APP_BASE_URL}/files/pre-signed`,
{ files }
);
await instance.post<PresignedUrlResponse>(`/files/pre-signed`, {
files,
});
return { presignedUrls, attachments };
},
{
onSuccess: async ({ presignedUrls, attachments }) => {
onSuccess: async ({
presignedUrls,
attachments,
}: {
presignedUrls: PresignedUrlResponse;
attachments: File[];
}) => {
const uploadPromises = presignedUrls.urls.map(
// eslint-disable-next-line
({ pre_signed_url }, idx) => {
return (async () =>
(async () =>
await axios.put(
pre_signed_url,
attachments[idx]
Expand Down
12 changes: 7 additions & 5 deletions src/Apis/Files/request.ts
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;
}
12 changes: 5 additions & 7 deletions src/Apis/Files/response.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
export interface PresignedUrlResponse {
urls: [
{
file_path: string,
pre_signed_url: string
}
]
}
urls: {
file_path: string;
pre_signed_url: string;
}[];
}
Loading

0 comments on commit 6709a6c

Please sign in to comment.