Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package dev.pronunciationAppBack.model;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToMany;

import java.util.List;

@Entity
public class Category {
@Id
private String id;
private String categoryName;
private String subCategoryName;
private String description;
private int wordCount;

@ManyToMany(mappedBy = "categories")
private List<Word> words;

public Category() {}

public Category(String id, String categoryName, String subCategoryName, String description, int wordCount) {
this.id = id;
this.categoryName = categoryName;
this.subCategoryName = subCategoryName;
this.description = description;
this.wordCount = wordCount;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getCategoryName() {
return categoryName;
}

public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}

public String getSubCategoryName() {
return subCategoryName;
}

public void setSubCategoryName(String subCategoryName) {
this.subCategoryName = subCategoryName;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public int getWordCount() {
return wordCount;
}

public void setWordCount(int wordCount) {
this.wordCount = wordCount;
}

@Override
public String toString() {
return "Category{" +
"id='" + id + '\'' +
", categoryName='" + categoryName + '\'' +
", subCategoryName='" + subCategoryName + '\'' +
", description='" + description + '\'' +
", wordCount=" + wordCount +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
package dev.pronunciationAppBack.model;

import jakarta.persistence.Entity;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;
import jakarta.persistence.OneToOne;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.Enumerated;
import jakarta.persistence.EnumType;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

import java.util.Date;
import java.util.List;

@Entity
@Data
Expand Down Expand Up @@ -45,5 +38,8 @@ public enum Stage {
@JoinColumn(name = "user_id")
private AppUser appUser;

@OneToMany(mappedBy = "gameProgress")
private List<Stage> stages;


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
package dev.pronunciationAppBack.model;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;

import java.util.List;

@Entity
public class LevelWord {
@Id
private String id;
private int number;
private String name;
private int requiredScore;
private boolean isBlocked;

@OneToMany(mappedBy = "levelWord")
private List<Word> words;

public LevelWord() {}

public LevelWord(String id, int number, String name, int requiredScore, boolean isBlocked) {
this.id = id;
this.number = number;
this.name = name;
this.requiredScore = requiredScore;
this.isBlocked = isBlocked;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public int getNumber() {
return number;
}

public void setNumber(int number) {
this.number = number;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public int getRequiredScore() {
return requiredScore;
}
public void setRequiredScore(int requiredScore) {
this.requiredScore = requiredScore;
}

public boolean isBlocked() {
return isBlocked;
}

public void setBlocked(boolean isBlocked) {
this.isBlocked = isBlocked;
}

public List<Word> getWords() {
return words;
}

public void setWords(List<Word> words) {
this.words = words;
}

@Override
public String toString() {
return "LevelWord{" +
"id='" + id + '\'' +
", number=" + number +
", name='" + name + '\'' +
", requiredScore=" + requiredScore +
", isBlocked=" + isBlocked +
", words=" + words +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package dev.pronunciationAppBack.model;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;

import java.util.List;

@Entity
public class Stage {
@Id
private String id;
private String name;
private String avatarUrl;
private String status;
private int progress;
private int currentScore;

@ManyToOne
private GameProgress gameProgress;

@OneToMany(mappedBy = "stage")
private List<StageWord> stageWords;

}
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package dev.pronunciationAppBack.model;

import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.ToString;

import jakarta.persistence.Id;
import java.util.Date;

@Entity
Expand All @@ -30,4 +27,11 @@ public class StageWord {
public enum Status {
DONE, PENDING, FAIL
}

@ManyToOne
private Word word;

@ManyToOne
private Stage stage;

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package dev.pronunciationAppBack.model;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.*;


import java.util.List;
Expand All @@ -22,6 +20,18 @@ public class Word {
@OneToMany(mappedBy = "word")
private List<Pronunciation> pronunciations;

@ManyToMany
@JoinTable(name = "word_category",
joinColumns = @JoinColumn(name = "WORD_ID_FK"),
inverseJoinColumns = @JoinColumn(name = "CATEGORY_ID_FK"))
private List<Category> categories;

@ManyToOne
private LevelWord levelWord;

@OneToMany(mappedBy = "word")
private List<StageWord> stageWords;

public Word() {}

public Word(String id, String wordName, String definition, String phoneticSpelling, String sentence, boolean isActive, int level) {
Expand Down