Skip to content

Commit

Permalink
refactor: Upgrade to model-2.0.62
Browse files Browse the repository at this point in the history
closes #1627
  • Loading branch information
jo-elimu committed Nov 1, 2023
1 parent 6e81204 commit b1f7d4a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<model.version>2.0.53</model.version> <!-- https://github.com/orgs/elimu-ai/packages?repo_name=model -->
<model.version>2.0.62</model.version> <!-- https://github.com/orgs/elimu-ai/packages?repo_name=model -->
<hibernate.version>5.5.7.Final</hibernate.version> <!-- https://repo.maven.apache.org/maven2/org/hibernate/ -->
<jetty.version>9.4.31.v20200723</jetty.version> <!-- https://repo.maven.apache.org/maven2/org/eclipse/jetty/ -->
<spring.version>5.3.18</spring.version> <!-- https://repo.maven.apache.org/maven2/org/springframework/ -->
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import ai.elimu.model.v2.gson.content.EmojiGson;
import ai.elimu.model.v2.gson.content.ImageGson;
import ai.elimu.model.v2.gson.content.LetterGson;
import ai.elimu.model.v2.gson.content.LetterSoundCorrespondenceGson;
import ai.elimu.model.v2.gson.content.LetterSoundGson;
import ai.elimu.model.v2.gson.content.NumberGson;
import ai.elimu.model.v2.gson.content.StoryBookChapterGson;
import ai.elimu.model.v2.gson.content.StoryBookGson;
Expand Down Expand Up @@ -88,11 +88,11 @@ public static SoundGson getSoundGson(Sound sound) {
}
}

public static LetterSoundCorrespondenceGson getLetterSoundGson(LetterSoundCorrespondence letterSound) {
public static LetterSoundGson getLetterSoundGson(LetterSoundCorrespondence letterSound) {
if (letterSound == null) {
return null;
} else {
LetterSoundCorrespondenceGson letterSoundGson = new LetterSoundCorrespondenceGson();
LetterSoundGson letterSoundGson = new LetterSoundGson();

Check warning on line 95 in src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java#L95

Added line #L95 was not covered by tests

// BaseEntity
letterSoundGson.setId(letterSound.getId());
Expand Down Expand Up @@ -131,12 +131,12 @@ public static WordGson getWordGson(Word word) {

// Word
wordGson.setText(word.getText());
List<LetterSoundCorrespondenceGson> letterSounds = new ArrayList<>();
List<LetterSoundGson> letterSounds = new ArrayList<>();

Check warning on line 134 in src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java#L134

Added line #L134 was not covered by tests
for (LetterSoundCorrespondence letterSound : word.getLetterSoundCorrespondences()) {
LetterSoundCorrespondenceGson letterSoundGson = getLetterSoundGson(letterSound);
LetterSoundGson letterSoundGson = getLetterSoundGson(letterSound);

Check warning on line 136 in src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java#L136

Added line #L136 was not covered by tests
letterSounds.add(letterSoundGson);
}
wordGson.setLetterSoundCorrespondences(letterSounds);
wordGson.setLetterSounds(letterSounds);

Check warning on line 139 in src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/JpaToGsonConverter.java#L139

Added line #L139 was not covered by tests
wordGson.setWordType(word.getWordType());

return wordGson;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ai.elimu.rest.v2.content;

import ai.elimu.model.content.LetterSoundCorrespondence;
import ai.elimu.model.v2.gson.content.LetterSoundCorrespondenceGson;
import ai.elimu.model.v2.gson.content.LetterSoundGson;
import ai.elimu.rest.v2.JpaToGsonConverter;
import com.google.gson.Gson;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -30,7 +30,7 @@ public String handleGetRequest() {

JSONArray letterSoundsJsonArray = new JSONArray();
for (LetterSoundCorrespondence letterSound : letterSoundDao.readAllOrderedByUsage()) {
LetterSoundCorrespondenceGson letterSoundGson = JpaToGsonConverter.getLetterSoundGson(letterSound);
LetterSoundGson letterSoundGson = JpaToGsonConverter.getLetterSoundGson(letterSound);

Check warning on line 33 in src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/content/LetterSoundsRestController.java#L33

Added line #L33 was not covered by tests
String json = new Gson().toJson(letterSoundGson);
letterSoundsJsonArray.put(new JSONObject(json));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ai.elimu.model.contributor.Contributor;
import ai.elimu.model.contributor.WordContributionEvent;
import ai.elimu.model.enums.Platform;
import ai.elimu.model.v2.gson.content.LetterSoundCorrespondenceGson;
import ai.elimu.model.v2.gson.content.LetterSoundGson;
import ai.elimu.model.v2.gson.content.WordGson;
import ai.elimu.model.v2.gson.crowdsource.WordContributionEventGson;
import ai.elimu.rest.v2.JpaToGsonConverter;
Expand Down Expand Up @@ -63,7 +63,7 @@ public String getLetterSoundCorrespondences(HttpServletRequest request, HttpServ

JSONArray letterSoundCorrespondencesJsonArray = new JSONArray();
for (LetterSoundCorrespondence letterSoundCorrespondence : letterSoundDao.readAllOrderedByUsage()) {
LetterSoundCorrespondenceGson letterSoundCorrespondenceGson =
LetterSoundGson letterSoundCorrespondenceGson =

Check warning on line 66 in src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java#L66

Added line #L66 was not covered by tests
JpaToGsonConverter.getLetterSoundGson(letterSoundCorrespondence);
String json = new Gson().toJson(letterSoundCorrespondenceGson);
letterSoundCorrespondencesJsonArray.put(new JSONObject(json));
Expand Down Expand Up @@ -144,9 +144,9 @@ public String postWordContribution(
Word word = new Word();
word.setWordType(wordGson.getWordType());
word.setText(wordGson.getText().toLowerCase());
List<LetterSoundCorrespondenceGson> letterSoundCorrespondencesGsons = wordGson.getLetterSoundCorrespondences();
List<LetterSoundGson> letterSoundCorrespondencesGsons = wordGson.getLetterSounds();

Check warning on line 147 in src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/ai/elimu/rest/v2/crowdsource/WordContributionRestController.java#L147

Added line #L147 was not covered by tests
List<LetterSoundCorrespondence> letterSoundCorrespondences = new ArrayList<>();
for (LetterSoundCorrespondenceGson letterSoundCorrespondenceGson : letterSoundCorrespondencesGsons) {
for (LetterSoundGson letterSoundCorrespondenceGson : letterSoundCorrespondencesGsons) {
LetterSoundCorrespondence letterSoundCorrespondence =
letterSoundDao.read(letterSoundCorrespondenceGson.getId());
letterSoundCorrespondences.add(letterSoundCorrespondence);
Expand Down

0 comments on commit b1f7d4a

Please sign in to comment.