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
4 changes: 2 additions & 2 deletions app/(user)/job-board/[jobPostId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getTeacherSession } from 'entities/auth'
import { getNullableTeacherSession } from 'entities/auth'
import { getJobPost, getTeacherApplicationStatus } from 'entities/job-post'
import { getResumeCount } from 'entities/resume'
import { JobPostingDetailPage as _JobPostingDetailPage } from 'pages/job-post'
Expand All @@ -14,7 +14,7 @@ const JobPostingDetailPage = async ({
}) => {
const { jobPostId } = await params

const session = await getTeacherSession()
const session = await getNullableTeacherSession()

const resumeCount = await getResumeCount()
const jobPostDetail = await getJobPost({ jobPostId: Number(jobPostId) })
Expand Down
3 changes: 2 additions & 1 deletion src/entities/academy/api/update-academy-me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ const handleError = (error: Error): ServerError => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('업데이트에 실패했어요', {
return errorHandler.toast('academy-detail.error.register', {
error,
translate: true,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const handleError = (error: Error): ServerError => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('Failed to update job post resume memo', {
return errorHandler.toast('applicant-management-detail.error.update', {
error,
translate: true,
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const handleError = (error: Error): ServerError => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('Failed to update job post resume status', {
return errorHandler.toast('applicant-management-detail.error.update', {
error,
translate: true,
})
}

Expand Down
1 change: 1 addition & 0 deletions src/entities/job-post-resume-relation/model/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type JobPostRelation = {
academyId: number
academyName: string
academyMemo: string | null
countryNameEn: string
}

export type JobPostRelationDetail = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
import { useLocale, useTranslations } from 'next-intl'

import { ApplicationStatus } from 'entities/job-post-resume-relation'
import { Form, FormSelectProps } from 'shared/form'
import { cn } from 'shared/lib'

export const StatusLabel = {
[ApplicationStatus.SUBMITTED]: '접수',
[ApplicationStatus.REVIEWED]: '검토',
[ApplicationStatus.ACCEPTED]: '합격',
[ApplicationStatus.REJECTED]: '불합격',
[ApplicationStatus.SUBMITTED]: 'submitted',
[ApplicationStatus.REVIEWED]: 'reviewed',
[ApplicationStatus.ACCEPTED]: 'accepted',
[ApplicationStatus.REJECTED]: 'rejected',
}

export const ApplicationStatusSelect = (props: FormSelectProps) => {
const locale = useLocale()
const t = useTranslations('field.application-status.option')

return (
<Form.Select
name="status"
size="medium"
className="w-[85px]"
displayValue={value => StatusLabel[value as ApplicationStatus]}
className={cn({
'w-[85px]': locale === 'ko',
'w-[120px]': locale === 'en',
})}
displayValue={value => t(StatusLabel[value as ApplicationStatus])}
{...props}
>
<Form.SelectItem value={ApplicationStatus.SUBMITTED}>
접수
{t('submitted')}
</Form.SelectItem>
<Form.SelectItem value={ApplicationStatus.REVIEWED}>
{t('reviewed')}
</Form.SelectItem>
<Form.SelectItem value={ApplicationStatus.ACCEPTED}>
{t('accepted')}
</Form.SelectItem>
<Form.SelectItem value={ApplicationStatus.REVIEWED}>검토</Form.SelectItem>
<Form.SelectItem value={ApplicationStatus.ACCEPTED}>합격</Form.SelectItem>
<Form.SelectItem value={ApplicationStatus.REJECTED}>
불합격
{t('rejected')}
</Form.SelectItem>
</Form.Select>
)
Expand Down
10 changes: 7 additions & 3 deletions src/entities/job-post/api/create-job-post-draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ const handleError = (error: Error) => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('An error occurred while creating job post draft', {
error,
})
return errorHandler.toast(
'create-job-posting.error.job-posting-draft-register',
{
error,
translate: true,
},
)
}

export const createJobPostDraft = async (jobPost: CreateJobPost) => {
Expand Down
3 changes: 2 additions & 1 deletion src/entities/job-post/api/create-job-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const handleError = (error: Error) => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('An error occurred while creating job post', {
return errorHandler.toast('create-job-posting.error.job-posting-register', {
error,
translate: true,
})
}

Expand Down
10 changes: 7 additions & 3 deletions src/entities/job-post/api/update-job-post-draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ const handleError = (error: Error) => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('An error occurred while updating job post draft', {
error,
})
return errorHandler.toast(
'create-job-posting.error.job-posting-draft-update',
{
error,
translate: true,
},
)
}

export const updateJobPostDraft = async ({
Expand Down
3 changes: 2 additions & 1 deletion src/entities/job-post/api/update-job-post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ const handleError = (error: Error) => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('An error occurred while updating job post', {
return errorHandler.toast('create-job-posting.error.job-posting-update', {
error,
translate: true,
})
}

Expand Down
25 changes: 18 additions & 7 deletions src/entities/user/api/change-password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,30 @@ const handleError = (error: HttpError) => {
if (!isHttpError) throw error

if (error.code === AuthExceptionCode.PW_NOT_CORRECT) {
return errorHandler.form({
currentPassword: 'The current password is incorrect',
})
return errorHandler.form(
{
currentPassword: 'reset-password.error.incorrect',
},
{
translate: true,
},
)
} else if (
error.code === InvalidInputValueExceptionCode.INVALID_INPUT_VALUE
) {
return errorHandler.form({
currentPassword: 'The current password is incorrect',
})
return errorHandler.form(
{
currentPassword: 'reset-password.error.incorrect',
},
{
translate: true,
},
)
}

return errorHandler.toast('An error occurred while changing the password', {
return errorHandler.toast('reset-password.error.reset-password', {
error,
translate: true,
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/entities/user/api/delete-user-me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const handleError = (error: Error) => {
if (!isHttpError) throw error

if (error.code === ResourceNotFoundExceptionCode.USER_NOT_FOUND) {
return errorHandler.toast('This account has been deactivated')
return errorHandler.toast('my-account.error.account-deactivated')
} else {
return errorHandler.toast('An error occurred while deleting the account', {
return errorHandler.toast('my-account.error.delete-account', {
error,
})
}
Expand Down
3 changes: 2 additions & 1 deletion src/entities/user/api/update-user-me.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ const handleError = (error: Error) => {
const isHttpError = error instanceof HttpError
if (!isHttpError) throw error

return errorHandler.toast('An error occurred while updating the user', {
return errorHandler.toast('my-account.error.save', {
error,
translate: true,
})
}

Expand Down
1 change: 1 addition & 0 deletions src/entities/user/model/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type User = {
id: number
firstName: string
lastName: string
fullName?: string
genderType: 'MALE' | 'FEMALE'
birthDate: string
email: string
Expand Down
6 changes: 3 additions & 3 deletions src/features/academy-detail-form/model/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const academyNameEn = {
}

export const address = {
required: 'validation.address.required',
required: true,
}

export const detailedAddress = {
Expand Down Expand Up @@ -55,10 +55,10 @@ export const businessRegistrationNumber = {
}

export const description = {
required: 'validation.description.required',
required: 'validation.academyDescription.required',
maxLength: {
value: 1000,
message: 'validation.description.maxLength',
message: 'validation.academyDescription.maxLength',
},
}

Expand Down
2 changes: 1 addition & 1 deletion src/features/academy-detail-form/ui/field/address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const Address = () => {
className="w-[120px] shrink-0"
onClick={handleButtonClick}
>
주소 검색
{t('field.address.button')}
</Button>
<Modal.Content className="h-[600px] w-[450px]">
<DaumPostcode
Expand Down
8 changes: 6 additions & 2 deletions src/features/academy-detail-form/ui/field/description.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { useTranslations } from 'next-intl'

import { fieldCss, Form } from 'shared/form'
import { Label } from 'shared/ui'

export const Description = () => {
const t = useTranslations('field')

return (
<div className={fieldCss.fieldWrapper({ className: 'not-last:mb-8' })}>
<Label required>학원 소개</Label>
<Label required>{t('academy-description.label')}</Label>
<Form.Control name="description">
<Form.TextArea
placeholder="영어로 입력해 주세요"
placeholder={t('academy-description.placeholder')}
fullWidth
className="h-[128px]"
/>
Expand Down
7 changes: 5 additions & 2 deletions src/features/academy-detail-form/ui/field/images.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useTranslations } from 'next-intl'
import { useFieldArray, useFormContext } from 'react-hook-form'

import { Label } from 'shared/ui'
Expand All @@ -6,6 +7,8 @@ import { FormValues } from '../../model/form-values'
import { ImageUploader } from '../image-uploader'

export const Images = () => {
const t = useTranslations('field')

const {
control,
formState: { errors },
Expand Down Expand Up @@ -39,9 +42,9 @@ export const Images = () => {

return (
<div>
<Label required>소개 이미지</Label>
<Label required>{t('introduction-image.label')}</Label>
<p className="body-large mb-4 mt-0.5 font-normal text-gray-500">
소개 이미지는 최소 1장 이상 등록해 주세요.
{t('introduction-image.description')}
</p>
<ul className="flex flex-wrap justify-between gap-y-5">
{fields.map((field, index) => (
Expand Down
42 changes: 34 additions & 8 deletions src/features/academy-detail-form/ui/field/student-type.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { isEqual } from 'lodash-es'
import { useLocale, useTranslations } from 'next-intl'
import { useFormContext, useWatch } from 'react-hook-form'

import { fieldCss, Form } from 'shared/form'
import { cn } from 'shared/lib'
import { Checkbox, Label } from 'shared/ui'

import { FormValues } from '../../model/form-values'
import * as rules from '../../model/rules'

export const StudentType = () => {
const locale = useLocale()
const t = useTranslations('field')

const {
control,
setValue,
Expand Down Expand Up @@ -42,25 +47,46 @@ export const StudentType = () => {

return (
<div className={fieldCss.fieldWrapper({ className: 'not-last:mb-8' })}>
<Label required>대상 학생</Label>
<div className="flex gap-[30px]">
<Label required>{t('target-student.label')}</Label>
<div
className={cn(
'flex',
locale === 'ko' && 'gap-[30px]',
locale === 'en' && 'flex-wrap gap-x-[18px] gap-y-4',
)}
>
<Form.CheckboxGroup
name="studentType"
rules={rules.studentType}
options={studentTypeOptions}
>
<Checkbox
label="전체"
label={t('target-student.option.all')}
value="All"
checked={isAllChecked}
onChange={handleAllCheckboxClick}
error={!!errors?.studentType}
/>
<Form.Checkbox label="유치원" value="Kindergarten" />
<Form.Checkbox label="초등학생" value="Elementary" />
<Form.Checkbox label="중학생" value="MiddleSchool" />
<Form.Checkbox label="고등학생" value="HighSchool" />
<Form.Checkbox label="성인" value="Adult" />
<Form.Checkbox
label={t('target-student.option.kindergarten')}
value="Kindergarten"
/>
<Form.Checkbox
label={t('target-student.option.elementary')}
value="Elementary"
/>
<Form.Checkbox
label={t('target-student.option.middle-school')}
value="MiddleSchool"
/>
<Form.Checkbox
label={t('target-student.option.high-school')}
value="HighSchool"
/>
<Form.Checkbox
label={t('target-student.option.adult')}
value="Adult"
/>
</Form.CheckboxGroup>
</div>
</div>
Expand Down
Loading