Skip to content

Commit

Permalink
feature/#3/participate
Browse files Browse the repository at this point in the history
  • Loading branch information
kyungminlee-12 committed Nov 5, 2022
1 parent 296a685 commit f1147f4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/main/java/com/example/DayClassBack/entity/Participate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.example.DayClassBack.entity;

import lombok.*;

import javax.persistence.*;
import java.util.List;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Getter
@Entity
public class Participate extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="participate_id")
private Long id;

@OneToOne(targetEntity =Users.class) // Many = Participate, Users = Party
@JoinColumn(name="user_id") // foreign key (userId) references User (id)
private Users users;

@ManyToOne (targetEntity =Party.class) // (mappedBy ="Party", cascade=CascadeType.ALL, orphanRemoval=true) // Many = Participate, Users = Party
@JoinColumn(name="party_id") // foreign key (partyId) references Party (id)
private List<Party> party;

@Column(nullable=false)
private boolean is_selected;

}
1 change: 1 addition & 0 deletions src/main/java/com/example/DayClassBack/entity/Party.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Party extends BaseTime {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="party_id")
private Long id;

@ManyToOne // Many = Party, Users = One 한명의 유저는 여러개의 게시글을 쓸 수 있다.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/example/DayClassBack/entity/Users.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class Users extends BaseTime implements UserDetails {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idx;
@Column(name="user_id")
private Long id;

@Column(nullable = false)
private String email;
Expand Down

0 comments on commit f1147f4

Please sign in to comment.