Skip to content

Commit

Permalink
Merge pull request #32 from SOPT-SOPHY/fix/fix-naming
Browse files Browse the repository at this point in the history
add: table 및 column 이름 관련 코드 변경
  • Loading branch information
onpyeong authored Jul 10, 2023
2 parents d815a52 + 775f70a commit b8577f8
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import lombok.RequiredArgsConstructor;
import org.sophy.sophy.common.dto.ApiResponseDto;
import org.sophy.sophy.controller.dto.request.MemberAdditionalInfoDto;
import org.sophy.sophy.domain.MyPageDto;
import org.sophy.sophy.domain.dto.MyPageDto;
import org.sophy.sophy.domain.dto.MyInfoDto;
import org.sophy.sophy.domain.MyPageDto;
import org.sophy.sophy.exception.SuccessStatus;
import org.sophy.sophy.service.MemberService;
import org.springframework.http.HttpStatus;
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/sophy/sophy/domain/Author.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import lombok.Getter;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.*;
import java.util.List;

@Entity
Expand All @@ -19,6 +16,7 @@
public class Author {
@Id
@GeneratedValue
@Column(name = "author_id")
private Long id;

@OneToMany
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/sophy/sophy/domain/Booktalk.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

@Entity
@Getter
@Table(name = "BOOKTALK")
@NoArgsConstructor
public class Booktalk extends AuditingTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "booktalk_id")
private long id;

@ManyToOne(fetch = FetchType.LAZY)
Expand Down Expand Up @@ -64,13 +64,13 @@ public class Booktalk extends AuditingTimeEntity {
// 연관 관계 편의 메서드
public void setPlace(Place place) {
if (this.place != null) {
this.place.getPendingBooktalkList().remove(this);
this.place.getBooktalkList().remove(this);
}

this.place = place;

if (!place.getPendingBooktalkList().contains(this)) {
place.getPendingBooktalkList().add(this);
if (!place.getBooktalkList().contains(this)) {
place.getBooktalkList().add(this);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/sophy/sophy/domain/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
public class Member extends AuditingTimeEntity{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "member_id")
private Long id;

@Column(nullable = false)
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/org/sophy/sophy/domain/MemberBooktalk.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import javax.persistence.*;

@Entity
@Table(name = "MEMBER_BOOKTALK")
@Getter
@NoArgsConstructor
public class MemberBooktalk extends AuditingTimeEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "member_booktalk_id")
private long id;

@ManyToOne(fetch = FetchType.LAZY)
Expand All @@ -27,19 +27,13 @@ public class MemberBooktalk extends AuditingTimeEntity {

// 연관 관계 편의 메서드
public void setMember(Member member) {
if(this.member != null) {
this.member.getUserBookTalkList().remove(this);
}
this.member = member;
if(!member.getUserBookTalkList().contains(this)) {
member.getUserBookTalkList().add(this);
}
}

public void setBooktalk(Booktalk booktalk) {
if (this.booktalk != null) {
this.booktalk.getParticipantList().remove(this);
}
this.booktalk = booktalk;
if (!booktalk.getParticipantList().contains(this)) {
booktalk.getParticipantList().add(this);
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/org/sophy/sophy/domain/Place.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

@Entity
@Getter
@Table(name = "PLACE")
@NoArgsConstructor
public class Place extends AuditingTimeEntity {
@Id
Expand All @@ -36,10 +35,7 @@ public class Place extends AuditingTimeEntity {
private String placeImage;

@OneToMany(mappedBy = "place")
private List<Booktalk> approvedBooktalkList = new ArrayList<>();

@OneToMany(mappedBy = "place")
private List<Booktalk> pendingBooktalkList = new ArrayList<>();
private List<Booktalk> booktalkList = new ArrayList<>();

@Builder
public Place(City city, String name, String address, Integer maximum, String placeImage) {
Expand All @@ -48,7 +44,6 @@ public Place(City city, String name, String address, Integer maximum, String pla
this.address = address;
this.maximum = maximum;
this.placeImage = placeImage;
this.approvedBooktalkList = new ArrayList<>();
this.pendingBooktalkList = new ArrayList<>();
this.booktalkList = new ArrayList<>();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.sophy.sophy.domain;
package org.sophy.sophy.domain.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/sophy/sophy/service/MemberService.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import lombok.RequiredArgsConstructor;
import org.sophy.sophy.controller.dto.request.MemberAdditionalInfoDto;
import org.sophy.sophy.domain.Member;
import org.sophy.sophy.domain.MyPageDto;
import org.sophy.sophy.domain.dto.MyPageDto;
import org.sophy.sophy.domain.dto.MyInfoDto;
import org.sophy.sophy.domain.Member;
import org.sophy.sophy.domain.MyPageDto;
import org.sophy.sophy.exception.ErrorStatus;
import org.sophy.sophy.exception.model.NotFoundException;
import org.sophy.sophy.infrastructure.MemberRepository;
Expand Down

0 comments on commit b8577f8

Please sign in to comment.