Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user survey completion flow #139

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
240 changes: 240 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"react-dom": "18.2.0",
"react-hook-form": "7.43.9",
"react-icons": "^4.8.0",
"react-input-slider": "^6.0.1",
"react-jhipster": "jhipster/react-jhipster",
"react-loadable": "5.5.0",
"react-redux": "8.0.5",
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/pwr/students/domain/AnswerType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.pwr.students.domain;

public enum AnswerType {
SLIDER,
TEXT,
}
9 changes: 5 additions & 4 deletions src/main/java/com/pwr/students/domain/Question.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class Question implements Serializable {

@NotNull
@Column(name = "answer_type", nullable = false)
private String answerType;
@Enumerated(EnumType.STRING)
private AnswerType answerType;

@NotNull
@Size(min = 16, max = 255)
Expand Down Expand Up @@ -75,16 +76,16 @@ public void setCategory(String category) {
this.category = category;
}

public String getAnswerType() {
public AnswerType getAnswerType() {
return this.answerType;
}

public Question answerType(String answerType) {
public Question answerType(AnswerType answerType) {
this.setAnswerType(answerType);
return this;
}

public void setAnswerType(String answerType) {
public void setAnswerType(AnswerType answerType) {
this.answerType = answerType;
}

Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/pwr/students/domain/Survey.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public class Survey implements Serializable {
private LocalDate deadline;

@Column(name = "status")
private String status;
@Enumerated(EnumType.STRING)
private SurveyStatus status;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "survey")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
Expand Down Expand Up @@ -115,16 +116,16 @@ public void setDeadline(LocalDate deadline) {
this.deadline = deadline;
}

public String getStatus() {
public SurveyStatus getStatus() {
return this.status;
}

public Survey status(String status) {
public Survey status(SurveyStatus status) {
this.setStatus(status);
return this;
}

public void setStatus(String status) {
public void setStatus(SurveyStatus status) {
this.status = status;
}

Expand Down
7 changes: 7 additions & 0 deletions src/main/java/com/pwr/students/domain/SurveyStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.pwr.students.domain;

public enum SurveyStatus {
DRAFT,
ACTIVE,
EXPIRED,
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ default Page<SurveyAssigment> findAllWithEagerRelationships(Pageable pageable) {

@Query("select surveyAssigment from SurveyAssigment surveyAssigment left join fetch surveyAssigment.user where surveyAssigment.id =:id")
Optional<SurveyAssigment> findOneWithToOneRelationships(@Param("id") Long id);

@Query("SELECT sa FROM SurveyAssigment sa WHERE sa.survey.id = :surveyId")
List<SurveyAssigment> findAllBySurveyId(@Param("surveyId") Long surveyId);
}
Loading