Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 13-presenter-1-screen…
Browse files Browse the repository at this point in the history
…-presenter
  • Loading branch information
YifanLiu2 committed Jul 18, 2023
2 parents 54f8d96 + 242df6e commit c640a97
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 26 deletions.
1 change: 1 addition & 0 deletions project_plan_dev.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Project Planning and Development with Github

In this course project, you are expected to use Github to manage your code. This document describes the workflow for using Github when you are developing the course project. Please read it carefully and follow the instructions. **Try to work through the steps with the help of your team first, but please ask for help if your team gets stuck on any of the steps or needs something clarified.**
Expand Down
60 changes: 37 additions & 23 deletions src/main/java/questionentities/Question.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package questionentities;

import java.time.LocalDate;
import java.util.List;
import java.util.ArrayList;

Expand All @@ -10,22 +11,45 @@
* whether the question has been taken and who took the question, and a list of post belongs to the question.
*/
public class Question {

private final int questionId;
private final LocalDate createAt;
private final int askedByClient;
private final LocalDate legalDeadline;
private boolean isTaken;
private int takenByAttorney;
private boolean isClose;
private int rating;
private List<Post> posts;
private Integer questionId;


public Question(int questionId, LocalDate createAt, int askedByClient, LocalDate legalDeadline) {
this.questionId = questionId;
this.createAt = createAt;
this.askedByClient = askedByClient;
this.legalDeadline = legalDeadline;
this.posts = new ArrayList<Post>();
}

public Question(int questionId, LocalDate createAt, int askedByClient, boolean isTaken, int takenByAttorney,
boolean isClose, int rating, List<Post> posts, LocalDate legalDeadline) {
this.questionId = questionId;
this.createAt = createAt;
this.askedByClient = askedByClient;
this.isTaken = isTaken;
this.takenByAttorney = takenByAttorney;
this.isClose = isClose;
this.rating = rating;
this.posts = posts;
this.legalDeadline = legalDeadline;
}

/**
* Constructs a new question
*
* @param clientId id of the client who asked the question
*
* @return an int id represents the question
*/
public Question(int clientId) {
askedByClient = clientId;
posts = new ArrayList<Post>();
public int getQuestionId() {
return questionId;
}

/**
Expand Down Expand Up @@ -101,28 +125,18 @@ public List<Post> getPosts() {
}

/**
* add post to the post list
*
* @param post a Post object to be added to the post list
* @param posts a list of posts
*/
public void addPosts(Post post) {
this.posts.add(post);
}
public void setPosts(List<Post> posts) {this.posts = posts;}

/**
* add post to the post list
*
*
* @return an int id represents the question
*/
public Integer getQuestionId() {
return questionId;
}
/**
*
* @param questionId set the id for the question
* @param post a Post object to be added to the post list
*/
public void setQuestionId(Integer questionId) {
this.questionId = questionId;
public void addPosts(Post post) {
this.posts.add(post);
}

}
14 changes: 11 additions & 3 deletions src/main/java/questiongateway/QuestionGateway.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
package questiongateway;

import questionentities.Post;
import questionentities.Question;
import java.util.List;

public interface QuestionGateway {

void saveQuestion(Question question);
Question getQuestion(int questionId);

void updateQuestion(Question question);
List<Question> getAllQuestion();
List<Question> getNotTakenQuestion();
List<Question> getNotClosedQuestion();
void updateIsTaken(int questionId, boolean iaTaken);
void updateTakenByAttorney(int questionId, boolean attorneyId);
void updateIsClose(int questionId, boolean isClose);
void updateRating(int questionId, int rating);
void updatePosts(int questionId, Post post);
}

0 comments on commit c640a97

Please sign in to comment.