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/#70 패키지 구조 변경, 메서드명 변경 #72

Merged
merged 3 commits into from
Oct 31, 2023
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package coffeemeet.server.certification.controller;

import coffeemeet.server.certification.dto.EmailDto;
import coffeemeet.server.certification.dto.VerificationCodeDto;
import coffeemeet.server.certification.controller.dto.EmailDto;
import coffeemeet.server.certification.controller.dto.VerificationCodeDto;
import coffeemeet.server.certification.service.CertificationService;
import coffeemeet.server.common.annotation.Login;
import coffeemeet.server.common.util.FileUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package coffeemeet.server.certification.dto;
package coffeemeet.server.certification.controller.dto;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package coffeemeet.server.certification.dto;
package coffeemeet.server.certification.controller.dto;

import jakarta.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void registerCertification(long userId, String email, String departmentNa
String businessCardUrl = s3MediaService.getUrl(key);
Department department = Department.valueOf(departmentName);
User user = userQuery.getUserById(userId);
certificationCommand.newCertification(companyEmail, businessCardUrl, department, user);
certificationCommand.createCertification(companyEmail, businessCardUrl, department, user);
}

private void uploadBusinessCard(long userId, String key, File businessCardUrl) {
Expand All @@ -61,7 +61,7 @@ public void sendVerificationMail(Long userId, String email) {

String verificationCode = generateVerificationCode();
emailService.sendVerificationCode(companyEmail, verificationCode);
emailVerificationCommand.newEmailVerification(userId, companyEmail, verificationCode);
emailVerificationCommand.createEmailVerification(userId, companyEmail, verificationCode);
}

public void compareCode(Long userId, String verificationCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class CertificationCommand {

private final CertificationRepository certificationRepository;

public void newCertification(CompanyEmail companyEmail, String businessCardUrl,
public void createCertification(CompanyEmail companyEmail, String businessCardUrl,
Department department, User user) {
certificationRepository.save(
Certification.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class EmailVerificationCommand {

private final EmailVerificationRepository emailVerificationRepository;

public void newEmailVerification(Long userId, CompanyEmail companyEmail,
public void createEmailVerification(Long userId, CompanyEmail companyEmail,
String verificationCode) {
emailVerificationRepository.save(new EmailVerification(userId, companyEmail, verificationCode));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void registerCertificationTest() {
// then
then(s3MediaService).should().generateKey(any());
then(s3MediaService).should().upload(any(), any(File.class));
then(certificationCommand).should().newCertification(any(), any(), any(), any());
then(certificationCommand).should().createCertification(any(), any(), any(), any());

fileUtils.close();
}
Expand All @@ -94,7 +94,7 @@ void sendVerificationMailTest() {
then(certificationCommand).should(only()).hasDuplicatedCompanyEmail(any());
then(emailService).should(only()).sendVerificationCode(any(), anyString());
then(emailVerificationCommand).should(only())
.newEmailVerification(anyLong(), any(), anyString());
.createEmailVerification(anyLong(), any(), anyString());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class CertificationCommandTest {

@Test
@DisplayName("새로운 Certification 객체를 저장할 수 있다.")
void newCertificationTest() {
void createCertificationTest() {
// given
CompanyEmail companyEmail = companyEmail();
String businessCardUrl = businessCardUrl();
Department department = department();
User user = user();

// when
certificationCommand.newCertification(companyEmail, businessCardUrl, department, user);
certificationCommand.createCertification(companyEmail, businessCardUrl, department, user);

// then
then(certificationRepository).should(only()).save(any(Certification.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ class EmailVerificationCommandTest {

@Test
@DisplayName("새로운 EmailVerification 객체를 저장할 수 있다.")
void newEmailVerificationTest() {
void createEmailVerificationTest() {
// given
EmailVerification emailVerification = emailVerification();
given(emailVerificationRepository.save(any(EmailVerification.class))).willReturn(
emailVerification);

// when
emailVerificationCommand.newEmailVerification(emailVerification.getUserId(),
emailVerificationCommand.createEmailVerification(emailVerification.getUserId(),
emailVerification.getCompanyEmail(), emailVerification.getCode());

// then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import coffeemeet.server.certification.domain.CompanyEmail;
import coffeemeet.server.certification.domain.Department;
import coffeemeet.server.certification.domain.EmailVerification;
import coffeemeet.server.certification.dto.EmailDto;
import coffeemeet.server.certification.dto.VerificationCodeDto;
import coffeemeet.server.certification.controller.dto.EmailDto;
import coffeemeet.server.certification.controller.dto.VerificationCodeDto;
import coffeemeet.server.user.domain.User;
import org.instancio.Instancio;
import org.instancio.internal.generator.domain.internet.EmailGenerator;
Expand Down