Skip to content

Commit 06ca0ba

Browse files
authored
XQAURE 배포 트리거 (#174)
2 parents 6461422 + 0e76d8f commit 06ca0ba

56 files changed

Lines changed: 1241 additions & 326 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: git push into another repo to deploy to vercel
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
container: pandoc/latex
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Install mustache (to update the date)
14+
run: apk add ruby && gem install mustache
15+
- name: creates output
16+
run: sh ./build.sh
17+
- name: Pushes to another repository
18+
id: push_directory
19+
uses: cpina/github-action-push-to-another-repository@main
20+
env:
21+
API_TOKEN_GITHUB: ${{ secrets.AUTH_TOKEN }}
22+
with:
23+
source-directory: 'output'
24+
destination-github-username: teamreturn
25+
destination-repository-name: JOBIS-FE
26+
user-email: ${{ secrets.OFFICIAL_ACCOUNT_EMAIL }} // 변경
27+
commit-message: ${{ github.event.commits[0].message }}
28+
target-branch: main
29+
- name: Test get variable exported by push-to-another-repository
30+
run: echo $DESTINATION_CLONED_DIRECTORY

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,6 @@ dist
6464
**/build
6565

6666
.env
67-
**/.env
67+
**/.env
68+
.cursor/rules/nx-rules.mdc
69+
.github/instructions/nx.instructions.md

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 20.11.1

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,5 @@ yarn lint
8989
```
9090
yarn lint:styled
9191
```
92+
93+
test

apps/admin/README.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1 @@
1-
# React + TypeScript + Vite
2-
3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4-
5-
Currently, two official plugins are available:
6-
7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9-
10-
## Expanding the ESLint configuration
11-
12-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
13-
14-
- Configure the top-level `parserOptions` property like this:
15-
16-
```js
17-
export default {
18-
// other rules...
19-
parserOptions: {
20-
ecmaVersion: 'latest',
21-
sourceType: 'module',
22-
project: ['./tsconfig.json', './tsconfig.node.json'],
23-
tsconfigRootDir: __dirname,
24-
},
25-
}
26-
```
27-
28-
- Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
29-
- Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
30-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
1+
# JOBIS 어드민 페이지

apps/admin/src/apis/applications/index.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import type { ApplicationENStatusType } from "@/@types/types";
2-
import { instance, type ApplicationResponse } from "@/apis";
2+
import {
3+
instance,
4+
type ApplicationResponse,
5+
type EmploymentStatsResponse,
6+
} from "@/apis";
37
import { convertObjectToQueryString } from "@/utils";
48
import {
59
useMutation,
@@ -95,3 +99,49 @@ export const useRejectApplication = (
9599
},
96100
});
97101
};
102+
103+
/** 현재 취업 현황 조회 */
104+
export const useEmploymentStats = () => {
105+
return useQuery({
106+
queryKey: ["employmentStats"],
107+
queryFn: async () => {
108+
const { data } = await instance.get<EmploymentStatsResponse>(
109+
`${router}/employment`
110+
);
111+
return data;
112+
},
113+
});
114+
};
115+
116+
/** MOU회사 외 학생 합격처리 */
117+
export const useApproveStudents = (
118+
recruitmentId: number,
119+
studentGcns: Array<number>,
120+
option: MutationOptions
121+
) => {
122+
return useMutation({
123+
...option,
124+
mutationFn: () =>
125+
instance.post(`${router}/teacher/${recruitmentId}`, {
126+
student_gcns: studentGcns.map(e => e.toString()),
127+
}),
128+
onError: (err: AxiosError<AxiosError>) => {
129+
if (err.response) {
130+
switch (err.response.status) {
131+
case 401:
132+
toast.error("3학년이 아닌 학생이 있어요.");
133+
break;
134+
135+
case 404:
136+
toast.error("학생을 찾을 수 없어요.");
137+
break;
138+
139+
case 409:
140+
toast.error("이미 합격처리된 학생이 있어요.");
141+
}
142+
} else {
143+
toast.error("네트워크 연결을 확인해주세요.");
144+
}
145+
},
146+
});
147+
};

apps/admin/src/apis/applications/type.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ export type AttachmentUrlType = {
1818
url: string;
1919
type: string;
2020
};
21+
22+
export type EmploymentStatsResponse = {
23+
classes: {
24+
class_id: number;
25+
employment_rate_response_list: {
26+
id: number;
27+
company_name: string;
28+
logo_url: string;
29+
}[];
30+
total_students: number;
31+
passed_students: number;
32+
}[];
33+
};

