-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [feat] : CQRS Mongo Async and Command * [feat]: Query CQRS Refactoring ( JPA -> MoongoDB ) * [refactor]: remove unused entity and repository * [feat]: Axon update query logging level disabled
- Loading branch information
1 parent
853357b
commit 553ae09
Showing
54 changed files
with
713 additions
and
602 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
server/.gradle/7.6.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
46 changes: 46 additions & 0 deletions
46
...it-Api/src/main/java/com/econovation/recruit/api/applicant/aggregate/AnswerAggregate.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,46 @@ | ||
package com.econovation.recruit.api.applicant.aggregate; | ||
|
||
import static org.axonframework.modelling.command.AggregateLifecycle.apply; | ||
|
||
import com.econovation.recruit.api.applicant.command.CreateAnswerCommand; | ||
import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswer; | ||
import com.econovation.recruitdomain.domains.applicant.event.aggregateevent.AnswerCreatedEvent; | ||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.axonframework.commandhandling.CommandHandler; | ||
import org.axonframework.eventsourcing.EventSourcingHandler; | ||
import org.axonframework.modelling.command.AggregateIdentifier; | ||
import org.axonframework.spring.stereotype.Aggregate; | ||
|
||
@AllArgsConstructor | ||
@Getter | ||
@Aggregate | ||
@Slf4j | ||
@NoArgsConstructor | ||
public class AnswerAggregate { | ||
|
||
@AggregateIdentifier private String id; | ||
private Integer year; | ||
private Map<String, Object> qna; | ||
// Constructor for creating an AnswerAggregate | ||
@CommandHandler | ||
public AnswerAggregate(CreateAnswerCommand command) { | ||
|
||
apply(new AnswerCreatedEvent(command.getId(), command.getYear(), command.getQna())); | ||
} | ||
|
||
// Event handler for AnswerCreatedEvent | ||
@EventSourcingHandler | ||
public void on(AnswerCreatedEvent event) { | ||
this.id = event.getId(); | ||
this.year = event.getYear(); | ||
this.qna = event.getQna(); | ||
} | ||
|
||
public static AnswerAggregate from(MongoAnswer answer) { | ||
return new AnswerAggregate(answer.getId(), answer.getYear(), answer.getQna()); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...main/java/com/econovation/recruit/api/applicant/aggregate/AnswerCreatedEventListener.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,27 @@ | ||
package com.econovation.recruit.api.applicant.aggregate; | ||
|
||
import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswer; | ||
import com.econovation.recruitdomain.domains.applicant.domain.MongoAnswerAdaptor; | ||
import com.econovation.recruitdomain.domains.applicant.event.aggregateevent.AnswerCreatedEvent; | ||
import lombok.RequiredArgsConstructor; | ||
import org.axonframework.eventhandling.EventHandler; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class AnswerCreatedEventListener { | ||
private final MongoAnswerAdaptor answerAdaptor; | ||
|
||
@EventHandler | ||
public void handle(AnswerCreatedEvent event) { | ||
MongoAnswer answer = | ||
MongoAnswer.builder() | ||
.id(event.getId()) | ||
.year(event.getYear()) | ||
.qna(event.getQna()) | ||
.build(); | ||
answerAdaptor.save(answer); | ||
|
||
// email 전송 event처리 | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...-Api/src/main/java/com/econovation/recruit/api/applicant/command/CreateAnswerCommand.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,20 @@ | ||
package com.econovation.recruit.api.applicant.command; | ||
|
||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.ToString; | ||
import org.axonframework.modelling.command.TargetAggregateIdentifier; | ||
|
||
@AllArgsConstructor | ||
@ToString | ||
@Data | ||
@NoArgsConstructor | ||
@Getter | ||
public class CreateAnswerCommand { | ||
@TargetAggregateIdentifier private String id; | ||
private Integer year; | ||
private Map<String, Object> qna; | ||
} |
42 changes: 0 additions & 42 deletions
42
...-Api/src/main/java/com/econovation/recruit/api/applicant/controller/AnswerController.java
This file was deleted.
Oops, something went wrong.
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
13 changes: 13 additions & 0 deletions
13
.../src/main/java/com/econovation/recruit/api/applicant/docs/ReadApplicantExceptionDocs.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,13 @@ | ||
package com.econovation.recruit.api.applicant.docs; | ||
|
||
import com.econovation.recruitcommon.annotation.ExceptionDoc; | ||
import com.econovation.recruitcommon.annotation.ExplainError; | ||
import com.econovation.recruitcommon.exception.RecruitCodeException; | ||
import com.econovation.recruitcommon.interfaces.SwaggerExampleExceptions; | ||
import com.econovation.recruitdomain.domains.applicant.exception.ApplicantDuplicateSubmitException; | ||
|
||
@ExceptionDoc | ||
public class ReadApplicantExceptionDocs implements SwaggerExampleExceptions { | ||
@ExplainError("지원서를 중복으로 제출했을 경우") | ||
public RecruitCodeException 지원서_중복_제출_예외 = ApplicantDuplicateSubmitException.EXCEPTION; | ||
} |
18 changes: 18 additions & 0 deletions
18
...cruit-Api/src/main/java/com/econovation/recruit/api/applicant/dto/AnswersResponseDto.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,18 @@ | ||
package com.econovation.recruit.api.applicant.dto; | ||
|
||
import com.econovation.recruit.utils.vo.PageInfo; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class AnswersResponseDto { | ||
private PageInfo pageInfo; | ||
private List<Map<String, Object>> answers; | ||
|
||
public static AnswersResponseDto of(List<Map<String, Object>> list, PageInfo pageInfo) { | ||
return new AnswersResponseDto(pageInfo, list); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../econovation/recruit/api/applicant/handler/ApplicantRegisterEventConfirmEmailHandler.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
12 changes: 12 additions & 0 deletions
12
...er/Recruit-Api/src/main/java/com/econovation/recruit/api/applicant/query/AnswerQuery.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 com.econovation.recruit.api.applicant.query; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class AnswerQuery { | ||
private String answerId; | ||
} |
11 changes: 11 additions & 0 deletions
11
...uit-Api/src/main/java/com/econovation/recruit/api/applicant/query/AnswersByYearQuery.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,11 @@ | ||
package com.econovation.recruit.api.applicant.query; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class AnswersByYearQuery { | ||
private Integer year; | ||
private Integer page; | ||
} |
Oops, something went wrong.