diff --git a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/Crew.java b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/Crew.java index f0c7522..5dd07fb 100644 --- a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/Crew.java +++ b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/Crew.java @@ -29,4 +29,12 @@ public class Crew extends BaseEntity { @OneToMany(mappedBy = "crew") private List crewPosts = new ArrayList<>(); + + @OneToOne(mappedBy = "crew") + private CrewProfileImage images = new CrewProfileImage(); + + public void setImages(CrewProfileImage profileImage) { + this.images = profileImage; + profileImage.setCrew(this); + } } diff --git a/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/CrewProfileImage.java b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/CrewProfileImage.java new file mode 100644 index 0000000..e1cc4f2 --- /dev/null +++ b/src/backend/src/main/java/RunningMachines/R2R/domain/crew/common/entity/CrewProfileImage.java @@ -0,0 +1,26 @@ +package RunningMachines.R2R.domain.crew.common.entity; + +import jakarta.persistence.*; +import lombok.*; + +@Entity +@Getter +@Builder +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class CrewProfileImage { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(nullable = false) + private Long id; + + @OneToOne + @JoinColumn(name = "crew_id", nullable = false) + private Crew crew; + + private String imageUrl; + + public void setCrew(Crew crew) { + this.crew = crew; + } +}