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

Develop #230

Merged
merged 8 commits into from
Jun 29, 2023
9 changes: 5 additions & 4 deletions src/main/java/chilling/encore/domain/Center.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import lombok.*;

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

@Entity
@AllArgsConstructor
Expand All @@ -16,9 +13,13 @@ public class Center {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long regionIdx;
@Column(nullable = false)
private String url;
@Column(nullable = false)
private String region;
@Column(nullable = false)
private int favCount;
@Column(nullable = false)
private String tell;

public void plusFavCount() {
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/chilling/encore/domain/FreeBoard.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ public class FreeBoard {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long freeBoardIdx;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@Column(nullable = false)
private String title;
@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;
@Column(nullable = false)
private String region;
@Column(nullable = false)
private int hit;
@CreationTimestamp
@Column(nullable = false)
private LocalDateTime createdAt;
@UpdateTimestamp
private LocalDateTime updatedAt;
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/chilling/encore/domain/FreeBoardComments.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ public class FreeBoardComments {
private Long freeBoardCommentIdx;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "freeBoardIdx")
@JoinColumn(name = "freeBoardIdx", nullable = false)
private FreeBoard freeBoard;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;
@Column(nullable = false)
private boolean isDelete;

@CreationTimestamp
@Column(nullable = false)
private LocalDateTime createdAt;

@JsonBackReference
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/chilling/encore/domain/LearningCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import lombok.*;

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

@Entity
@AllArgsConstructor
Expand All @@ -16,8 +13,12 @@ public class LearningCenter {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long learningCenterIdx;
@Column(nullable = false)
private String region;
@Column(nullable = false)
private String learningName;
@Column(nullable = false)
private double x;
@Column(nullable = false)
private double y;
}
20 changes: 14 additions & 6 deletions src/main/java/chilling/encore/domain/Lecture.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package chilling.encore.domain;

import lombok.*;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import java.time.LocalDate;
Expand All @@ -16,24 +17,31 @@ public class Lecture {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long lectureIdx;
@ManyToOne
@JoinColumn(name = "teacherInfoIdx")
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "teacherInfoIdx", nullable = false)
private TeacherInfo teacherInfo;
@Column(nullable = false)
private String title;
@Column(nullable = false)
private String category;
@Column(nullable = false)
private int price;
@Column(nullable = false)
private int goalNum;
@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String lectureObjective;
@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String lectureContent;
@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String lectureMethod;
@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String lectureRequired;
@Column(columnDefinition = "TEXT")
private String image;
@Column(nullable = false)
private String region;
@Column(nullable = false)
@CreationTimestamp
private LocalDate createdAt;
@OneToMany(mappedBy = "lecture")
private List<LectureMessage> lectureMessages = new ArrayList<>();
Expand Down
14 changes: 9 additions & 5 deletions src/main/java/chilling/encore/domain/LectureMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,22 @@ public class LectureMessage {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long lectureMessageIdx;
@ManyToOne
@JoinColumn(name = "lectureIdx")
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "lectureIdx", nullable = false)
private Lecture lecture;
@ManyToOne
@JoinColumn(name = "userIdx")
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@Column(columnDefinition = "text")
@Column(columnDefinition = "text", nullable = false)
private String content;
@Column(nullable = false)
private String email;
@Column(nullable = false)
private String tel;
@ColumnDefault("false")
@Column(nullable = false)
private boolean isRead;
@CreationTimestamp
@Column(nullable = false)
private LocalDate createdAt;
}
8 changes: 5 additions & 3 deletions src/main/java/chilling/encore/domain/ListenComments.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ public class ListenComments {
private Long listenCommentIdx;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "listenIdx")
@JoinColumn(name = "listenIdx", nullable = false)
private ListenTogether listenTogether;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;
@Column(nullable = false)
private boolean isDelete;

@CreationTimestamp
@Column(nullable = false)
private LocalDateTime createdAt;

@JsonBackReference
Expand Down
15 changes: 7 additions & 8 deletions src/main/java/chilling/encore/domain/ListenTogether.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,27 @@ public class ListenTogether {
private Long listenIdx;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "programIdx")
private Program program;

@Column(nullable = false)
private String title;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;

@Column(nullable = false)
private int hit;

@Column(nullable = false)
private int goalNum;

@CreationTimestamp
@Column(nullable = false)
private LocalDateTime createdAt;
@UpdateTimestamp
private LocalDateTime updatedAt;

@OneToMany(mappedBy = "listenTogether")
List<ListenComments> listenComments = new ArrayList<>();
List<ListenComments> listexnComments = new ArrayList<>();
@OneToMany(mappedBy = "listenTogether")
List<Participants> participants = new ArrayList<>();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/chilling/encore/domain/Participants.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public class Participants {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long participantsIdx;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "listenIdx")
@JoinColumn(name = "listenIdx", nullable = false)
private ListenTogether listenTogether;
}
9 changes: 6 additions & 3 deletions src/main/java/chilling/encore/domain/Program.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ public class Program {
private Long programIdx;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "learningCenterIdx")
@JoinColumn(name = "learningCenterIdx", nullable = false)
private LearningCenter learningCenter;

@Column(nullable = false)
private String programName;
@Column(nullable = false)
private String category;
@Column(nullable = false)
private String url;

@Column(nullable = false)
private LocalDate startDate;
@Column(nullable = false)
private LocalDate endDate;
}
11 changes: 6 additions & 5 deletions src/main/java/chilling/encore/domain/Review.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,28 @@ public class Review {
private Long reviewIdx;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "programIdx")
@JoinColumn(name = "programIdx", nullable = false)
private Program program;

