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

remove secret file/ add entity, repository #39

Merged
merged 3 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .gradle/8.8/checksums/checksums.lock
Binary file not shown.
Binary file added .gradle/8.8/checksums/md5-checksums.bin
Binary file not shown.
Binary file added .gradle/8.8/checksums/sha1-checksums.bin
Binary file not shown.
Empty file.
Binary file added .gradle/8.8/executionHistory/executionHistory.lock
Binary file not shown.
Binary file added .gradle/8.8/fileChanges/last-build.bin
Binary file not shown.
Binary file added .gradle/8.8/fileHashes/fileHashes.lock
Binary file not shown.
Empty file added .gradle/8.8/gc.properties
Empty file.
Binary file added .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions .gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Wed Jul 24 15:19:36 KST 2024
gradle.version=8.8
Empty file added .gradle/vcs-1/gc.properties
Empty file.
42 changes: 42 additions & 0 deletions src/main/java/likelion/MZConnent/domain/chat/Chat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package likelion.MZConnent.domain.chat;

import jakarta.persistence.*;
import likelion.MZConnent.domain.club.Club;
import likelion.MZConnent.domain.member.Member;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Entity
@Getter
@NoArgsConstructor
@Table(name = "chats")
public class Chat {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long chatId;

@Column(nullable = false)
private LocalDateTime createdDate;

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

@ManyToOne
@JoinColumn(name = "clubId", nullable = false)
private Club club;

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

@Builder
public Chat(LocalDateTime createdDate, String content, Club club, Member member) {
this.createdDate = createdDate;
this.content = content;
this.club = club;
this.member = member;
}
}
32 changes: 32 additions & 0 deletions src/main/java/likelion/MZConnent/domain/club/AgeRestriction.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package likelion.MZConnent.domain.club;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@RequiredArgsConstructor
@Slf4j
public enum AgeRestriction {
FOURTH_GRADE("4학년"),
FIFTH_GRADE("5학년"),
SIXTH_GRADE("6학년"),
ALL("없음");

private final String ageRestriction;

@JsonValue
public String getAgeRestriction() {
return ageRestriction;
}

@JsonCreator
public static AgeRestriction fromAgeRestriction(String ageRestriction) {
for (AgeRestriction aR : AgeRestriction.values()) {
if (aR.getAgeRestriction().equals(ageRestriction)) {
return aR;
}
}
throw new IllegalArgumentException(ageRestriction + "은 존재하지 않는 enum type입니다.(AgeRestriction)");
}
}
86 changes: 86 additions & 0 deletions src/main/java/likelion/MZConnent/domain/club/Club.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package likelion.MZConnent.domain.club;

import jakarta.persistence.*;
import likelion.MZConnent.domain.chat.Chat;
import likelion.MZConnent.domain.culture.Culture;
import likelion.MZConnent.domain.member.Member;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

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

@Entity
@Table(name="clubs")
@Getter
@NoArgsConstructor
public class Club {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long clubId;

@Column(length = 255, nullable = false)
private String title;

@Column(nullable = false)
private LocalDate meetingDate;

@Column(nullable = false)
private LocalDateTime createdDate;

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

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private GenderRestriction genderRestriction;

@Enumerated(EnumType.STRING)
private AgeRestriction ageRestriction;

@Column(nullable = false)
private int currentParticipant;

@Column(nullable = false)
private int maxParticipant;

@Column(nullable = false)
private String status;

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

@ManyToOne
@JoinColumn(name = "cultureId", nullable = false)
private Culture culture;

@ManyToOne
@JoinColumn(name = "regionId", nullable = false)
private RegionCategory region;

@OneToMany(mappedBy = "club")
private List<Chat> chats;

@OneToMany(mappedBy = "club")
private List<ClubMember> clubMembers;


@Builder
public Club(String title, LocalDate meetingDate, LocalDateTime createdDate, String content, GenderRestriction genderRestriction, AgeRestriction ageRestriction, int currentParticipant, int maxParticipant, String status, Member member, Culture culture, RegionCategory region) {
this.title = title;
this.meetingDate = meetingDate;
this.createdDate = createdDate;
this.content = content;
this.genderRestriction = genderRestriction;
this.ageRestriction = ageRestriction;
this.currentParticipant = currentParticipant;
this.maxParticipant = maxParticipant;
this.status = status;
this.member = member;
this.culture = culture;
this.region = region;
}
}
42 changes: 42 additions & 0 deletions src/main/java/likelion/MZConnent/domain/club/ClubMember.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package likelion.MZConnent.domain.club;

