Skip to content

Commit

Permalink
commit ask question use case half way done
Browse files Browse the repository at this point in the history
  • Loading branch information
josephpcsywm committed Jul 19, 2023
1 parent 663f073 commit 7ade83c
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/main/java/askquestion/AskQuestionInteractor.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
package askquestion;

public class AskQuestionInteractor {
import questionentities.Question;
import questiongateway.QuestionGateway;
import screenpresenter.ScreenOutputBoundary;

public class AskQuestionInteractor implements QuestionInputBoundary{
final QuestionGateway questionGateway;
final ScreenOutputBoundary screenOutputBoundary;
final QuestionFactory questionFactory;

public AskQuestionInteractor(QuestionGateway questionGateway, ScreenOutputBoundary screenOutputBoundary,
QuestionFactory questionFactory){
this.questionGateway = questionGateway;
this.screenOutputBoundary = screenOutputBoundary;
this.questionFactory = questionFactory;
}

public QuestionResponseModel createQuestion(QuestionRequestModel questionRequestModel){
Question question = questionFactory.create(questionRequestModel);
}
}
13 changes: 13 additions & 0 deletions src/main/java/askquestion/QuestionControl.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
package askquestion;

import java.time.LocalDate;

public class QuestionControl {
final QuestionInputBoundary questionInput;

public QuestionControl(QuestionInputBoundary questionInputBoundary){
this.questionInput = questionInputBoundary;
}

QuestionResponseModel createQuestion(String questionCategory, int createAt, int askedByClient, LocalDate legalDeadline){
QuestionRequestModel requestModel = new QuestionRequestModel(questionCategory, createAt, askedByClient, legalDeadline);

return questionInput.createQuestion(requestModel);
}
}
7 changes: 7 additions & 0 deletions src/main/java/askquestion/QuestionFactory.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
package askquestion;

import questionentities.Question;

import java.time.LocalDate;

public class QuestionFactory {
public Question create(int questionId, LocalDate createAt, int askedByClient, LocalDate legalDeadline){
return new Question(questionId, createAt, askedByClient, legalDeadline);
}
}
1 change: 1 addition & 0 deletions src/main/java/askquestion/QuestionInputBoundary.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package askquestion;

public interface QuestionInputBoundary {
QuestionResponseModel createQuestion(QuestionRequestModel questionRequestModel);
}
51 changes: 51 additions & 0 deletions src/main/java/askquestion/QuestionRequestModel.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,55 @@
package askquestion;

import java.time.LocalDate;

public class QuestionRequestModel {
private String questionCategory;
private int createAt;
private int askedByClient;
private LocalDate legalDeadline = null;

public QuestionRequestModel(String questionCategory, int createAt, int askedByClient, LocalDate legalDeadline) {
this.questionCategory = questionCategory;
this.createAt = createAt;
this.askedByClient = askedByClient;
this.legalDeadline = legalDeadline;
}

public QuestionRequestModel(String questionCategory, int createAt, int askedByClient) {
this.questionCategory = questionCategory;
this.createAt = createAt;
this.askedByClient = askedByClient;
}

public String getQuestionCategory() {
return questionCategory;
}

public void setQuestionCategory(String questionCategory) {
this.questionCategory = questionCategory;
}

public int getCreateAt() {
return createAt;
}

public void setCreateAt(int createAt) {
this.createAt = createAt;
}

public int getAskedByClient() {
return askedByClient;
}

public void setAskedByClient(int askedByClient) {
this.askedByClient = askedByClient;
}

public LocalDate getLegalDeadline() {
return legalDeadline;
}

public void setLegalDeadline(LocalDate legalDeadline) {
this.legalDeadline = legalDeadline;
}
}
35 changes: 35 additions & 0 deletions src/main/java/askquestion/QuestionResponseModel.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,39 @@
package askquestion;

import java.time.LocalDate;

public class QuestionResponseModel {
int questionId;
LocalDate createAt;
boolean message;

public QuestionResponseModel(int questionId, LocalDate createAt, boolean message){
this.questionId = questionId;
this.createAt = createAt;
this.message = message;
}

public int getQuestionId() {
return questionId;
}

public void setQuestionId(int questionId) {
this.questionId = questionId;
}

public LocalDate getCreateAt() {
return createAt;
}

public void setCreateAt(LocalDate createAt) {
this.createAt = createAt;
}

public boolean getMessage(){
return message;
}

public void setMessage(boolean message) {
this.message = message;
}
}

0 comments on commit 7ade83c

Please sign in to comment.