-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
265 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
## career 내부 디렉토리 구조 | ||
``` | ||
C:. | ||
│ CareerApplication.java | ||
│ | ||
├─apiPayload | ||
│ │ ApiResponse.java | ||
│ │ | ||
│ ├─code | ||
│ │ │ BaseCode.java | ||
│ │ │ BaseErrorCode.java | ||
│ │ │ ErrorReasonDTO.java | ||
│ │ │ ReasonDTO.java | ||
│ │ │ | ||
│ │ └─status | ||
│ │ ErrorStatus.java | ||
│ │ SuccessStatus.java | ||
│ │ | ||
│ └─exception | ||
│ │ ExceptionAdvice.java | ||
│ │ GeneralException.java | ||
│ │ | ||
│ └─handler | ||
│ TempHandler.java | ||
│ | ||
├─comments | ||
│ ├─Controller | ||
│ │ CommentsController.java | ||
│ │ | ||
│ ├─dto | ||
│ │ CommentRequestDto.java | ||
│ │ CommentResponseDto.java | ||
│ │ | ||
│ └─Service | ||
│ CommentService.java | ||
│ | ||
├─config | ||
│ SecurityConfig.java | ||
│ | ||
├─domain | ||
│ │ Event.java | ||
│ │ Record.java | ||
│ │ User.java | ||
│ │ | ||
│ ├─common | ||
│ │ BaseEntity.java | ||
│ │ | ||
│ ├─enums | ||
│ │ Category.java | ||
│ │ Gender.java | ||
│ │ KeywordName.java | ||
│ │ Role.java | ||
│ │ UserStatus.java | ||
│ │ | ||
│ └─mapping | ||
│ Comment.java | ||
│ EventImage.java | ||
│ Follow.java | ||
│ Participate.java | ||
│ Region.java | ||
│ Wish.java | ||
│ | ||
├─dto | ||
│ CustomUserDetails.java | ||
│ | ||
├─exception | ||
│ CustomException.java | ||
│ ErrorCode.java | ||
│ | ||
├─jwt | ||
│ JWTFilter.java | ||
│ JWTUtil.java | ||
│ LoginFilter.java | ||
│ | ||
├─login | ||
│ ├─api | ||
│ │ UserController.java | ||
│ │ | ||
│ ├─dto | ||
│ │ UpdateUserDetailRequestDto.java | ||
│ │ UserSignInRequestDto.java | ||
│ │ UserSignRoleRequestDto.java | ||
│ │ UserSignUpRequestDto.java | ||
│ │ | ||
│ └─service | ||
│ CustomUserDetailsService.java | ||
│ UserService.java | ||
│ | ||
├─participate | ||
│ ├─controller | ||
│ │ ParticipateController.java | ||
│ │ | ||
│ ├─dto | ||
│ │ ParticipateRequestDto.java | ||
│ │ ParticipateResponseDto.java | ||
│ │ | ||
│ └─service | ||
│ ParticipateService.java | ||
│ | ||
├─record | ||
│ ├─controller | ||
│ │ RecordController.java | ||
│ │ | ||
│ ├─dto | ||
│ │ RecordEtcDto.java | ||
│ │ RecordLectureSeminarDto.java | ||
│ │ RecordMainResponseDto.java | ||
│ │ | ||
│ └─service | ||
│ RecordService.java | ||
│ | ||
├─register | ||
│ ├─controller | ||
│ │ RegisterController.java | ||
│ │ | ||
│ ├─dto | ||
│ │ RegisterEventDto.java | ||
│ │ | ||
│ └─service | ||
│ RegisterService.java | ||
│ | ||
└─repository | ||
CommentRepository.java | ||
EventImageRepository.java | ||
EventRepository.java | ||
ParticipateRepository.java | ||
RecordRepository.java | ||
UserRepository.java | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/careerfestival/career/record/converter/RecordConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
package careerfestival.career.record.converter; | ||
import careerfestival.career.domain.Record; | ||
import careerfestival.career.record.dto.RecordRequestDto; | ||
import careerfestival.career.record.dto.RecordResponseDto; | ||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
public class RecordConverter { | ||
public static Record toRecord(RecordRequestDto.AddRecordConferenceRequestDto request){ | ||
return Record.builder() | ||
.eventName(request.getEventName()) | ||
.eventDate(request.getEventDate()) | ||
.keywordName(request.getKeywordName()) | ||
.eventDescription(request.getEventDescription()) | ||
.networkingName(request.getNetworkingName()) | ||
.networkingContact(request.getNetworkingContact()) | ||
.build(); | ||
} | ||
public static RecordResponseDto.AddRecordResponseDto toAddRecordResponseDto(Record record){ | ||
return RecordResponseDto.AddRecordResponseDto.builder() | ||
.recordId(record.getId()) | ||
.createdAt(LocalDate.from(LocalDateTime.now())) | ||
.build(); | ||
} | ||
//checkpoint localdatetime | ||
} | ||
*/ | ||
//checkpoint 지울지 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/careerfestival/career/record/service/RecordCommandService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
package careerfestival.career.record.service; | ||
import careerfestival.career.record.dto.RecordRequestDto; | ||
import careerfestival.career.domain.Record; | ||
; | ||
public interface RecordCommandService { | ||
Record addRecord(RecordRequestDto.AddRecordConferenceRequestDto request, Long userId); | ||
} | ||
*/ | ||
//checkpoint 지울지 |
42 changes: 42 additions & 0 deletions
42
src/main/java/careerfestival/career/record/service/RecordCommandServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
package careerfestival.career.record.service; | ||
import careerfestival.career.domain.Record; | ||
import careerfestival.career.domain.User; | ||
import careerfestival.career.record.converter.RecordConverter; | ||
import careerfestival.career.record.dto.RecordRequestDto; | ||
import careerfestival.career.repository.RecordRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
import careerfestival.career.repository.UserRepository; | ||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional | ||
public class RecordCommandServiceImpl implements RecordCommandService{ | ||
private final UserRepository userRepository; | ||
private final RecordRepository recordRepository; | ||
@Override | ||
public Record addRecord(RecordRequestDto.AddRecordConferenceRequestDto request, Long userId){ | ||
Record newRecord = RecordConverter.toRecord(request); | ||
User user = userRepository.findById(userId) | ||
.orElseThrow(() -> new RuntimeException("User not found with id: " + userId)); | ||
newRecord.setEventName(request.getEventName()); | ||
newRecord.setEventDate(request.getEventDate()); | ||
newRecord.setKeywordName(request.getKeywordName()); | ||
newRecord.setDetailEventName(req); | ||
newRecord.setUser(user); | ||
//checkpoint userid에 맞게 저장하는방법? | ||
//Optional<User> user = userRepository.findById(userId); | ||
//checkpoint 리스트 | ||
// newRecord.user(user); | ||
return recordRepository.save(newRecord); | ||
}; | ||
} | ||
*/ | ||
//checkpoint 지울지 |
40 changes: 40 additions & 0 deletions
40
src/main/java/careerfestival/career/record/service/RecordConferenceService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package careerfestival.career.record.service; | ||
|
||
import careerfestival.career.domain.Record; | ||
import careerfestival.career.domain.User; | ||
import careerfestival.career.record.dto.RecordEtcDto; | ||
import careerfestival.career.record.dto.RecordLectureSeminarDto; | ||
import careerfestival.career.record.dto.RecordMainResponseDto; | ||
import careerfestival.career.record.dto.RecordRequestDto; | ||
import careerfestival.career.repository.RecordRepository; | ||
import careerfestival.career.repository.UserRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class RecordConferenceService { | ||
private final RecordRepository recordRepository; | ||
private final UserRepository userRepository; | ||
|
||
|
||
public void recordConference(Long userId, RecordRequestDto request) { | ||
|
||
User user = userRepository.findById(userId) | ||
.orElseThrow(()->new RuntimeException("User not found with id: " + userId)); | ||
|
||
Record record = request.toEntity(); | ||
record.setUser(user); | ||
record.setEventName(request.getEventName()); | ||
record.setEventDate(request.getEventDate()); | ||
record.setDetailEventName(request.getDetailEventName()); | ||
record.setEventDescription(request.getEventDescription()); | ||
record.setNetworkingName(request.getNetworkingName()); | ||
record.setNetworkingContact(request.getNetworkingContact()); | ||
recordRepository.save(record); | ||
// Record 테이블에만 저장된 상태 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters