-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature: μ’μμν μν μ‘°ν * feature: μ₯λ°κ΅¬λ λλ©μΈ λ° μ₯λ°κ΅¬λ λ±λ‘/μμ * docs: λ©μλλͺ μμ
- Loading branch information
1 parent
6d33680
commit 99efdd5
Showing
7 changed files
with
133 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/com/example/repick/domain/product/entity/ProductCart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.example.repick.domain.product.entity; | ||
|
||
import com.example.repick.global.entity.BaseEntity; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class ProductCart extends BaseEntity { | ||
|
||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
private Long userId; | ||
private Long productId; | ||
|
||
@Builder | ||
public ProductCart(Long userId, Long productId) { | ||
this.userId = userId; | ||
this.productId = productId; | ||
} | ||
|
||
public static ProductCart of(Long userId, Long productId) { | ||
return ProductCart.builder() | ||
.userId(userId) | ||
.productId(productId) | ||
.build(); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/com/example/repick/domain/product/repository/ProductCartRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.example.repick.domain.product.repository; | ||
|
||
import com.example.repick.domain.product.entity.ProductCart; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface ProductCartRepository extends JpaRepository<ProductCart, Long> { | ||
Optional<ProductCart> findByUserIdAndProductId(Long userId, Long productId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters