Skip to content

Commit

Permalink
[Feat] : Member 엔티티 & 레포지토리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 committed Aug 14, 2024
1 parent b8152a5 commit fb505b7
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/main/java/side/onetime/domain/Member.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package side.onetime.domain;

import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import side.onetime.global.common.dao.BaseEntity;

import java.util.List;

@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter
@Table(name = "members")
public class Member extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "members_id")
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "events_id", foreignKey = @ForeignKey(name = "members_fk_events_id"))
private Event event;

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

@Column(name = "pin", nullable = false)
private String pin;

@OneToMany(mappedBy = "member",cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<Schedule> schedules;

@Builder
public Member(Event event, String name, String pin) {
this.event = event;
this.name = name;
this.pin = pin;
}
}
7 changes: 7 additions & 0 deletions src/main/java/side/onetime/repository/MemberRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package side.onetime.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import side.onetime.domain.Member;

public interface MemberRepository extends JpaRepository<Member,Long> {
}

0 comments on commit fb505b7

Please sign in to comment.