Skip to content

Commit

Permalink
Merge pull request #1361 from 42organization/recruit
Browse files Browse the repository at this point in the history
[test-deploy] recruit admin 수정사항 배포
  • Loading branch information
yoouyeon authored Apr 6, 2024
2 parents 2cb711a + 1873581 commit 1a5af9b
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 43 deletions.
16 changes: 8 additions & 8 deletions components/admin/recruitments/RecruitmentsHistoryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
RecruitmentDetailProps,
RecruitmentsPages,
} from 'types/admin/adminRecruitmentsTypes';
import { instanceInManage } from 'utils/axios';
import { instance } from 'utils/axios';
import { dateToStringShort } from 'utils/handleTime';
import { toastState } from 'utils/recoil/toast';
import { tableFormat } from 'constants/admin/table';
Expand Down Expand Up @@ -48,7 +48,7 @@ function RecruitmentsHistoryList({
setPage: Dispatch<SetStateAction<RecruitmentsPages>>;
}) {
const [recruitData, setRecruitData] = useState<IrecruitTable>({
recruitment: [],
recruitmentDtoList: [],
totalPage: 0,
currentPage: 0,
});
Expand All @@ -59,12 +59,12 @@ function RecruitmentsHistoryList({

const getRecruitHandler = useCallback(async () => {
try {
const res = await instanceInManage.get(
`/recruitments?page=${currentPage}&size=20`
const res = await instance.get(
`/admin/recruitments?page=${currentPage}&size=20`
);
// FIXME : 페이지네이션 x 임시로 1페이지로 고정
setRecruitData({
recruitment: res.data.recruitments,
recruitmentDtoList: res.data.recruitmentDtoList,
totalPage: 1,
currentPage: 1,
});
Expand Down Expand Up @@ -156,8 +156,8 @@ function RecruitmentsHistoryList({
<Table className={styles.table} aria-label='customized table'>
<AdminTableHead tableName={'recruitment'} table={tableTitle} />
<TableBody className={styles.tableBody}>
{recruitData.recruitment.length > 0 ? (
recruitData.recruitment.map((recruit: Irecruit) => (
{recruitData.recruitmentDtoList.length > 0 ? (
recruitData.recruitmentDtoList.map((recruit: Irecruit) => (
<TableRow className={styles.tableRow} key={recruit.id}>
{tableFormat['recruitment'].columns.map(
(columnName: string, index: number) => (
Expand All @@ -169,7 +169,7 @@ function RecruitmentsHistoryList({
</TableRow>
))
) : (
<AdminEmptyItem content={'공고 지원자 내역이 비어있습니다'} />
<AdminEmptyItem content={'공고 내역이 비어있습니다'} />
)}
</TableBody>
</Table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
RecruitmentDetailProps,
RecruitmentsMainProps,
} from 'types/admin/adminRecruitmentsTypes';
import { instanceInManage } from 'utils/axios';
import { instance } from 'utils/axios';
import { toastState } from 'utils/recoil/toast';
import styles from 'styles/admin/recruitments/recruitmentDetail/RecruitmentDetail.module.scss';
import ActionSelectorButtons from './components/ActionSelectorButtons';
Expand All @@ -33,7 +33,7 @@ export default function RecruitmentDetail({
const getRecruitmentInfo = async () => {
setIsLoading(true);
try {
const res = await instanceInManage.get('/recruitments/' + recruit.id);
const res = await instance.get('/recruitments/' + recruit.id);
const data: Irecruit = {
id: recruit.id,
status: recruit.status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export default function ActionSelectorButtons({

const getRecruitHandler = async () => {
try {
const res = await instanceInManage.get(
`/recruitments?page=${1}&size=${100}`
// FIXME : 1페이지 고정인 부분 주석으로 설명 추가해주세요. (의도된것인지 / 최근 100개만 보는 것인지 등)
const res = await instance.get(
`/admin/recruitments?page=${1}&size=${100}`
);
console.log(res.data.recruitments);
setRecruitmentsHistory(res.data.recruitments);
setRecruitmentsHistory(res.data.recruitmentDtoList);
} catch (e: any) {
setSnackBar({
toastName: 'get recruitment',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ const tableTitle: { [key: string]: string } = {
};

function DetailRecruitUserList({ recruitId }: { recruitId: number }) {
const [currentPage, setCurrentPage] = useState<number>(1);
// const [currentPage, setCurrentPage] = useState<number>(1);
const { recruitUserData, questions } = useRecruitmentUserFilter(
recruitId,
currentPage
recruitId
// currentPage
);

if (!recruitUserData.applications) {
if (!recruitUserData.applicationResults?.length) {
return (
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='customized table'>
Expand All @@ -47,7 +47,7 @@ function DetailRecruitUserList({ recruitId }: { recruitId: number }) {

return (
<>
{FilterQptionsUI(recruitUserData.applications)}
{FilterQptionsUI(recruitUserData.applicationResults, recruitId)}
<TableContainer className={styles.tableContainer} component={Paper}>
<Table className={styles.table} aria-label='customized table'>
<TableHead className={styles.tableHeader}>
Expand All @@ -63,20 +63,20 @@ function DetailRecruitUserList({ recruitId }: { recruitId: number }) {
</TableRow>
</TableHead>
<TableBody className={styles.tableBody}>
{recruitUserData.applications.map((recruit) =>
{recruitUserData.applicationResults.map((recruit) =>
renderTableCells(recruit, questions)
)}
</TableBody>
</Table>
</TableContainer>
<div className={styles.pageNationContainer}>
<PageNation
{/* <PageNation
curPage={recruitUserData.currentPage}
totalPages={recruitUserData.totalPage}
pageChangeHandler={(pageNumber: number) => {
setCurrentPage(pageNumber);
}}
/>
/> */}
</div>
</>
);
Expand Down
11 changes: 8 additions & 3 deletions components/admin/recruitments/recruitmentsuser/FilterOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ const MenuProps = {
},
};

function FilterQptionsUI(recruitUserData: IrecruitUserTable[]) {
// FIXME : FilterQptionsUI 이름 변경하기 (의미를 알아보기 어려움)
function FilterQptionsUI(
recruitUserData: IrecruitUserTable[],
recruitId: number
) {
const [answers, setAnswers] = useState<Array<IcheckItem>>([]);
const { checklistIds, handleChecklistChange } = useRecruitmentUserFilter();
const { checklistIds, handleChecklistChange } =
useRecruitmentUserFilter(recruitId);

useEffect(() => {
setAnswers(
Expand All @@ -50,7 +55,7 @@ function FilterQptionsUI(recruitUserData: IrecruitUserTable[]) {
return (
<div className={styles.filterWrap}>
<div className={styles.searchWrap}>
<RecruitSearchBar />
<RecruitSearchBar recruitId={recruitId} />
</div>
<div className={styles.selectWrap}>
<FormControl sx={{ m: 1, width: 200 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Inotication,
InoticationTable,
} from 'types/admin/adminRecruitmentsTypes';
import { instanceInManage } from 'utils/axios';
import { instance } from 'utils/axios';
import { modalState } from 'utils/recoil/modal';
import { toastState } from 'utils/recoil/toast';
import { tableFormat } from 'constants/admin/table';
Expand Down Expand Up @@ -103,8 +103,8 @@ function NotificationResults({ recruitId }: { recruitId: number }) {
// const res = await instanceInManage.get(
// `/admin/recruitments?page=${currentPage}&size=20`
// );
const res = await instanceInManage.get(
`/recruitments/${recruitId}/applicants`
const res = await instance.get(
`/admin/recruitments/${recruitId}/applicants`
);
// FIXME : 페이지네이션 x 임시로 1페이지로 고정
setNotificationData({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import styles from 'styles/admin/common/AdminSearchBar.module.scss';

const MAX_SEARCH_LENGTH = 15;

export default function RecruitSearchBar() {
export default function RecruitSearchBar({ recruitId }: { recruitId: number }) {
const { keyword, setKeyword, searchBarRef } = useSearchBar();

const { initSearch } = useRecruitmentUserFilter();
const { initSearch } = useRecruitmentUserFilter(recruitId);

const adminhandleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
if (event.key === 'Enter') {
Expand Down
4 changes: 2 additions & 2 deletions hooks/recruitments/useRecruitmentEditInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Iquestion,
Irecruit,
} from 'types/admin/adminRecruitmentsTypes';
import { instanceInManage } from 'utils/axios';
import { instance } from 'utils/axios';
import { toastState } from 'utils/recoil/toast';

export interface IFormManager {
Expand Down Expand Up @@ -198,7 +198,7 @@ export default function useRecruitmentEditInfo(
const importRecruitmentInfo = async (recruitId: number) => {
if (recruitId <= 0) return;
try {
const res = await instanceInManage.get('/recruitments/' + recruitId);
const res = await instance.get('/recruitments/' + recruitId);
const data: Irecruit = {
title: res.data.title,
startDate: new Date(res.data.startDate),
Expand Down
18 changes: 9 additions & 9 deletions hooks/recruitments/useRecruitmentUserFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
IcheckItem,
IrecruitArrayTable,
} from 'types/admin/adminRecruitmentsTypes';
import { instanceInManage } from 'utils/axios';
import { instance } from 'utils/axios';
import { toastState } from 'utils/recoil/toast';

// FIXME: 컴포넌트 이름 오타 수정
const useRucruitmentUserFilter = (currentPage?: number, recruitId?: number) => {
// FIXME : 페이지네이션 여부 담당자와 다시 확인하기 (현재 페이지네이션 없음)
const useRecruitmentUserFilter = (recruitId: number, currentPage?: number) => {
const [recruitUserData, setRecruitUserData] = useState<IrecruitArrayTable>({
applications: [],
applicationResults: [],
totalPage: 0,
currentPage: 0,
});
Expand All @@ -32,12 +32,12 @@ const useRucruitmentUserFilter = (currentPage?: number, recruitId?: number) => {
// }
// }
// );
const res = await instanceInManage.get(
`/recruitments/${recruitId}/applicants`
const res = await instance.get(
`/admin/recruitments/${recruitId}/applicants`
);
// FIXME: 페이지네이션 x (페이지네이션이 없는 api?) 임시로 1페이지로 고정
setRecruitUserData({
applications: res.data.applicationResults,
applicationResults: res.data.applicationResults,
totalPage: 1,
currentPage: 1,
});
Expand All @@ -60,7 +60,7 @@ const useRucruitmentUserFilter = (currentPage?: number, recruitId?: number) => {
getRecruitUserHandler();
}, [currentPage, searchString, checklistIds]);

const questions = recruitUserData.applications.reduce(
const questions = recruitUserData.applicationResults?.reduce(
(acc: string[], application: { form: { question: string }[] }) => {
application.form.forEach(({ question }) => {
if (acc.indexOf(question) === -1) {
Expand Down Expand Up @@ -98,4 +98,4 @@ const useRucruitmentUserFilter = (currentPage?: number, recruitId?: number) => {
};
};

export default useRucruitmentUserFilter;
export default useRecruitmentUserFilter;
4 changes: 2 additions & 2 deletions types/admin/adminRecruitmentsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface Inotication {
}

export interface IrecruitTable {
recruitment: Array<Irecruit>;
recruitmentDtoList: Array<Irecruit>;
totalPage: number;
currentPage: number;
}
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface IrecruitUserTable {
}

export interface IrecruitArrayTable {
applications: IrecruitUserTable[];
applicationResults: IrecruitUserTable[];
totalPage: number;
currentPage: number;
}
Expand Down

0 comments on commit 1a5af9b

Please sign in to comment.