private int week;

@Column(nullable = false)
private String title;
@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;

@Column(columnDefinition = "TEXT")
private String image;
@Column(nullable = false)
private int hit;
@CreationTimestamp
@Column(nullable = false)
private LocalDateTime createdAt;
@UpdateTimestamp
private LocalDateTime updatedAt;

@OneToMany(mappedBy = "review")
private List<ReviewComments> reviewComments = new ArrayList<>();
}
8 changes: 5 additions & 3 deletions src/main/java/chilling/encore/domain/ReviewComments.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ public class ReviewComments {
private Long reviewCommentIdx;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "reviewIdx")
@JoinColumn(name = "reviewIdx", nullable = false)
private Review review;

@Column(columnDefinition = "TEXT")
@Column(columnDefinition = "TEXT", nullable = false)
private String content;
@Column(nullable = false)
private boolean isDelete;
@CreationTimestamp
@Column(nullable = false)
private LocalDateTime createdAt;

@JsonBackReference
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/chilling/encore/domain/TeacherInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class TeacherInfo {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long teacherInfoIdx;
@OneToOne
@JoinColumn(name = "userIdx")
@JoinColumn(name = "userIdx", nullable = false)
private User user;
private String introduce; //ν•œμ€„ μ†Œκ°œ
@Column(columnDefinition = "TEXT")
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/chilling/encore/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,39 @@ public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long userIdx;

@Column(nullable = false)
private String userId;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String gender;
@Column(nullable = false)
private int age;
@Column(nullable = false)
private String email;
@Column(nullable = false)
private String password;
@Column(nullable = false)
private String nickName;
@Column(nullable = false)
private String phoneNumber;
@Column(nullable = false)
private String profile;
@Column(nullable = false)
private int status;
// νšŒμ› 정상 / 휴면 / νƒˆν‡΄ μƒνƒœ
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private UserConstants.Role role;
private String provider;
//google, facebookλ“±λ“±
@CreationTimestamp
private LocalDate createdAt;
private LocalDate loginAt;
@Column(nullable = false)
private String region;
private String favRegion;
@Column(nullable = false)
private int grade;
private String favField;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ protected void configure(HttpSecurity http) throws Exception {
.and()
.exceptionHandling()
.authenticationEntryPoint(customAuthenticationEntryPoint)
.and()
.exceptionHandling()
.accessDeniedHandler(customAccessDeniedHandler)
.and()
.addFilterBefore(new JwtFilter(jwtTokenProvider), UsernamePasswordAuthenticationFilter.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ protected SecurityException(String message, String errorCode, HttpStatus httpSta
super(message, errorCode, httpStatus);
}

public static class RemovedAccessTokenException extends SecurityException {
public RemovedAccessTokenException(String message, String errorCode, HttpStatus httpStatus) {
super(message, errorCode, httpStatus);
}
}

public static class InvalidJwtFormatException extends SecurityException {
public InvalidJwtFormatException(String message, String errorCode, HttpStatus httpStatus) {
super(message, errorCode, httpStatus);
Expand Down
Loading