import jakarta.persistence.*;
import likelion.MZConnent.domain.manner.Manner;
import likelion.MZConnent.domain.member.Member;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Entity
@Getter
@NoArgsConstructor
@Table(name = "club_member")
public class ClubMember {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long clubMemberId;

@Column(name = "role", nullable = false)
@Enumerated(EnumType.STRING)
private ClubRole clubRole;

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

@ManyToOne
@JoinColumn(name = "clubId", nullable = false)
private Club club;

@OneToMany(mappedBy = "clubMember")
private List<Manner> manners;

@Builder
public ClubMember(ClubRole clubRole, Member member, Club club) {
this.clubRole = clubRole;
this.member = member;
this.club = club;
}
}
27 changes: 27 additions & 0 deletions src/main/java/likelion/MZConnent/domain/club/ClubRole.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package likelion.MZConnent.domain.club;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RequiredArgsConstructor
public enum ClubRole {
LEADER("모임장"),
MEMBER("모임원");

private final String clubRole;

public String getClubRole() {
return clubRole;
}

public static ClubRole fromRole(String role) {
for (ClubRole cR : ClubRole.values()) {
if (cR.getClubRole().equals(role)) {
return cR;
}
}
log.info("존재하지 않는 enum type(ClubRole): {}", role);
throw new IllegalArgumentException(role + "은 존재하지 않는 enum type입니다.(ClubRole)");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package likelion.MZConnent.domain.club;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@RequiredArgsConstructor
@Slf4j
public enum GenderRestriction {
MALE("남자"),
FEMALE("여자"),
ALL("없음");

private final String genderRestriction;

@JsonValue
public String getGenderRestriction() {
return genderRestriction;
}

@JsonCreator
public static GenderRestriction fromGenderRestriction(String genderRestriction) {
for (GenderRestriction gR : GenderRestriction.values()) {
if (gR.getGenderRestriction().equals(genderRestriction)) {
return gR;
}
}
throw new IllegalArgumentException(genderRestriction + "은 존재하지 않는 enum type입니다.(GenderRestriction)");
}
}
25 changes: 25 additions & 0 deletions src/main/java/likelion/MZConnent/domain/club/RegionCategory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package likelion.MZConnent.domain.club;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Entity
@NoArgsConstructor
@Getter
@Table(name = "region_categories")
public class RegionCategory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long regionId;

@Column(nullable = false)
private String name;

@OneToMany(mappedBy = "region")
private List<Club> clubs;

}

66 changes: 66 additions & 0 deletions src/main/java/likelion/MZConnent/domain/culture/Culture.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package likelion.MZConnent.domain.culture;

import jakarta.persistence.*;
import likelion.MZConnent.domain.club.Club;
import likelion.MZConnent.domain.review.Review;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;

@Entity
@Getter
@NoArgsConstructor
@Table(name = "cultures")
public class Culture {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long cultureId;

@Column(nullable = false)
private int interestCount;

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

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

@Column(nullable = false)
private String name;

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

@Column(nullable = false)
private int cultureCount;

@Column(length = 100, nullable = false)
private String recommendedMember;

@ManyToOne
@JoinColumn(name = "cultureCategoryId", nullable = false)
private CultureCategory cultureCategory;

@OneToMany(mappedBy = "culture")
private List<Club> clubs;

@OneToMany(mappedBy = "culture")
private List<CultureInterest> cultureInterests;

@OneToMany(mappedBy = "culture")
private List<Review> reviews;

@Builder
public Culture(int interestCount, String content, String cultureImageUrl, String name, String summary, int cultureCount, String recommendedMember, CultureCategory cultureCategory) {
this.interestCount = interestCount;
this.content = content;
this.cultureImageUrl = cultureImageUrl;
this.name = name;
this.summary = summary;
this.cultureCount = cultureCount;
this.recommendedMember = recommendedMember;
this.cultureCategory = cultureCategory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@
@Entity
@Getter
@NoArgsConstructor
@Table(name = "culture_categories")
public class CultureCategory {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "culture_category_id")
private Long id;

@Column(length = 255, nullable = false)
private String name;

@OneToMany(mappedBy = "cultureCategory", cascade = CascadeType.ALL)
private List<SelfIntroduction> selfIntroductions = new ArrayList<>();

}
Loading
Loading