apps/admin/src/apis/companies/index.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,55 @@ export const useChangeCompanyMOU = (
7777
},
7878
});
7979
};
80+
81+
/** 기업체 등록(선생님) */
82+
export const useRegisterCompany = (
83+
companyName: string,
84+
businessNumber: string,
85+
companyProfileUrl: string,
86+
option: MutationOptions
87+
) => {
88+
return useMutation({
89+
...option,
90+
mutationFn: () =>
91+
instance
92+
.post(`${router}/teacher`, {
93+
company_name: companyName,
94+
business_number: businessNumber,
95+
company_profile_url: companyProfileUrl,
96+
})
97+
.then(async () => {
98+
const res = await instance.get("/recruitments/teacher/manual");
99+
const list: {
100+
id: number;
101+
company_name: string;
102+
company_profile_url: string;
103+
}[] = res.data.recruitments;
104+
105+
const target = list.find(e => e.company_name == companyName);
106+
107+
if (!target) {
108+
throw new Error("기업이 추가되지 않았습니다.");
109+
}
110+
return target.id;
111+
}),
112+
onError: (err: AxiosError<AxiosError>) => {
113+
if (err.response) {
114+
switch (err.response.status) {
115+
case 400:
116+
toast.error("정보를 전부 입력해주세요.");
117+
break;
118+
119+
case 404:
120+
toast.error("유효하지 않은 사업자 등록 번호입니다.");
121+
break;
122+
123+
case 409:
124+
toast.error("이미 존재하는 기업입니다.");
125+
}
126+
} else {
127+
toast.error("네트워크 연결을 확인해주세요.");
128+
}
129+
},
130+
});
131+
};

apps/admin/src/apis/companies/type.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ export type CompanyType = {
1616
total_acceptance_count: number;
1717
review_count: number;
1818
};
19+
20+
export type RegisterCompanyRequest = {
21+
companyName: string;
22+
businessNumber: string;
23+
companyProfileUrl: string;
24+
};

apps/admin/src/apis/files/index.ts

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useMutation } from "@tanstack/react-query";
2-
import axios from "axios";
1+
import { MutationOptions, useMutation } from "@tanstack/react-query";
2+
import axios, { AxiosError } from "axios";
33
import toast from "react-hot-toast";
44
import fileSaver from "file-saver";
55

@@ -36,3 +36,52 @@ export const useDownloadData = () => {
3636
},
3737
});
3838
};
39+
40+
/** S3에 이미지 미리보기 링크 생성 */
41+
export const usePresignLogoFile = (
42+
getFileCallback: (arg: void) => File,
43+
cleanUp: (arg: void) => void,
44+
option: MutationOptions<string>
45+
) => {
46+
const file = getFileCallback();
47+
const presign = async (targetFile: File) => {
48+
const logo = {
49+
type: "LOGO_IMAGE",
50+
file_name: targetFile.name,
51+
};
52+
const { data } = await axios.post<{
53+
urls: {
54+
file_path: string;
55+
pre_signed_url: string;
56+
}[];
57+
}>(`${import.meta.env.VITE_BASE_URL}/files/pre-signed`, {
58+
files: [logo],
59+
});
60+
return { data, presignedFile: targetFile };
61+
};
62+
return useMutation({
63+
...option,
64+
mutationFn: () =>
65+
presign(file).then(({ data, presignedFile }) => {
66+
const url = data.urls[0];
67+
68+
return new Promise<string>(resolve => {
69+
axios
70+
.put(url.pre_signed_url, presignedFile)
71+
.then(() =>
72+
resolve(`${import.meta.env.VITE_FILE_URL}${url.file_path}`)
73+
);
74+
});
75+
}),
76+
onError: (err: AxiosError<AxiosError>) => {
77+
if (err.response) {
78+
if (err.response?.data.message === "Invalid Extension File") {
79+
toast.error("지원하지 않는 형식의 파일입니다.");
80+
}
81+
} else {
82+
toast.error("네트워크 연결을 확인해주세요.");
83+
}
84+
cleanUp();
85+
},
86+
});
87+
};

0 commit comments

Comments
 (0)