Skip to content

Commit 5c82354

Browse files
committed
[FEAT] WearRoom 엔티티 추가
1 parent 7834196 commit 5c82354

1 file changed

Lines changed: 38 additions & 1 deletion

File tree

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,41 @@
11
package fitfit.domain.clothes.mapping;
22

3-
public class WearRoom {
3+
import fitfit.domain.clothes.entity.Clothes;
4+
import fitfit.domain.member.entity.Member;
5+
import fitfit.global.entity.BaseEntity;
6+
import jakarta.persistence.*;
7+
import lombok.*;
8+
import org.springframework.data.annotation.CreatedDate;
9+
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10+
11+
import java.time.LocalDate;
12+
13+
@Getter
14+
@NoArgsConstructor(access = AccessLevel.PROTECTED)
15+
@AllArgsConstructor
16+
@Builder
17+
@Entity
18+
@Table(name = "WEAR_ROOM",
19+
// (회원ID, 옷ID) 쌍 중복되지 않도록 제약 조건
20+
uniqueConstraints = {
21+
@UniqueConstraint(
22+
name = "WEAR_ROOM_MEMBER_CLOTHES_UK",
23+
columnNames = {"member_id", "clothes_id"}
24+
)
25+
}
26+
)
27+
public class WearRoom extends BaseEntity{
28+
29+
@Id
30+
@GeneratedValue(strategy = GenerationType.IDENTITY)
31+
@Column(name = "wear_room_id")
32+
private Long id;
33+
34+
@ManyToOne(fetch = FetchType.LAZY)
35+
@JoinColumn(name = "member_id", nullable = false)
36+
private Member member;
37+
38+
@ManyToOne(fetch = FetchType.LAZY)
39+
@JoinColumn(name = "clothes_id", nullable = false)
40+
private Clothes clothes;
441
}

0 commit comments

Comments
 (0)