Skip to content

Commit

Permalink
add AnswerType enum, fix enums localisation, fix fake-datas
Browse files Browse the repository at this point in the history
  • Loading branch information
wilczeqqqq committed Jun 4, 2023
1 parent ff7b6e8 commit 4f8a887
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 41 deletions.
7 changes: 7 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,7 @@
package com.pwr.students.domain;

public enum AnswerType {
SLIDER,
TEXT,
RADIO,
}
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
1 change: 0 additions & 1 deletion src/main/java/com/pwr/students/domain/Survey.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.pwr.students.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.pwr.students.repository.SurveyStatus;
import jakarta.persistence.*;
import jakarta.validation.constraints.*;
import java.io.Serializable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.pwr.students.repository;
package com.pwr.students.domain;

public enum SurveyStatus {
DRAFT,
Expand Down
20 changes: 10 additions & 10 deletions src/main/resources/config/liquibase/fake-data/question.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
id;category;answer_type;question_content;is_required;jhi_order;survey_id
1;attitude;calculate Infrastructure;including Networked;true;44743;1
2;Integration Berkshire up;Rubber;revolutionary above Jazz;true;48233;2
3;Jazz;XML;Classical Chevrolet who;true;75409;3
4;sensor Phased;Engineer firewall Northwest;orchestration Palladium;true;33686;4
5;Account provided;Jersey capacitor Thiel;VanXXXXXXXXXXXXX;true;91402;5
6;strategic lame;since Screen Country;lens Principal CSS;true;73489;6
7;cyan Denver ferociously;Southwest;to SouthXXXXXXXX;true;11450;7
8;Thorium Bowie;bluetooth brr;Soap RubberXXXXX;true;17469;8
9;Forward;grey California;Southeast Bacon Copernicium;false;26648;9
10;Czech New;benchmark invoice Rialto;but Brakus South;true;60643;10
1;attitude;TEXT;including Networked;true;44743;1
2;Integration Berkshire up;RADIO;whatever question content;true;48233;2
3;Jazz;SLIDER;whatever question content;true;75409;3
4;sensor Phased;TEXT;orchestration Palladium;true;33686;4
5;Account provided;TEXT;VanXXXXXXXXXXXXX;true;91402;5
6;strategic lame;TEXT;lens Principal CSS;true;73489;6
7;cyan Denver ferociously;SLIDER;to SouthXXXXXXXX;true;11450;7
8;Thorium Bowie;SLIDER;Soap RubberXXXXX;true;17469;8
9;Forward;RADIO;Southeast Bacon Copernicium;false;26648;9
10;Czech New;RADIO;but Brakus South;true;60643;10
20 changes: 10 additions & 10 deletions src/main/resources/config/liquibase/fake-data/survey.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
id;name;description;deadline;status
1;Division;BMW Pound Zealand;2023-05-09;weber Cheese
2;Auburn platforms;networks Architect;2023-05-10;Lauderhill Bedfordshire Chips
3;orchid;Drive ZirconiumX;2023-05-10;Principal
4;infomediaries Route;that EngineerXXX;2023-05-09;neutral incentivize
5;navigation synthesize next;Analyst matrix Interactions;2023-05-09;frozen Steel
6;backing holistic;Rupiah North Luxurious;2023-05-10;silky
7;neutral;panel consequently Operations;2023-05-10;withdrawal Account
8;Ohio avaricious Cisgender;CambridgeshireXX;2023-05-10;stable Wooden
9;Convertible oh;Hybrid KiaXXXXXX;2023-05-10;Account
10;IP Orland;kilogramXXXXXXXX;2023-05-10;Bicycle Markets
1;Division;BMW Pound Zealand;2023-05-09;ACTIVE
2;Auburn platforms;networks Architect;2023-05-10;ACTIVE
3;orchid;Drive ZirconiumX;2023-05-10;ACTIVE
4;infomediaries Route;that EngineerXXX;2023-05-09;ACTIVE
5;navigation synthesize next;Analyst matrix Interactions;2023-05-09;ACTIVE
6;backing holistic;Rupiah North Luxurious;2023-05-10;EXPIRED
7;neutral;panel consequently Operations;2023-05-10;EXPIRED
8;Ohio avaricious Cisgender;CambridgeshireXX;2023-05-10;EXPIRED
9;Convertible oh;Hybrid KiaXXXXXX;2023-05-10;EXPIRED
10;IP Orland;kilogramXXXXXXXX;2023-05-10;DRAFT
22 changes: 11 additions & 11 deletions src/main/resources/config/liquibase/fake-data/survey_assigment.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
id;is_finished
1;true
2;true
3;false
4;true
5;true
6;true
7;false
8;true
9;false
10;true
id;is_finished;survey_id;user_id
1;true;1;1
2;true;2;1
3;false;3;1
4;true;4;1
5;true;5;1
6;true;6;2
7;false;7;2
8;true;8;2
9;false;9;2
10;true;10;2
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

import com.pwr.students.IntegrationTest;
import com.pwr.students.domain.AnswerType;
import com.pwr.students.domain.Question;
import com.pwr.students.repository.QuestionRepository;
import jakarta.persistence.EntityManager;
Expand Down Expand Up @@ -42,8 +43,8 @@ class QuestionResourceIT {
private static final String DEFAULT_CATEGORY = "AAAAAAAAAA";
private static final String UPDATED_CATEGORY = "BBBBBBBBBB";

private static final String DEFAULT_ANSWER_TYPE = "AAAAAAAAAA";
private static final String UPDATED_ANSWER_TYPE = "BBBBBBBBBB";
private static final AnswerType DEFAULT_ANSWER_TYPE = AnswerType.TEXT;
private static final AnswerType UPDATED_ANSWER_TYPE = AnswerType.RADIO;

private static final String DEFAULT_QUESTION_CONTENT = "AAAAAAAAAAAAAAAA";
private static final String UPDATED_QUESTION_CONTENT = "BBBBBBBBBBBBBBBB";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import com.pwr.students.IntegrationTest;
import com.pwr.students.domain.Survey;
import com.pwr.students.domain.SurveyStatus;
import com.pwr.students.repository.SurveyRepository;
import com.pwr.students.repository.SurveyStatus;
import jakarta.persistence.EntityManager;
import java.time.LocalDate;
import java.time.ZoneId;
Expand All @@ -26,7 +26,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.http.MediaType;
import org.springframework.security.test.context.support.WithMockUser;
Expand Down

0 comments on commit 4f8a887

Please sign in to comment.