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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public QBusinessCategory(PathMetadata metadata, PathInits inits) {
public QBusinessCategory(Class<? extends BusinessCategory> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.business = inits.isInitialized("business") ? new QBusiness(forProperty("business"), inits.get("business")) : null;
this.category = inits.isInitialized("category") ? new QCategory(forProperty("category")) : null;
this.category = inits.isInitialized("category") ? new QCategory(forProperty("category"), inits.get("category")) : null;
}

}
Expand Down
20 changes: 17 additions & 3 deletions src/main/generated/com/example/api/domain/QCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.dsl.PathInits;


/**
Expand All @@ -17,10 +18,14 @@ public class QCategory extends EntityPathBase<Category> {

private static final long serialVersionUID = -1449757245L;

private static final PathInits INITS = PathInits.DIRECT2;

public static final QCategory category = new QCategory("category");

public final QBaseEntity _super = new QBaseEntity(this);

public final QAccount account;

public final NumberPath<Long> categoryId = createNumber("categoryId", Long.class);

public final StringPath categoryName = createString("categoryName");
Expand All @@ -32,15 +37,24 @@ public class QCategory extends EntityPathBase<Category> {
public final DateTimePath<java.time.LocalDateTime> updatedDate = _super.updatedDate;

public QCategory(String variable) {
super(Category.class, forVariable(variable));
this(Category.class, forVariable(variable), INITS);
}

public QCategory(Path<? extends Category> path) {
super(path.getType(), path.getMetadata());
this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS));
}

public QCategory(PathMetadata metadata) {
super(Category.class, metadata);
this(metadata, PathInits.getFor(metadata, INITS));
}

public QCategory(PathMetadata metadata, PathInits inits) {
this(Category.class, metadata, inits);
}

public QCategory(Class<? extends Category> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.account = inits.isInitialized("account") ? new QAccount(forProperty("account")) : null;
}

}
Expand Down
2 changes: 1 addition & 1 deletion src/main/generated/com/example/api/domain/QFlavored.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public QFlavored(PathMetadata metadata, PathInits inits) {

public QFlavored(Class<? extends Flavored> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.category = inits.isInitialized("category") ? new QCategory(forProperty("category")) : null;
this.category = inits.isInitialized("category") ? new QCategory(forProperty("category"), inits.get("category")) : null;
this.employee = inits.isInitialized("employee") ? new QAccount(forProperty("employee")) : null;
}

Expand Down
51 changes: 3 additions & 48 deletions src/main/generated/com/example/api/domain/QReview.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> b4d1a08 (#65 test(OfferEmploymentServiceTest): 테스트 코드 작성)
package com.example.api.domain;

import static com.querydsl.core.types.PathMetadataFactory.*;
Expand All @@ -11,10 +7,7 @@ >>>>>>> b4d1a08 (#65 test(OfferEmploymentServiceTest): 테스트 코드 작성)
import com.querydsl.core.types.PathMetadata;
import javax.annotation.processing.Generated;
import com.querydsl.core.types.Path;
<<<<<<< HEAD
import com.querydsl.core.types.dsl.PathInits;
=======
>>>>>>> b4d1a08 (#65 test(OfferEmploymentServiceTest): 테스트 코드 작성)


/**
Expand All @@ -25,26 +18,20 @@ public class QReview extends EntityPathBase<Review> {

private static final long serialVersionUID = 731127133L;

<<<<<<< HEAD
private static final PathInits INITS = PathInits.DIRECT2;

=======
>>>>>>> b4d1a08 (#65 test(OfferEmploymentServiceTest): 테스트 코드 작성)
public static final QReview review = new QReview("review");

public final QBaseEntity _super = new QBaseEntity(this);

<<<<<<< HEAD
public final QContract contract;

//inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

<<<<<<< HEAD
public final QOfferEmployment offerEmployment;
=======
public final QAccount employee;
>>>>>>> ace3d7a (#69 test(ReviewServiceTest): 테스트 코드 추가)

public final QOfferEmployment offerEmployment;

public final StringPath reviewContent = createString("reviewContent");

Expand Down Expand Up @@ -75,43 +62,11 @@ public QReview(PathMetadata metadata, PathInits inits) {

public QReview(Class<? extends Review> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
<<<<<<< HEAD
this.contract = inits.isInitialized("contract") ? new QContract(forProperty("contract"), inits.get("contract")) : null;
this.offerEmployment = inits.isInitialized("offerEmployment") ? new QOfferEmployment(forProperty("offerEmployment"), inits.get("offerEmployment")) : null;
=======
this.employee = inits.isInitialized("employee") ? new QAccount(forProperty("employee")) : null;
this.offerEmployment = inits.isInitialized("offerEmployment") ? new QOfferEmployment(forProperty("offerEmployment"), inits.get("offerEmployment")) : null;
this.writer = inits.isInitialized("writer") ? new QBusiness(forProperty("writer"), inits.get("writer")) : null;
>>>>>>> ace3d7a (#69 test(ReviewServiceTest): 테스트 코드 추가)
=======
//inherited
public final DateTimePath<java.time.LocalDateTime> createdDate = _super.createdDate;

public final StringPath reviewContent = createString("reviewContent");

public final NumberPath<Integer> reviewStarPoint = createNumber("reviewStarPoint", Integer.class);

public final NumberPath<Long> suggestId = createNumber("suggestId", Long.class);

//inherited
public final DateTimePath<java.time.LocalDateTime> updatedDate = _super.updatedDate;

public QReview(String variable) {
super(Review.class, forVariable(variable));
}

public QReview(Path<? extends Review> path) {
super(path.getType(), path.getMetadata());
}

public QReview(PathMetadata metadata) {
super(Review.class, metadata);
>>>>>>> b4d1a08 (#65 test(OfferEmploymentServiceTest): 테스트 코드 작성)
}

}

<<<<<<< HEAD
=======
>>>>>>> 326d0a2 (#65 feat(OfferEmploymentService): 서비스 코드 작성)
=======
>>>>>>> b4d1a08 (#65 test(OfferEmploymentServiceTest): 테스트 코드 작성)
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public QReviewReport(PathMetadata metadata, PathInits inits) {

public QReviewReport(Class<? extends ReviewReport> type, PathMetadata metadata, PathInits inits) {
super(type, metadata, inits);
this.review = inits.isInitialized("review") ? new QReview(forProperty("review")) : null;
this.review = inits.isInitialized("review") ? new QReview(forProperty("review"), inits.get("review")) : null;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,4 @@ public ResponseEntity<String> verifyBusinessNumber(@Valid @RequestBody final Bus
String successMessage = signUpService.verifyBusinessNumber(request);
return ResponseEntity.ok(successMessage);
}

@PostMapping("/sign-up/employer")
public ResponseEntity<String> signUpEmployer(@Valid @RequestBody final SignUpEmployerRequest request) {
String successMessage = signUpService.signUpEmployer(request);
return ResponseEntity.status(HttpStatus.CREATED).body(successMessage);
}
}
16 changes: 2 additions & 14 deletions src/main/java/com/example/api/account/service/AccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@
import com.example.api.exception.BusinessException;
import com.example.api.exception.ErrorCode;
import com.example.api.global.properties.VendorProperties;
import jakarta.transaction.Transactional;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.client.RestTemplate;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
Expand All @@ -44,7 +40,6 @@ public class AccountService {
private final CodeRepository codeRepository;
private final PasswordEncoder passwordEncoder;
private final MailSender mailSender;
private final AccountRepository accountRepository;
private final BusinessRepository businessRepository;
private final RestTemplate restTemplate;
private final VendorProperties vendorProperties;
Expand Down Expand Up @@ -97,7 +92,6 @@ public String signUpEmployer(@Valid final SignUpEmployerRequest request) {
return "회원가입이 완료되었습니다";
}

private void saveEmployeeAccount(final SignUpEmployeeRequest request) {
@Transactional(readOnly = true)
public Account loadAccount(final Long requestMemberId) {
return accountRepository.findById(requestMemberId)
Expand All @@ -110,8 +104,7 @@ public void deleteAccount(final Long requestMemberId) {
.orElseThrow(() -> new BusinessException(ErrorCode.ACCOUNT_NOT_FOUND_EXCEPTION));
account.setDeleted(true);
}

private void saveAccount(final SignUpRequest request) {
private Account saveEmployeeAccount(final SignUpEmployeeRequest request) {
Collection<UserRole> roles = List.of(request.role());
Account account = new Account(
request.loginId(),
Expand All @@ -124,7 +117,7 @@ private void saveAccount(final SignUpRequest request) {
roles,
request.emailReceivable()
);
accountRepository.save(account);
return accountRepository.save(account);
}

private void saveEmployerAccount(final SignUpEmployerRequest request) {
Expand Down Expand Up @@ -164,11 +157,6 @@ private void validateDuplicateEmail(final EmailRequest emailRequest) {
}
}

public Account loadAccount(final Long requestMemberId) {
return accountRepository.findById(requestMemberId)
.orElseThrow(() -> new BusinessException(ErrorCode.ACCOUNT_NOT_FOUND_EXCEPTION));
}

@Transactional
public String verifyBusinessNumber(@Validated final BusinessNumberRequest request){
URI uri = createUrl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,9 @@ public ResponseEntity changeOpenStatus(@PathVariable("employeeId") Long employee
@PostMapping("/api/v1/possible-board/submit/{employeeId}")
public ResponseEntity submitBoard(@PathVariable("employeeId") Long employeeId, @RequestBody MyInfoDTO myInfo) {
EmployeeIdRequest employeeIdRequest = new EmployeeIdRequest(employeeId);
boolean updated = employeeService.updateUserInfo(employeeIdRequest, myInfo);
if (updated) {
MyInfoDTO myInfoById = boardService.findMyInfoById(employeeIdRequest);
List<CategoryDTO> categoryList = categoryService.getAllCategories();
return ResponseEntity.ok(new Board(myInfoById, categoryList));
} else {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("사용자를 찾을 수 없습니다.");
}
employeeService.updateUserInfo(employeeIdRequest, myInfo);
MyInfoDTO myInfoById = boardService.findMyInfoById(employeeIdRequest);
List<CategoryDTO> categoryList = categoryService.getAllCategories();
return ResponseEntity.ok(new Board(myInfoById, categoryList));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.example.api.domain.repository.FlavoredRepository;
import com.example.api.domain.repository.MyInfoRepository;
import com.example.api.domain.repository.OfferEmploymentRepository;
import com.example.api.possbileboard.PossibleBoardRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down
34 changes: 21 additions & 13 deletions src/main/java/com/example/api/board/service/EmployeeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.example.api.board.dto.response.ExternalCareerDTO;
import com.example.api.board.dto.response.MyInfoDTO;
import com.example.api.board.dto.response.PossibleBoardDTO;
import com.example.api.board.dto.update.UpdateUserInfoRequest;
import com.example.api.board.entitiy.update.UpdateAccountConditionManager;
import com.example.api.domain.Account;
import com.example.api.domain.Category;
import com.example.api.domain.ExternalCareer;
Expand All @@ -13,6 +15,8 @@
import com.example.api.domain.repository.EmployeeRepository;
import com.example.api.domain.repository.ExternalCareerRepository;
import com.example.api.domain.repository.FlavoredRepository;
import com.example.api.exception.BusinessException;
import com.example.api.exception.ErrorCode;
import com.example.api.possbileboard.PossibleBoardRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
Expand All @@ -31,6 +35,7 @@ public class EmployeeService {
private final ExternalCareerRepository externalCareerRepository;
private final FlavoredRepository flavoredRepository;
private final PossibleBoardRepository possibleBoardRepository;
private final UpdateAccountConditionManager updateAccountConditionManager;

@Transactional
public Boolean changeOpenStatus(final EmployeeIdRequest employeeIdRequest, boolean openStatus) {
Expand All @@ -42,24 +47,27 @@ public Boolean changeOpenStatus(final EmployeeIdRequest employeeIdRequest, boole
}

@Transactional
public boolean updateUserInfo(final EmployeeIdRequest employeeIdRequest, MyInfoDTO myInfo) {
return employeeRepository.findByAccountId(employeeIdRequest.employeeId()).map(employee -> {
setUserInfo(employee, myInfo);
public void updateUserInfo(final EmployeeIdRequest employeeIdRequest, MyInfoDTO myInfo) {
try {
Account employee = employeeRepository.findByAccountId(employeeIdRequest.employeeId()).orElseThrow();
updateAccountConditionManager.updateAccount(employee, getUpdateUserInfoRequest(myInfo));
employeeRepository.save(employee);

updateExternalCareer(employee, myInfo.getExternalCareerList());
updateFlavored(employee, myInfo.getFlavoredCategoryList());
updatePossibleBoard(employee, myInfo.getPossibleBoardList());
return true;
}).orElse(false);
}catch (Exception e) {
throw new BusinessException(ErrorCode.NULL_USER);
}
}
void setUserInfo(Account employee, MyInfoDTO myInfo) {
employee.setName(myInfo.getName());
employee.setSex(myInfo.getSex());
employee.setAge(myInfo.getAge());
employee.setPhoneNumber(myInfo.getPhone());
employee.setEmail(myInfo.getEmail());
employee.setNickname(myInfo.getNickname());
private UpdateUserInfoRequest getUpdateUserInfoRequest(MyInfoDTO myInfo) {
return new UpdateUserInfoRequest(
myInfo.getName(),
myInfo.getSex(),
myInfo.getAge(),
myInfo.getPhone(),
myInfo.getEmail(),
myInfo.getNickname()
);
}
public void updateExternalCareer(Account employee, List<ExternalCareerDTO> newExternalCareerList) {
List<ExternalCareer> existList = externalCareerRepository.findAllByEmployeeAccountId(employee.getAccountId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.api.business.controller;

import com.example.api.account.entity.Location;
import com.example.api.business.BusinessQueryService;
import com.example.api.business.BusinessService;
import com.example.api.business.dto.AddBusinessCommand;
Expand Down Expand Up @@ -52,7 +53,7 @@ public ResponseEntity<?> addBusiness(
record AddBusinessRequest(
Long requestMemberId,
String businessName,
String location,
Location location,
List<Long> categoryIds,
String representationName
) {
Expand All @@ -65,7 +66,7 @@ record ModifyBusinessRequest(
@NotNull
Long businessId,
String businessName,
String location,
Location location,
String representationName,
List<Long> categoryId
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.example.api.business.domain;

import com.example.api.account.entity.Location;
import lombok.Getter;

@Getter
public class BusinessLocation {
private final String location;
private final Location location;

public BusinessLocation(String location) {
public BusinessLocation(Location location) {
this.location = location;
}
}
Loading
Loading