Skip to content

Commit

Permalink
Merge pull request #17 from Tave-13th-Project-Team-4-Fiurinee/feature…
Browse files Browse the repository at this point in the history
…/entity

feat: 엔티티 생성
  • Loading branch information
ss7622 authored Jun 16, 2024
2 parents ad4146a + 3be8648 commit b38114f
Show file tree
Hide file tree
Showing 9 changed files with 202 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.example.fiurinee.domain.anniversary.entity;

import com.example.fiurinee.domain.member.entity.Member;
import jakarta.persistence.*;
import lombok.*;

import java.sql.Timestamp;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class Anniversary {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

private Timestamp anniersaryDate;

private String type;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "memberId")
private Member member;



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.example.fiurinee.domain.flower.entity;

import com.example.fiurinee.domain.recommendFlower.entity.RecommendFlower;
import jakarta.persistence.*;
import lombok.*;

import java.net.URL;
import java.util.List;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class Flower {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long flowerId;

private String name;
private int period;
private String flowerLanguage;
private URL image;
private String explain;

@OneToMany(mappedBy = "flower", cascade = CascadeType.ALL)
private List<RecommendFlower> recommendFlowers;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.example.fiurinee.domain.inputMessage.entity;

import com.example.fiurinee.domain.member.entity.Member;
import jakarta.persistence.*;
import lombok.*;

import java.sql.Timestamp;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class InputMessage {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long inputMessageId;

@ManyToOne
@JoinColumn(name = "memberId")
private Member member;

private String content;
private Timestamp createAt;
private Boolean prefer;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.example.fiurinee.domain.matchingFlower.entity;

import com.example.fiurinee.domain.flower.entity.Flower;
import com.example.fiurinee.domain.recommendFlower.entity.RecommendFlower;
import jakarta.persistence.*;
import lombok.*;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class MatchingFlower {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long matchingFlowerId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "recommendFlowerId")
private RecommendFlower recommendFlower;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "flowerId")
private Flower flower;

private Long flowerOrderId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ public class Member {

private String kakaoAccessToken;

private int profileImage;

private boolean alarm;

@Builder
private Member(String email, String name, String socialId, Role role, String kakaoAccessToken) {
private Member(String email, String name, String socialId, Role role, String kakaoAccessToken, int profileImage, boolean alarm) {
this.email = email;
this.name = name;
this.socialId = socialId;
this.role = role;
this.kakaoAccessToken = kakaoAccessToken;
this.profileImage = profileImage;
this.alarm = alarm;
}

public static Member createMember(String email, String name, String socialId, Role role, String kakaoAccessToken) {
return new Member(email, name, socialId, role, kakaoAccessToken);
public static Member createMember(String email, String name, String socialId, Role role, String kakaoAccessToken, int profileImage, boolean alarm) {
return new Member(email, name, socialId, role, kakaoAccessToken,profileImage, alarm);
}

public void updateKakaoToken(String kakaoAccessToken){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic
}

public Member saveSocialMember(String socialId, String name, String email, String kakaoAccessToken) {
Member newMember = Member.createMember(email, name, socialId, Role.USER,kakaoAccessToken);
int defaultProfileImage = 0;
boolean defaultAlarm = false;
Member newMember = Member.createMember(email, name, socialId, Role.USER,kakaoAccessToken, defaultProfileImage, defaultAlarm);
return memberRepository.save(newMember);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.fiurinee.domain.preferList.entity;

import com.example.fiurinee.domain.member.entity.Member;
import jakarta.persistence.*;
import lombok.*;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class PreferList {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long preferListId;

private Long preferNumber;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "memberId")
private Member member;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.fiurinee.domain.recommendComment.entity;

import com.example.fiurinee.domain.member.entity.Member;
import jakarta.persistence.*;
import lombok.*;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class RecommendComment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long recommendCommentId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "memberId")
private Member member;

private String content;
private Boolean prefer;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.example.fiurinee.domain.recommendFlower.entity;

import com.example.fiurinee.domain.flower.entity.Flower;
import com.example.fiurinee.domain.matchingFlower.entity.MatchingFlower;
import com.example.fiurinee.domain.member.entity.Member;
import jakarta.persistence.*;
import lombok.*;

import java.util.List;

@Entity
@Getter
@Builder
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class RecommendFlower {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long recommendFlowerId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "memberId")
private Member member;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "flower_id")
private Flower flower;

private Boolean prefer;

@OneToMany(mappedBy = "recommendFlower", cascade = CascadeType.ALL)
private List<MatchingFlower> matchingFlowers;
}

0 comments on commit b38114f

Please sign in to comment.