Skip to content

Commit

Permalink
feat : Entity init Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
zini9188 committed Oct 28, 2023
1 parent 54fd0fb commit 531cb65
Show file tree
Hide file tree
Showing 22 changed files with 400 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tgd.trip.attraction;
package com.tgd.trip.attraction.domain;

import com.tgd.trip.global.BaseEntity;
import lombok.Getter;
import lombok.Setter;

Expand All @@ -8,10 +9,10 @@
@Entity
@Getter
@Setter
public class Attraction {
public class Attraction extends BaseEntity {

@Id
private Long id;
private Long attractionId;
@Column(columnDefinition = "TEXT")
private String title;
private String overview;
Expand All @@ -21,4 +22,10 @@ public class Attraction {
private String imgUrl;
private Double latitude;
private Double longitude;
@ManyToOne
@JoinColumn(name = "sido_code")
private Sido sido;
@ManyToOne
@JoinColumn(name = "gugun_code")
private Gugun gugun;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.tgd.trip.attraction.domain;

import com.tgd.trip.global.BaseEntity;
import com.tgd.trip.user.domain.User;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class AttractionBookmark extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long AttractionBookMarkId;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@ManyToOne
@JoinColumn(name = "attraction_id")
private Attraction attraction;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tgd.trip.attraction;
package com.tgd.trip.attraction.domain;

import lombok.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.tgd.trip.attraction;
package com.tgd.trip.attraction.domain;

import lombok.*;

Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/tgd/trip/attraction/domain/Visited.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.tgd.trip.attraction.domain;

import com.tgd.trip.global.BaseEntity;
import com.tgd.trip.user.domain.User;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Visited extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long visitedId;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@ManyToOne
@JoinColumn(name = "attraction_id")
private Attraction attraction;
}
23 changes: 23 additions & 0 deletions src/main/java/com/tgd/trip/chatting/domain/Chat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.tgd.trip.chatting.domain;

import com.tgd.trip.user.domain.ChatParticipant;
import lombok.*;

import javax.persistence.*;
import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Chat {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long chatId;
private String content;
private LocalDateTime createdAt;
@ManyToOne
@JoinColumn(name = "chat_participant_id")
private ChatParticipant chatParticipant;
}
18 changes: 18 additions & 0 deletions src/main/java/com/tgd/trip/chatting/domain/ChatRoom.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.tgd.trip.chatting.domain;

import com.tgd.trip.global.BaseEntity;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class ChatRoom extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long chatRoomId;
private String title;
}
21 changes: 21 additions & 0 deletions src/main/java/com/tgd/trip/global/BaseEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.tgd.trip.global;

import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.time.LocalDateTime;

@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseEntity {

@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime modifiedAt;
}
24 changes: 24 additions & 0 deletions src/main/java/com/tgd/trip/notification/domain/Notification.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.tgd.trip.notification.domain;

import com.tgd.trip.global.BaseEntity;
import com.tgd.trip.user.domain.User;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Notification extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long notificationId;
@ManyToOne
@JoinColumn(name = "receiver_id")
private User receiver;
private String content;
private Integer type;
private String contentLink;
}
22 changes: 22 additions & 0 deletions src/main/java/com/tgd/trip/photo/domain/Photo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.tgd.trip.photo.domain;

import com.tgd.trip.global.BaseEntity;
import com.tgd.trip.schedule.domain.Day;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Photo extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long photoId;
@ManyToOne
@JoinColumn(name = "day_id")
private Day day;
private String imgUrl;
}
21 changes: 21 additions & 0 deletions src/main/java/com/tgd/trip/photo/domain/ProofShot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.tgd.trip.photo.domain;

import com.tgd.trip.attraction.domain.Visited;
import com.tgd.trip.global.BaseEntity;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class ProofShot extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long proofShotId;
@ManyToOne
@JoinColumn(name = "visited_id")
private Visited visited;
}
21 changes: 0 additions & 21 deletions src/main/java/com/tgd/trip/schedule/Schedule.java

This file was deleted.

25 changes: 25 additions & 0 deletions src/main/java/com/tgd/trip/schedule/domain/Comment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.tgd.trip.schedule.domain;

import com.tgd.trip.global.BaseEntity;
import com.tgd.trip.user.domain.User;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Comment extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long commentId;
private String content;
@ManyToOne
@JoinColumn(name = "schedule_id")
private Schedule schedule;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
}
20 changes: 20 additions & 0 deletions src/main/java/com/tgd/trip/schedule/domain/Day.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.tgd.trip.schedule.domain;

import com.tgd.trip.global.BaseEntity;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Day extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long dayId;
@ManyToOne
@JoinColumn(name = "schedule_id")
private Schedule schedule;
}
20 changes: 20 additions & 0 deletions src/main/java/com/tgd/trip/schedule/domain/Hashtag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.tgd.trip.schedule.domain;

import com.tgd.trip.global.BaseEntity;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Hashtag extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long hashtagId;
@ManyToOne
@JoinColumn(name = "schedule_id")
private Schedule schedule;
}
24 changes: 24 additions & 0 deletions src/main/java/com/tgd/trip/schedule/domain/Memo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.tgd.trip.schedule.domain;

import com.tgd.trip.attraction.domain.Attraction;
import com.tgd.trip.global.BaseEntity;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Memo extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long memoId;
@ManyToOne
@JoinColumn(name = "attraction_id")
private Attraction attraction;
@ManyToOne
@JoinColumn(name = "day_id")
private Day day;
}
22 changes: 22 additions & 0 deletions src/main/java/com/tgd/trip/schedule/domain/Schedule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.tgd.trip.schedule.domain;

import com.tgd.trip.global.BaseEntity;
import lombok.*;

import javax.persistence.*;

@Getter
@Setter
@Entity
@NoArgsConstructor
public class Schedule extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long scheduleId;
private String title;
private String content;
private Long likes;
private String imgUrl;
private Boolean viewYn;
}
24 changes: 24 additions & 0 deletions src/main/java/com/tgd/trip/schedule/domain/ScheduleBookmark.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.tgd.trip.schedule.domain;

import com.tgd.trip.global.BaseEntity;
import com.tgd.trip.user.domain.User;
import lombok.*;

import javax.persistence.*;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class ScheduleBookmark extends BaseEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long scheduleBookmarkId;
@ManyToOne
@JoinColumn(name = "user_id")
private User user;
@ManyToOne
@JoinColumn(name = "schedule_id")
private Schedule schedule;
}
Loading

0 comments on commit 531cb65

Please sign in to comment.