diff --git a/core/src/main/java/hexagonal/core/domain/Room.java b/core/src/main/java/hexagonal/core/domain/Room.java new file mode 100644 index 0000000..4cb61f5 --- /dev/null +++ b/core/src/main/java/hexagonal/core/domain/Room.java @@ -0,0 +1,23 @@ +package hexagonal.core.domain; + +import lombok.*; + +import javax.persistence.*; + +@Getter +@Builder +@AllArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Entity +public class Room { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(nullable = false) + private Long companyId; + + @Column(nullable = false) + private Long adminId; +} diff --git a/core/src/main/java/hexagonal/core/domain/jpa/RoomJpaEntity.java b/core/src/main/java/hexagonal/core/domain/jpa/RoomJpaEntity.java new file mode 100644 index 0000000..0aee477 --- /dev/null +++ b/core/src/main/java/hexagonal/core/domain/jpa/RoomJpaEntity.java @@ -0,0 +1,28 @@ +package hexagonal.core.domain.jpa; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.persistence.*; + +@Entity +@Table(name = "room") +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class RoomJpaEntity { + + @Id + @GeneratedValue + private Long id; + + @Column + private Long companyId; + + @Column + private Long adminId; + +} diff --git a/core/src/main/java/hexagonal/core/repository/RoomRepository.java b/core/src/main/java/hexagonal/core/repository/RoomRepository.java new file mode 100644 index 0000000..c18a18f --- /dev/null +++ b/core/src/main/java/hexagonal/core/repository/RoomRepository.java @@ -0,0 +1,12 @@ +package hexagonal.core.repository; + +import hexagonal.core.domain.jpa.RoomJpaEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface RoomRepository extends JpaRepository { + Optional findByCompanyId(Long companyId); +}