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

[Feature] table 초기화 flyway 작성 및 방 전체 조회 api #666

Merged
merged 12 commits into from
Mar 1, 2024
Merged
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ editorconfig {
}

springBoot {
mainClass = "gg.pingpong.api.PingPongApiApplication"
mainClass = "gg.PingPongApiApplication"
}

group = 'io.42pp'
Expand Down
25 changes: 25 additions & 0 deletions gg-data/src/main/java/gg/data/party/Category.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gg.data.party;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import gg.data.BaseTimeEntity;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Category extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(name = "category_name", length = 10)
private String categoryName;

}
43 changes: 43 additions & 0 deletions gg-data/src/main/java/gg/data/party/Comment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package gg.data.party;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import gg.data.BaseTimeEntity;
import gg.data.user.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Comment extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_room_id")
private UserRoom userRoom;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "room_id")
private Room room;

@Column(name = "content", length = 100)
private String content;

@Column(name = "is_hidden")
private Boolean isHidden;
}
40 changes: 40 additions & 0 deletions gg-data/src/main/java/gg/data/party/CommentReport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package gg.data.party;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import gg.data.BaseTimeEntity;
import gg.data.user.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class CommentReport extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reporter_id")
private User reporter;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "comment_id")
private Comment comment;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "room_id")
private Room room;

@Column(length = 100)
private String message;
}
45 changes: 45 additions & 0 deletions gg-data/src/main/java/gg/data/party/GameTemplate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package gg.data.party;

import javax.persistence.*;

import gg.data.BaseTimeEntity;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class GameTemplate extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id")
private Category category;

@Column(length = 10)
private String gameName;

@Column
private Integer maxGamePeople;

@Column
private Integer minGamePeople;

@Column
private Integer maxGameTime;

@Column
private Integer minGameTime;

@Column(length = 10)
private String genre;

@Column(length = 10)
private String difficulty;

@Column(length = 100)
private String summary;
}
67 changes: 67 additions & 0 deletions gg-data/src/main/java/gg/data/party/Room.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package gg.data.party;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import gg.data.BaseTimeEntity;
import gg.data.party.type.RoomType;
import gg.data.user.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Room extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "host_id")
private User host;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "creator_id")
private User creator;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id")
private Category category;

@Column(name = "title", length = 15)
private String title;

@Column(name = "content", length = 100)
private String content;

@Column
private Integer maxPeople;

@Column
private Integer minPeople;

@Column
private LocalDateTime dueDate;

@OneToMany(mappedBy = "room", cascade = CascadeType.ALL)
private List<Comment> comments = new ArrayList<>();

@Enumerated(EnumType.STRING)
private RoomType roomStatus;
}
40 changes: 40 additions & 0 deletions gg-data/src/main/java/gg/data/party/RoomReport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package gg.data.party;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import gg.data.BaseTimeEntity;
import gg.data.user.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class RoomReport extends BaseTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reporter_id")
private User reporter;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reportee_id")
private User reportee;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "room_id")
private Room room;

@Column(length = 100)
private String message;
}
39 changes: 39 additions & 0 deletions gg-data/src/main/java/gg/data/party/UserReport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package gg.data.party;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import gg.data.user.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class UserReport {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reporter_id")
private User reporter;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reportee_id")
private User reportee;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "room_id")
private Room room;

@Column(length = 100)
private String message;
}
31 changes: 31 additions & 0 deletions gg-data/src/main/java/gg/data/party/UserRoom.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package gg.data.party;

import javax.persistence.*;

import gg.data.user.User;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class UserRoom {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "room_id")
private Room room;

@Column(name = "nickname", length = 20)
private String nickname;

@Column(name = "is_exist")
private Boolean isExist;
}
13 changes: 13 additions & 0 deletions gg-data/src/main/java/gg/data/party/type/RoomType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gg.data.party.type;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum RoomType {
OPEN, // Ordinal 0
START, // Ordinal 1
FINISH, // Ordinal 2
HIDDEN // Ordinal 3
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package gg.pingpong.api;
package gg;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication(scanBasePackages = {"gg.admin.repo", "gg.data", "gg.repo",
"gg.pingpong.api", "gg.utils"})
"gg.pingpong.api", "gg.utils", "gg.party.api"})
public class PingpongApiApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package gg.pingpong.api.party.admin.category.controller;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class CategoryAdminController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package gg.pingpong.api.party.admin.comment.controller;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class CommentAdminController {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package gg.pingpong.api.party.admin.report.controller;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class ReportAdminController {
}
Loading
Loading