-
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.
* feat : 카테고리 필드 추가 * feat : 카테고리 - 유저 매핑 테이블 및 도메인 * feat : 포킷 초대 수락 API * feat : 포킷 초대 수락 로직 구현 * feat : 초대 수락 관련 에러코드
- Loading branch information
1 parent
d2e13d8
commit 22772a0
Showing
11 changed files
with
132 additions
and
5 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
24 changes: 24 additions & 0 deletions
24
...sistence/src/main/kotlin/com/pokit/out/persistence/category/impl/SharedCategoryAdapter.kt
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,24 @@ | ||
package com.pokit.out.persistence.category.impl | ||
|
||
import com.pokit.category.model.SharedCategory | ||
import com.pokit.category.port.out.SharedCategoryPort | ||
import com.pokit.out.persistence.category.persist.SharedCategoryEntity | ||
import com.pokit.out.persistence.category.persist.SharedCategoryRepository | ||
import com.pokit.out.persistence.category.persist.toDomain | ||
import org.springframework.stereotype.Repository | ||
|
||
@Repository | ||
class SharedCategoryAdapter( | ||
private val sharedCategoryRepository: SharedCategoryRepository | ||
) : SharedCategoryPort { | ||
override fun persist(sharedCategory: SharedCategory): SharedCategory { | ||
return sharedCategoryRepository.save(SharedCategoryEntity.of(sharedCategory)) | ||
.toDomain() | ||
} | ||
|
||
override fun loadByUserIdAndCategoryId(userId: Long, categoryId: Long): SharedCategory? { | ||
return sharedCategoryRepository.findByUserIdAndCategoryId(userId, categoryId) | ||
?.toDomain() | ||
} | ||
|
||
} |
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
31 changes: 31 additions & 0 deletions
31
...stence/src/main/kotlin/com/pokit/out/persistence/category/persist/SharedCategoryEntity.kt
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,31 @@ | ||
package com.pokit.out.persistence.category.persist | ||
|
||
import com.pokit.category.model.SharedCategory | ||
import com.pokit.out.persistence.BaseEntity | ||
import jakarta.persistence.* | ||
|
||
@Table(name = "SHARED_CATEGORY") | ||
@Entity | ||
class SharedCategoryEntity( | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
val id: Long = 0L, | ||
|
||
@Column(name = "user_id") | ||
val userId: Long, | ||
|
||
@Column(name = "category_id") | ||
val categoryId: Long, | ||
) : BaseEntity() { | ||
companion object { | ||
fun of(sharedCategory: SharedCategory) = SharedCategoryEntity( | ||
userId = sharedCategory.userId, | ||
categoryId = sharedCategory.categoryId | ||
) | ||
} | ||
} | ||
|
||
internal fun SharedCategoryEntity.toDomain() = SharedCategory( | ||
userId = this.userId, | ||
categoryId = this.categoryId | ||
) |
7 changes: 7 additions & 0 deletions
7
...ce/src/main/kotlin/com/pokit/out/persistence/category/persist/SharedCategoryRepository.kt
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,7 @@ | ||
package com.pokit.out.persistence.category.persist | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository | ||
|
||
interface SharedCategoryRepository : JpaRepository<SharedCategoryEntity, Long> { | ||
fun findByUserIdAndCategoryId(userId: Long, categoryId: Long): SharedCategoryEntity? | ||
} |
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
9 changes: 9 additions & 0 deletions
9
application/src/main/kotlin/com/pokit/category/port/out/SharedCategoryPort.kt
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,9 @@ | ||
package com.pokit.category.port.out | ||
|
||
import com.pokit.category.model.SharedCategory | ||
|
||
interface SharedCategoryPort { | ||
fun persist(sharedCategory: SharedCategory): SharedCategory | ||
|
||
fun loadByUserIdAndCategoryId(userId: Long, categoryId: Long): SharedCategory? | ||
} |
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
7 changes: 7 additions & 0 deletions
7
domain/src/main/kotlin/com/pokit/category/model/SharedCategory.kt
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,7 @@ | ||
package com.pokit.category.model | ||
|
||
data class SharedCategory( | ||
val id: Long = 0, | ||
val userId: Long, | ||
val categoryId: Long | ||
) |