Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(member): remove gender #750

Merged
merged 15 commits into from
May 19, 2024
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 frontend/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "./member";
export * from "./recruitments";
export * from "./applicationForms";
export * from "./members";
export * from "./recruitments";
Comment on lines +2 to +3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a: import문을 정리해 주셨군요 🙇‍♂️

2 changes: 0 additions & 2 deletions frontend/src/api/member.ts → frontend/src/api/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const fetchRegister = ({
name,
email,
phoneNumber,
gender,
birthday,
password,
confirmPassword,
Expand All @@ -60,7 +59,6 @@ export const fetchRegister = ({
name,
email,
phoneNumber,
gender,
birthday: formatDate(birthday),
password,
confirmPassword,
Expand Down

This file was deleted.

12 changes: 0 additions & 12 deletions frontend/src/components/form/GenderField/GenderField.stories.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions frontend/src/components/form/GenderField/GenderField.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions frontend/src/hooks/useSignUpForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const SIGN_UP_FORM_NAME = {
PASSWORD: "password",
CONFIRM_PASSWORD: "confirmPassword",
BIRTHDAY: "birthday",
GENDER: "gender",
IS_TERM_AGREED: "isTermAgreed",
};

Expand All @@ -26,7 +25,6 @@ const initialRequiredForm = {
[SIGN_UP_FORM_NAME.PASSWORD]: "",
[SIGN_UP_FORM_NAME.CONFIRM_PASSWORD]: "",
[SIGN_UP_FORM_NAME.BIRTHDAY]: null,
[SIGN_UP_FORM_NAME.GENDER]: "",
[SIGN_UP_FORM_NAME.IS_TERM_AGREED]: false,
};

Expand Down Expand Up @@ -121,10 +119,6 @@ const useSignUpForm = () => {
updateRequiredForm(SIGN_UP_FORM_NAME.BIRTHDAY, date);
};

const handleChangeGender = ({ target }) => {
updateRequiredForm(SIGN_UP_FORM_NAME.GENDER, target.value);
};

const handleChangeIsTermAgreed = ({ target }) => {
updateRequiredForm(SIGN_UP_FORM_NAME.IS_TERM_AGREED, target.checked);
};
Expand Down Expand Up @@ -172,7 +166,6 @@ const useSignUpForm = () => {
[SIGN_UP_FORM_NAME.PASSWORD]: handleChangePassword,
[SIGN_UP_FORM_NAME.CONFIRM_PASSWORD]: handleChangeConfirmPassword,
[SIGN_UP_FORM_NAME.BIRTHDAY]: handleChangeBirthday,
[SIGN_UP_FORM_NAME.GENDER]: handleChangeGender,
},
};
};
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/mock/dummy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,6 @@ export const missionsDummy = {
],
};

export const memberInfoDummy = {
id: 1,
name: "썬",
email: "sun@woowa.com",
phoneNumber: "010-1234-1234",
gender: "FEMALE",
birthday: "2000-01-01",
};

export const judgmentDummy = {
pullRequestUrl: "https://github.com/woowacourse/jwp-dashboard-http/pull/298",
commitHash: "642951e1324eaf66914bd53df339d94cad5667e3",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/PasswordFind/PasswordFind.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useNavigate } from "react-router-dom";
import { fetchPasswordFind } from "../../api/member";
import { fetchPasswordFind } from "../../api/members";
import Button from "../../components/@common/Button/Button";
import Container, { CONTAINER_SIZE } from "../../components/@common/Container/Container";
import MessageTextInput from "../../components/@common/MessageTextInput/MessageTextInput";
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/pages/SignUp/SignUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import BirthField from "../../components/form/BirthField/BirthField";
import CancelButton from "../../components/form/CancelButton/CancelButton";
import EmailField, { EMAIL_STATUS } from "../../components/form/EmailField/EmailField";
import Form from "../../components/form/Form/Form";
import GenderField from "../../components/form/GenderField/GenderField";
import SummaryCheckField from "../../components/form/SummaryCheckField/SummaryCheckField";
import { FORM } from "../../constants/form";
import { ERROR_MESSAGE } from "../../constants/messages";
Expand Down Expand Up @@ -146,13 +145,6 @@ const SignUp = () => {
onChange={handleChanges[SIGN_UP_FORM_NAME.BIRTHDAY]}
required
/>
<GenderField
className={styles["input-box"]}
value={form[SIGN_UP_FORM_NAME.GENDER]}
onChange={handleChanges[SIGN_UP_FORM_NAME.GENDER]}
required
/>

<div className={styles.buttons}>
<CancelButton />
<Button disabled={!isValid || isEmpty}>가입하기</Button>
Expand Down
1 change: 0 additions & 1 deletion frontend/types/domains/member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export type Member = {
name: string;
email: `${string}@${string}`;
phoneNumber: string;
gender: "MALE" | "FEMALE";
birthday: Date;
password: string;
};
2 changes: 1 addition & 1 deletion src/main/kotlin/apply/application/EvaluationDtos.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package apply.application
import apply.domain.evaluation.Evaluation
import apply.domain.evaluationitem.EvaluationItem
import apply.domain.evaluationtarget.EvaluationStatus
import apply.domain.recruitment.Recruitment
import apply.domain.member.Member
import apply.domain.recruitment.Recruitment
import javax.validation.Valid
import javax.validation.constraints.Max
import javax.validation.constraints.Min
Expand Down
5 changes: 2 additions & 3 deletions src/main/kotlin/apply/application/ExcelService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ class ExcelService(
val titles = recruitmentItemRepository.findByRecruitmentIdOrderByPosition(recruitmentId)
.map { it.title }
.toTypedArray()
val headerTitles = arrayOf("이름", "이메일", "전화번호", "성별", "생년월일", "지원 일시", "부정행위자", "포트폴리오 URL", *titles)
val headerTitles = arrayOf("이름", "이메일", "전화번호", "생년월일", "지원 일시", "부정행위자", "포트폴리오 URL", *titles)
val excelRows = applicants.map {
ExcelRow(
it.name,
it.email,
it.phoneNumber,
it.gender.title,
it.birthday.toString(),
it.applicationForm.submittedDateTime.toString(),
it.isCheater.toText(),
it.applicationForm.referenceUrl,
*it.applicationForm.answers.items.map { item -> item.contents }.toTypedArray()
*it.applicationForm.answers.items.map { item -> item.contents }.toTypedArray(),
)
}
return excelGenerator.generateBy(headerTitles, excelRows)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package apply.application
import apply.domain.authenticationcode.AuthenticationCode
import apply.domain.authenticationcode.AuthenticationCodeRepository
import apply.domain.authenticationcode.getLastByEmail
import apply.domain.member.UnidentifiedMemberException
import apply.domain.member.Member
import apply.domain.member.MemberRepository
import apply.domain.member.UnidentifiedMemberException
import apply.domain.member.existsByEmail
import apply.domain.member.findByEmail
import apply.security.JwtTokenProvider
Expand All @@ -22,7 +23,7 @@ class MemberAuthenticationService(
require(request.password == request.confirmPassword) { "비밀번호가 일치하지 않습니다." }
check(!memberRepository.existsByEmail(request.email)) { "이미 가입된 이메일입니다." }
authenticationCodeRepository.getLastByEmail(request.email).validate(request.authenticationCode)
val member = memberRepository.save(request.toEntity())
val member = memberRepository.save(Member(request.name, request.email, request.phoneNumber, request.birthday, request.password))
return jwtTokenProvider.createToken(member.email)
}

Expand Down
22 changes: 6 additions & 16 deletions src/main/kotlin/apply/application/MemberDtos.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package apply.application

import apply.domain.applicationform.ApplicationForm
import apply.domain.member.Gender
import apply.domain.member.Password
import apply.domain.member.Member
import apply.domain.member.Password
import java.time.LocalDate
import javax.validation.constraints.Email
import javax.validation.constraints.NotBlank
Expand All @@ -15,16 +14,14 @@ data class MemberResponse(
val name: String,
val email: String,
val phoneNumber: String,
val gender: Gender,
val birthday: LocalDate
val birthday: LocalDate,
) {
constructor(member: Member) : this(
member.id,
member.name,
member.email,
member.phoneNumber,
member.gender,
member.birthday
member.birthday,
)
}

Expand All @@ -33,20 +30,18 @@ data class ApplicantAndFormResponse(
val name: String,
val email: String,
val phoneNumber: String,
val gender: Gender,
val birthday: LocalDate,
val isCheater: Boolean,
val applicationForm: ApplicationForm
val applicationForm: ApplicationForm,
) {
constructor(member: Member, isCheater: Boolean, applicationForm: ApplicationForm) : this(
member.id,
member.name,
member.email,
member.phoneNumber,
member.gender,
member.birthday,
isCheater,
applicationForm
applicationForm,
)
}

Expand All @@ -59,7 +54,6 @@ data class RegisterMemberRequest(

@field:Pattern(regexp = "010-\\d{4}-\\d{4}", message = "올바른 형식의 전화번호여야 합니다")
val phoneNumber: String,
val gender: Gender,

@field:Past
val birthday: LocalDate,
Expand All @@ -68,11 +62,7 @@ data class RegisterMemberRequest(

@field:NotBlank
val authenticationCode: String
) {
fun toEntity(): Member {
return Member(name, email, phoneNumber, gender, birthday, password)
}
}
)

data class AuthenticateMemberRequest(
@field:Email
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/apply/application/mail/MailService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import apply.application.ApplicationProperties
import apply.domain.applicationform.ApplicationFormSubmittedEvent
import apply.domain.mail.MailHistory
import apply.domain.mail.MailHistoryRepository
import apply.domain.recruitment.RecruitmentRepository
import apply.domain.recruitment.getOrThrow
import apply.domain.member.PasswordResetEvent
import apply.domain.member.MemberRepository
import apply.domain.member.PasswordResetEvent
import apply.domain.member.getOrThrow
import apply.domain.recruitment.RecruitmentRepository
import apply.domain.recruitment.getOrThrow
import org.springframework.boot.autoconfigure.mail.MailProperties
import org.springframework.core.io.ByteArrayResource
import org.springframework.scheduling.annotation.Async
Expand Down
13 changes: 4 additions & 9 deletions src/main/kotlin/apply/config/DatabaseInitializer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import apply.domain.judgmentitem.JudgmentItemRepository
import apply.domain.judgmentitem.ProgrammingLanguage
import apply.domain.mail.MailHistory
import apply.domain.mail.MailHistoryRepository
import apply.domain.member.Gender
import apply.domain.member.Member
import apply.domain.member.MemberRepository
import apply.domain.member.Password
Expand Down Expand Up @@ -258,33 +257,29 @@ class DatabaseInitializer(
name = "홍길동",
email = "a@email.com",
phoneNumber = "010-0000-0000",
gender = Gender.MALE,
birthday = createLocalDate(2020, 4, 17),
password = Password("password")
password = Password("password"),
),
Member(
name = "홍길동2",
email = "b@email.com",
phoneNumber = "010-0000-0000",
gender = Gender.FEMALE,
birthday = createLocalDate(2020, 5, 5),
password = Password("password")
password = Password("password"),
),
Member(
name = "홍길동3",
email = "c@email.com",
phoneNumber = "010-0000-0000",
gender = Gender.MALE,
birthday = createLocalDate(2020, 1, 1),
password = Password("password")
password = Password("password"),
),
Member(
name = "홍길동4",
email = "d@email.com",
phoneNumber = "010-0000-0000",
gender = Gender.MALE,
birthday = createLocalDate(2020, 1, 1),
password = Password("password")
password = Password("password"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

질문: 항상 , 가 있는게 컨벤션인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코틀린의 버전이 특정 버전 이상이 되면 Ktlint에서 이를 기본 코딩 규칙으로 사용하더라고요. 미리 사용해 보고 있어요!
https://kotlinlang.org/docs/coding-conventions.html#trailing-commas

)
)
memberRepository.saveAll(members)
Expand Down
6 changes: 0 additions & 6 deletions src/main/kotlin/apply/domain/member/Gender.kt

This file was deleted.

Loading