Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions service-apply/src/apis/dtos/registration.dtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface TemporarySaveRequestProps extends RegistrationEventIdResponse {
name: string;
studentNumber: string;
affiliation: string;
department: string;
carNumber: string;
isLightCar: boolean;
phoneNumber: string;
Expand All @@ -16,6 +17,7 @@ export class TemporarySaveRequest {
name: string;
studentNum: string;
affiliation: string;
department: string;
carNum: string;
isLight: boolean;
phoneNum: string;
Expand All @@ -26,6 +28,7 @@ export class TemporarySaveRequest {
name,
studentNumber,
affiliation,
department,
carNumber,
isLightCar,
phoneNumber,
Expand All @@ -35,6 +38,7 @@ export class TemporarySaveRequest {
this.name = name;
this.studentNum = studentNumber;
this.affiliation = affiliation;
this.department = department;
this.carNum = carNumber;
this.isLight = isLightCar;
this.phoneNum = phoneNumber;
Expand All @@ -56,6 +60,7 @@ export class RegistrationRequest extends TemporarySaveRequest {
name,
studentNumber,
affiliation,
department,
carNumber,
isLightCar,
phoneNumber,
Expand All @@ -68,6 +73,7 @@ export class RegistrationRequest extends TemporarySaveRequest {
name,
studentNumber,
affiliation,
department,
carNumber,
isLightCar,
phoneNumber,
Expand Down Expand Up @@ -100,6 +106,7 @@ interface RegistrationResponseProps {
sectorName: string;
}[];
affiliation: string;
department: string;
selectSectorId?: number;
}

Expand All @@ -111,6 +118,7 @@ export class RegistrationOptionsResponse {
phoneNumber: string;
studentNumber: string;
affiliation: string;
department: string;
sector: {
sectorId: number;
sectorNum: string;
Expand All @@ -127,6 +135,7 @@ export class RegistrationOptionsResponse {
studentNum,
selectSectorId,
affiliation,
department,
}: RegistrationResponseProps) {
this.carNumber = carNum || '';
this.email = email || '';
Expand All @@ -137,6 +146,7 @@ export class RegistrationOptionsResponse {
this.studentNumber = studentNum || '';
this.selectSectorId = selectSectorId;
this.affiliation = affiliation || '';
this.department = department || '';
}
}

Expand Down
2 changes: 2 additions & 0 deletions service-apply/src/apis/registration.apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const getRegistration = async ({
name: '',
selectSectorId: -1,
affiliation: '',
department: '',
});
}
return new RegistrationOptionsResponse(response);
Expand All @@ -79,6 +80,7 @@ export const getCaptcha = async () => {

export const getRegistrationPeriod = async (): Promise<Period> => {
const response = await https.get('/v1/events/period');

if (isErrorResponse(response)) {
const errorContent = getErrorContent(response.code);
switch (errorContent.type) {
Expand Down
13 changes: 11 additions & 2 deletions service-apply/src/components/apply/ApplyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ApplyCaptchaModal } from './ApplyCaptchaModal';
import { Suspense } from 'react';
import ErrorBoundary from '../common/ErrorBoundary';
import { AFFILIATION_LIST } from '../../constants/affiliation';
import { DEPARTMENT_LIST } from '../../constants/department';
import { PrivacyCheckModal } from './PrivacyCheckModal';
import { Spinner } from '../../assets/Spinner';

Expand Down Expand Up @@ -124,22 +125,30 @@ export const ApplyForm = () => {
<ApplySelector
label="소속대학"
name="affiliation"
type="text"
options={AFFILIATION_LIST}
value={state.affiliation}
onChange={(e) =>
dispatch({ type: 'affiliation', payload: e.target.value })
}
required
/>
<ApplySelector
label="소속학과"
name="department"
options={DEPARTMENT_LIST}
value={state.department}
onChange={(e) =>
dispatch({ type: 'department', payload: e.target.value })
}
required
/>
<ApplySelector
value={
parkingSectionOptions.find(
(section) => '' + state.section === section.value,
)?.value ?? '선택'
}
label="구간"
type="text"
options={parkingSectionOptions}
onChange={(e) =>
dispatch({ type: 'section', payload: e.target.value })
Expand Down
2 changes: 0 additions & 2 deletions service-apply/src/components/apply/ApplySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Txt } from '@quokka/design-system';
interface ApplySelectorProps
extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'value'> {
label: string;
type: string;
options: {
label: string;
value: string;
Expand All @@ -14,7 +13,6 @@ interface ApplySelectorProps

export const ApplySelector = ({
label,
type,
options,
value,
...props
Expand Down
87 changes: 87 additions & 0 deletions service-apply/src/constants/department.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
export const DEPARTMENT_LIST = [
{ value: '', label: '선택' },
{ value: '가정교육과', label: '가정교육과' },
{ value: '간호학과', label: '간호학과' },
{ value: '건축학부', label: '건축학부' },
{ value: '경영학부', label: '경영학부' },
{ value: '경제학부', label: '경제학부' },
{ value: '고분자융합소재공학부', label: '고분자융합소재공학부' },
{ value: '교육학과', label: '교육학과' },
{ value: '국악학과', label: '국악학과' },
{ value: '국어교육과', label: '국어교육과' },
{ value: '국어국문학과', label: '국어국문학과' },
{ value: '농생명화학과', label: '농생명화학과' },
{ value: '농업경제학과', label: '농업경제학과' },
{ value: '독일언어문학과', label: '독일언어문학과' },
{ value: '동물자원학부', label: '동물자원학부' },
{ value: '디자인학과', label: '디자인학과' },
{ value: '문헌정보학과', label: '문헌정보학과' },
{ value: '문화인류고고학과', label: '문화인류고고학과' },
{ value: '미디어커뮤니케이션학과', label: '미디어커뮤니케이션학과' },
{ value: '미래모빌리티학과', label: '미래모빌리티학과' },
{ value: '미술학과', label: '미술학과' },
{ value: '바이오에너지공학과', label: '바이오에너지공학과' },
{ value: '빅데이터융합학과', label: '빅데이터융합학과' },
{ value: '불어불문학과', label: '불어불문학과' },
{ value: '사학과', label: '사학과' },
{ value: '사회학과', label: '사회학과' },
{ value: '산림자원학과', label: '산림자원학과' },
{ value: '산업공학과', label: '산업공학과' },
{ value: '생명과학기술학부', label: '생명과학기술학부' },
{ value: '생물교육과', label: '생물교육과' },
{ value: '생물공학과', label: '생물공학과' },
{ value: '생물학과', label: '생물학과' },
{ value: '생활복지학과', label: '생활복지학과' },
{ value: '소프트웨어공학과', label: '소프트웨어공학과' },
{ value: '수의예과', label: '수의예과' },
{ value: '수의학과', label: '수의학과' },
{ value: '수학과', label: '수학과' },
{ value: '수학교육과', label: '수학교육과' },
{ value: '식품공학과', label: '식품공학과' },
{ value: '식품영양과학부', label: '식품영양과학부' },
{ value: '신소재공학부', label: '신소재공학부' },
{ value: '심리학과', label: '심리학과' },
{ value: '약학부', label: '약학부' },
{ value: '에너지자원공학과', label: '에너지자원공학과' },
{ value: '역사교육과', label: '역사교육과' },
{ value: '영어교육과', label: '영어교육과' },
{ value: '영어영문학과', label: '영어영문학과' },
{
value: '융합바이오시스템기계공학과',
label: '융합바이오시스템기계공학과',
},
{ value: '유아교육과', label: '유아교육과' },
{ value: '윤리교육과', label: '윤리교육과' },
{ value: '음악교육과', label: '음악교육과' },
{ value: '음악학과', label: '음악학과' },
{ value: '응용생물학과', label: '응용생물학과' },
{ value: '응용식물학과', label: '응용식물학과' },
{ value: '의류학과', label: '의류학과' },
{ value: '의예과', label: '의예과' },
{ value: '인공지능학부', label: '인공지능학부' },
{ value: '일어일문학과', label: '일어일문학과' },
{ value: '임산공학과', label: '임산공학과' },
{ value: '자율전공학부', label: '자율전공학부' },
{ value: '전기공학과', label: '전기공학과' },
{ value: '전자공학과', label: '전자공학과' },
{ value: '전자컴퓨터공학부', label: '전자컴퓨터공학부' },
{ value: '정치외교학과', label: '정치외교학과' },
{ value: '조경학과', label: '조경학과' },
{ value: '지구과학교육과', label: '지구과학교육과' },
{ value: '지구환경과학부', label: '지구환경과학부' },
{ value: '지리교육과', label: '지리교육과' },
{ value: '지리학과', label: '지리학과' },
{ value: '지역·바이오시스템공학과', label: '지역·바이오시스템공학과' },
{ value: '중어중문학과', label: '중어중문학과' },
{ value: '체육교육과', label: '체육교육과' },
{ value: '컴퓨터정보통신공학과', label: '컴퓨터정보통신공학과' },
{ value: '통계학과', label: '통계학과' },
{ value: '특수교육학부', label: '특수교육학부' },
{ value: '토목공학과', label: '토목공학과' },
{ value: '철학과', label: '철학과' },
{ value: '행정학과', label: '행정학과' },
{ value: '화학과', label: '화학과' },
{ value: '화학교육과', label: '화학교육과' },
{ value: '화학공학부', label: '화학공학부' },
{ value: '환경에너지공학과', label: '환경에너지공학과' },
];
9 changes: 6 additions & 3 deletions service-apply/src/functions/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export const isSection = ({
export const isCarNumber = (carNumber: string) =>
/\d{2,3}[가-힣]{1}\d{4}/gm.test(carNumber.replace(' ', ''));

export const isAffiliation = (affiliation: string) =>
!!affiliation.replace(' ', '');
export const isApplyDropDown = (dropDownValue: string) => !!dropDownValue;

export interface ApplyFormInput {
phoneNumber: string;
studentNumber: string;
email: string;
studentName: string;
affiliation: string;
department: string;
section: number;
carNumber: string;
isCompact: boolean;
Expand Down Expand Up @@ -65,9 +65,12 @@ export const applyFormValidator = ({
if (!isStudentNumber(input.studentNumber)) {
return submitFailure('올바른 형식의 학번을 입력해 주세요.');
}
if (!isAffiliation(input.affiliation)) {
if (!isApplyDropDown(input.affiliation)) {
return submitFailure('소속대학을 입력해 주세요.');
}
if (!isApplyDropDown(input.department)) {
return submitFailure('소속학과를 입력해 주세요.');
}
if (!isSection({ array: sectionNumberArray, selected: input.section })) {
return submitFailure('올바른 구간을 선택해 주세요.');
}
Expand Down
5 changes: 4 additions & 1 deletion service-apply/src/hooks/apply/useApplyForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import { usePeriodQuery } from '../react-query/usePeriodQuery';
export const useApplyForm = () => {
const { eventId } = usePeriodQuery();
const { registrationData } = useApplyQuery({ eventId });
const { sector, selectSectorId, affiliation, ...rest } = registrationData;
const { sector, selectSectorId, affiliation, department, ...rest } =
registrationData;
const { state, dispatch } = useApplyFormContext({
section: selectSectorId ?? 0,
affiliation: affiliation ?? '',
department: department ?? '',
...rest,
});

Expand All @@ -23,6 +25,7 @@ export const useApplyForm = () => {
payload: {
section: selectSectorId ?? 0,
affiliation: affiliation ?? '',
department: department ?? '',
...rest,
},
});
Expand Down
1 change: 1 addition & 0 deletions service-apply/src/hooks/apply/useApplyFormContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const applyFormReducer = (
...initApplyFormValue,
};
case 'affiliation':
case 'department':
case 'email':
case 'studentName':
case 'section':
Expand Down
1 change: 1 addition & 0 deletions service-apply/src/hooks/apply/useCaptchaForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const useCaptchaForm = ({ closeModal }: { closeModal: () => void }) => {
name: state.studentName,
studentNumber: state.studentNumber,
affiliation: state.affiliation,
department: state.department,
isLightCar: state.isCompact,
carNumber: state.carNumber,
phoneNumber: state.phoneNumber,
Expand Down
2 changes: 2 additions & 0 deletions service-apply/src/store/ApplyFormContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface ApplyFormContextType {
email: string;
studentName: string;
affiliation: string;
department: string;
section: number;
carNumber: string;
isCompact: boolean;
Expand All @@ -17,6 +18,7 @@ export const initApplyFormValue = {
email: '',
studentName: '',
affiliation: '',
department: '',
section: 0,
carNumber: '',
isCompact: false,
Expand Down
3 changes: 3 additions & 0 deletions service-manager/src/apis/dtos/registration.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
interface Registration {
affiliation: string;
department: string;
sectorNum: string;
carNum: string;
email: string;
Expand All @@ -19,6 +20,7 @@ export class RegistrationResponse {
isCompact: boolean;
carNumber: string;
affiliation: string;
department: string;
sectorNum: string;

constructor(data: Registration) {
Expand All @@ -30,6 +32,7 @@ export class RegistrationResponse {
this.isCompact = data.isLight;
this.carNumber = data.carNum;
this.affiliation = data.affiliation;
this.department = data.department;
this.sectorNum = data.sectorNum;
}
}
Expand Down
Loading