Skip to content

Commit

Permalink
Merge pull request #74 from JimTheCat/CU-8696y76jy_EPIC---API-v3_King…
Browse files Browse the repository at this point in the history
…a-Traczyk

feature: Database refactor - make db h2 and test friendly
  • Loading branch information
KinTrae authored Dec 14, 2024
2 parents e42fb28 + 25a4f43 commit 46a98c9
Show file tree
Hide file tree
Showing 42 changed files with 92 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +29,6 @@
public class Chatroom {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +29,6 @@
public class ChatroomMessage {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
9 changes: 4 additions & 5 deletions backend/src/main/java/meowhub/backend/jpa_buddy/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +29,6 @@
public class Comment {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand All @@ -47,10 +46,10 @@ public class Comment {
private User user;

@Size(max = 2000)
@Column(name = "VALUE", length = 2000)
private String value;
@Column(name = "CONTENT", length = 2000)
private String content;

@Column(name = "\"index\"")
@Column(name = "COMMENT_INDEX")
private Long index;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down
2 changes: 0 additions & 2 deletions backend/src/main/java/meowhub/backend/jpa_buddy/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -32,7 +31,6 @@
public class Group {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +29,6 @@
public class GroupchatMessage {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
2 changes: 0 additions & 2 deletions backend/src/main/java/meowhub/backend/jpa_buddy/LikeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

import java.time.LocalDate;
import java.util.LinkedHashSet;
Expand All @@ -24,7 +23,6 @@
public class LikeType {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
2 changes: 0 additions & 2 deletions backend/src/main/java/meowhub/backend/jpa_buddy/Liked.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +25,6 @@
public class Liked {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +28,6 @@
public class MatchingChat {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +25,6 @@
public class MatchingChatMessage {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +29,6 @@
public class MatchingProfile {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +28,6 @@
public class MatchingProfilePicture {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand All @@ -47,7 +45,7 @@ public class MatchingProfilePicture {
private Picture picture;

@NotNull
@Column(name = "\"index\"", nullable = false)
@Column(name = "PICTURE_INDEX", nullable = false)
private Long index;

@NotNull
Expand Down
3 changes: 1 addition & 2 deletions backend/src/main/java/meowhub/backend/jpa_buddy/Picture.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -29,7 +29,6 @@
public class Picture {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
3 changes: 1 addition & 2 deletions backend/src/main/java/meowhub/backend/jpa_buddy/Post.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -30,7 +30,6 @@
public class Post {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +25,6 @@
public class PostPicture {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
3 changes: 1 addition & 2 deletions backend/src/main/java/meowhub/backend/jpa_buddy/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -30,7 +30,6 @@
public class Profile {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

import java.time.LocalDate;
import java.util.LinkedHashSet;
Expand All @@ -24,7 +23,6 @@
public class ProfileData {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +25,6 @@
public class ProfilePicture {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand All @@ -44,7 +42,7 @@ public class ProfilePicture {
private Picture picture;

@NotNull
@Column(name = "\"index\"", nullable = false)
@Column(name = "PICTURE_INDEX", nullable = false)
private Long index;

@Column(name = "CREATED_AT")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +25,6 @@
public class ProfileUserData {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand All @@ -45,8 +43,8 @@ public class ProfileUserData {

@Size(max = 200)
@NotNull
@Column(name = "VALUE", nullable = false, length = 200)
private String value;
@Column(name = "CONTENT", nullable = false, length = 200)
private String content;

@Column(name = "CREATED_AT")
private LocalDate createdAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;

import java.time.LocalDate;
import java.util.LinkedHashSet;
Expand All @@ -27,7 +26,6 @@
public class RelationType {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +26,6 @@
public class UserGroup {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import meowhub.backend.users.models.User;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

Expand All @@ -26,7 +26,6 @@
public class UserRelation {
@Id
@Size(max = 36)
@ColumnDefault("sys_guid()")
@GeneratedValue(strategy = GenerationType.UUID)
@Column(name = "ID", nullable = false, length = 36)
private String id;
Expand All @@ -53,8 +52,7 @@ public class UserRelation {
@Column(name = "SEND_DATE", nullable = false)
private LocalDate sendDate;

@NotNull
@Column(name = "ANSWER_DATE", nullable = false)
@Column(name = "ANSWER_DATE")
private LocalDate answerDate;

@Column(name = "CREATED_AT")
Expand Down
Loading

0 comments on commit 46a98c9

Please sign in to comment.