-
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
jeonggeon
committed
Jan 17, 2024
1 parent
48767d5
commit 40aad54
Showing
9 changed files
with
167 additions
and
2 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
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
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
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()) | ||
.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 | ||
|
||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/careerfestival/career/record/dto/RecordRequestDto.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,33 @@ | ||
package careerfestival.career.record.dto; | ||
|
||
import careerfestival.career.domain.Category; | ||
import careerfestival.career.domain.mapping.RecordKeyword; | ||
import jakarta.persistence.Column; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Getter; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public class RecordRequestDto { | ||
|
||
@Getter | ||
public static class AddRecordConferenceRequestDto{ | ||
@NotNull | ||
private String eventName; | ||
@NotNull | ||
private LocalDate deadline; | ||
@NotNull | ||
private List<RecordKeyword> recordKeywords; | ||
@NotNull | ||
private Category category; | ||
@NotNull | ||
private LocalDateTime eventDate; | ||
//checkpoint 세션과 부스 어차피 같은 형태로 그냥 제목부스이름이던 세션이름이던 같이 받을 수 있음 그래서 event description 제목 받을 거 하나 생성 | ||
@NotNull | ||
private String eventDescription; | ||
private String networkingName; | ||
private String networkingContact; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/careerfestival/career/record/dto/RecordResponseDto.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,21 @@ | ||
package careerfestival.career.record.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class RecordResponseDto { | ||
@Builder | ||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class AddRecordResponseDto{ | ||
private Long recordId; | ||
private Long userId; | ||
private LocalDate createdAt; | ||
|
||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
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,12 @@ | ||
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); | ||
} |
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
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); | ||
//checkpoint userid에 맞게 저장하는방법? | ||
//Optional<User> user = userRepository.findById(userId); | ||
//checkpoint 리스트 | ||
// newRecord.user(user); | ||
return recordRepository.save(newRecord); | ||
}; | ||
|
||
} |
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