Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#53-NoticeApi
Browse files Browse the repository at this point in the history
  • Loading branch information
jikwan0327 authored Apr 22, 2024
2 parents b7fa270 + 7587015 commit 896be14
Show file tree
Hide file tree
Showing 41 changed files with 693 additions and 173 deletions.
Binary file removed public/WinterIntrenBanner.webp
Binary file not shown.
18 changes: 2 additions & 16 deletions src/apis/applications/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function useApplyToCompany(recruitmentId: string) {
case 404:
append({
title: "",
message: "모집의뢰서가 존재하지 않습니다.",
message: "모집 기간이 아니거나 모집의뢰서가 존재하지 않습니다.",
type: "RED",
});
break;
Expand Down Expand Up @@ -85,28 +85,14 @@ export function useReapply(applicationId: string | null) {
message: "승인요청 또는 반려상태가 아닙니다.",
type: "RED",
});
case 401:
append({
title: "",
message: "3학년이 아닌 학생은 지원할 수 없습니다.",
type: "RED",
});
break;
case 404:
append({
title: "",
message: "모집의뢰서가 존재하지 않습니다.",
message: "지원서가 존재하지 않습니다.",
type: "RED",
});
break;
case 409:
append({
title: "",
message:
"이미 해당 모집의뢰에 지원했거나 승인된 지원요청이 존재합니다.",
type: "RED",
});

default:
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/apis/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { AuthCode, IAuthorizationResponse, SendAuthCodeType } from "./type";
const router = "/auth";

export const useReissueToken = async (refresh_token: string) => {
const response = await axios.put<IAuthorizationResponse>(
`${process.env.NEXT_PUBLIC_BASE_URL}${router}/reissue?platform_type=WEB`,
const response = await axios.put<IAuthorizationResponse>(
`${process.env.NEXT_PUBLIC_BASE_URL}${router}/reissue?platform-type=WEB`,
null,
{
headers: {
Expand Down
2 changes: 2 additions & 0 deletions src/apis/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ instance.interceptors.response.use(
const accessExpired = new Date(res.access_expires_at);
const refreshExpired = new Date(res.refresh_expires_at);
cookies.set("access_token", res.access_token, {
path: '/',
expires: accessExpired,
});
cookies.set("refresh_token", res.refresh_token, {
path: '/',
expires: refreshExpired,
});
if (config!.headers) {
Expand Down
9 changes: 5 additions & 4 deletions src/apis/bookmarks/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ export interface BookmarkResponseType {
}

export interface BookmarkItemsType {
company_name: string;
recruitment_id: number;
created_at: string;
}
"company_logo_url": string;
"company_name": string;
"recruitment_id": number;
"created_at": string;
}
12 changes: 11 additions & 1 deletion src/apis/companies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useQuery } from "@tanstack/react-query";
import { useToastStore } from "@team-return/design-system";
import { instance } from "../axios";
import { GetNumberOfPagesType } from "../recruitments/type";
import { CompaniesDetailsType, CompaniesListResponseType } from "./type";
import { CompaniesDetailsType, CompaniesListResponseType, GetCompaniesForReviewingResponse } from "./type";

const router = "/companies";

Expand Down Expand Up @@ -56,3 +56,13 @@ export const useGetNumberOfCompaniesListPages = (queryString: string) => {
);
return data;
};

export const useGetCompaniesForReviewing = () => {
return useQuery(
["getCompaniesForReviewing"],
async () => {
const {data} = await instance.get<GetCompaniesForReviewingResponse>(`${router}/review`);
return data;
}
)
}
12 changes: 11 additions & 1 deletion src/apis/companies/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,20 @@ export interface CompaniesDetailsTable {
fax: string | null;
email: string;
representative_name: string;
representative_phone_no: string;
founded_at: string;
worker_number: number;
take: number;
attachments: any[];
service_name: string;
business_area: string;
}
}

export interface CompaniesForReviewType {
id: number,
name: string,
}

export interface GetCompaniesForReviewingResponse {
companies : CompaniesForReviewType[]
}
23 changes: 17 additions & 6 deletions src/apis/file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,23 @@ export const useCreatePresignedURL = () => {
});
},
onError: (error: AxiosError) => {
if (error.response)
append({
title: "",
message: "파일 업로드에 실패했습니다.",
type: "RED",
});
switch (error.response?.status) {
case 400 : {
append({
title: '',
message: '잘못된 파일 확장자입니다.',
type: 'RED',
})
}
break;
default : {
append({
title: "",
message: "파일 업로드에 실패했습니다.",
type: "RED",
});
}
}
},
}
);
Expand Down
16 changes: 12 additions & 4 deletions src/apis/recruitments/type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { instance } from "../axios";
export interface RecruitmentsListResponseType {
recruitments: RecruitmentsListType[];
}
Expand All @@ -17,13 +18,15 @@ export interface RecruitmentsDetailType extends RecruitmentsDetailTable {
company_id: number;
company_profile_url: string;
company_name: string;
bookmarked: boolean;
recruitment_id: number;
is_applicable: boolean;
}

export interface RecruitmentsDetailTable {
areas: AreasType[];
required_grade: number | null;
start_time: string;
end_time: string;
working_hours: string;
required_licenses: string[] | [];
hiring_progress: HiringProgressType[];
train_pay: number;
Expand All @@ -36,10 +39,15 @@ export interface RecruitmentsDetailTable {
etc: string | null;
}

interface CodeType {
id: number;
name: string;
}

export interface AreasType {
id: number;
job: string[];
tech: string[];
job: CodeType[];
tech: CodeType[];
hiring: number;
major_task: string;
preferential_treatment: string | null;
Expand Down
51 changes: 49 additions & 2 deletions src/apis/reviews/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { useQuery } from "@tanstack/react-query";
import { MutationOptions, useMutation, UseMutationOptions, useQuery } from "@tanstack/react-query";
import { useToastStore } from "@team-return/design-system";
import { AxiosError, AxiosResponse } from "axios";
import { instance } from "../axios";
import {
getReviewDetailResponseProps,
getReviewListResponseProps
getReviewListResponseProps,
createReviewRequestType,
} from "./type";

const router = "/reviews";
Expand All @@ -24,3 +27,47 @@ export const useGetReviewDetails = (reviewId: string) => {
return data;
});
};

export const useCreateReviews = (options: Omit<UseMutationOptions<AxiosResponse<any, any>, unknown, createReviewRequestType, unknown>, "mutationFn">) => {
const { append } = useToastStore();
return useMutation(
async (body: createReviewRequestType) =>
await instance.post(`${router}`, body),
{
...options,
onError: (err: AxiosError) => {
const { response } = err;
switch (response?.status) {
case 400: {
append({
title: "",
message: "입력값은 비어있으면 안됩니다.",
type: "RED",
});
break;
}
case 404: {
switch ((response as AxiosResponse<{ message: string }>).data.message) {
case "Code Not Found": {
append({
title: "",
message: "질문 분야가 누락되었습니다.",
type: "RED",
});
break;
}
case 'ApplicationEntity Not Found': {
append({
title: '',
message: '해당 기업에는 후기를 작성할 수 없습니다.',
type: 'RED',
})
}
}

}
}
},
}
);
};
11 changes: 11 additions & 0 deletions src/apis/reviews/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ export interface getReviewDetailProps {
answer: string;
area: string;
}

export interface qnaElementsType {
question: string;
answer: string;
code_id: number;
}

export interface createReviewRequestType {
company_id: number;
qna_elements: qnaElementsType[]
}
90 changes: 90 additions & 0 deletions src/app/companies/reviews/create/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"use client";

import { useState } from "react";
import ReviewForm from "@/components/company/ReviewForm";
import FillBtn from "@/components/common/Button/FillBtn";
import { useRouter, useSearchParams } from "next/navigation";
import { useCreateReviews } from "@/apis/reviews";
import { qnaElementsType } from "@/apis/reviews/type";

export default function CreateReviews() {
const router = useRouter();
const params = useSearchParams();
const companyId = Number(params.get('id'))
const [qnaElements, setQnaElements] = useState<qnaElementsType[]>([
{ question: "", answer: "", code_id: 0 },
]);
const mutateOption = {
onSuccess: () => {
router.push(`/companies/reviews/?id=${companyId}`)
}
}
const { mutate: createReviews } = useCreateReviews(mutateOption);

const handleClickCreateRevies = () => {
createReviews({
company_id:companyId,
qna_elements: qnaElements
})
}

const handleChange = (
index: number,
name: keyof qnaElementsType,
value: string | number
) => {
setQnaElements(prev => {
const newReviews = [...prev];
if (typeof value === "number") {
newReviews[index].code_id = value;
} else if (name !== "code_id") {
newReviews[index][name] = value;
}
return newReviews;
});
};

const removeReviewList = (index: number) => {
setQnaElements(prev=>{
let newReviews = [...prev];
newReviews = newReviews.filter((_,idx)=>idx !== index);
return newReviews;
})
}

return (
<div className="w-2/3 mx-auto my-5">
<p className="py-12 leading-10 text-center text-h4 font-b text-primaryBlue03">
후기작성
</p>
{qnaElements
.map((qnaElement, idx) => (
<ReviewForm key={idx} onChange={handleChange} removeReviews={removeReviewList} setState={setQnaElements} index={idx} {...qnaElement} />
))}
<div className="flex justify-between">
<FillBtn
backgroundColor="#ccc"
onClick={() => {
setQnaElements(prev => ([
...prev,
{ question: "", answer: "", code_id: 0 }
]));
}}
>
면접질문 추가
</FillBtn>
<div className="flex gap-3">
<FillBtn
backgroundColor="#ccc"
onClick={() => {
router.back();
}}
>
이전으로
</FillBtn>
<FillBtn onClick={handleClickCreateRevies}>완료</FillBtn>
</div>
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion src/app/companies/reviews/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default function Reviews() {
return (
<div className="w-2/3 mx-auto my-5">
<p className="py-12 leading-10 text-center text-h4 font-b text-primaryBlue03">
면접 후기
면접후기
</p>
<hr className="border-[#135C9D]" />
<ReviewList />
Expand Down
12 changes: 12 additions & 0 deletions src/app/employmentStatus/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default function EmploymentStatus() {
return (
<main className="w-full py-12">
<section>
<div className="w-full h-[200px] bg-white shadow-[0px_4px_20px_0px_rgba(112,144,176,0.12)] rounded-[12px] py-[33px] px-[47px]">
<h3 className="text-h5 font-bold">2023학년도 DSM의 <span className="text-[#237BC9]">취업률</span>을 확인해 보세요</h3>
<p className="text-b3 text-[#7f7f7f]">현재 <span className="text-[#237BC9]">100%</span>의 학생들이 취업에 성공했어요!</p>
</div>
</section>
</main>
)
}
Loading

0 comments on commit 896be14

Please sign in to comment.