-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from Namo-Mongmong/feature/48
[Feature/48] 카테고리 validation 검증 로직 및 비기능 개발
- Loading branch information
Showing
15 changed files
with
140 additions
and
84 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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/example/namo2/domain/category/dao/repository/CategoryRepositoryCustom.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,14 @@ | ||
package com.example.namo2.domain.category.dao.repository; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.repository.query.Param; | ||
|
||
import com.example.namo2.domain.category.domain.Category; | ||
import com.example.namo2.domain.category.domain.CategoryKind; | ||
|
||
import com.example.namo2.domain.user.domain.User; | ||
|
||
public interface CategoryRepositoryCustom { | ||
List<Category> findMoimCategoriesByUsers(@Param("users") List<User> users, @Param("kind") CategoryKind kind); | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/example/namo2/domain/category/dao/repository/CategoryRepositoryImpl.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,32 @@ | ||
package com.example.namo2.domain.category.dao.repository; | ||
|
||
import static com.example.namo2.domain.category.domain.QCategory.*; | ||
|
||
import java.util.List; | ||
|
||
import jakarta.persistence.EntityManager; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
||
import com.example.namo2.domain.category.domain.Category; | ||
import com.example.namo2.domain.category.domain.CategoryKind; | ||
|
||
import com.example.namo2.domain.user.domain.User; | ||
|
||
public class CategoryRepositoryImpl implements CategoryRepositoryCustom { | ||
private final JPAQueryFactory queryFactory; | ||
|
||
public CategoryRepositoryImpl(EntityManager em) { | ||
queryFactory = new JPAQueryFactory(em); | ||
} | ||
|
||
@Override | ||
public List<Category> findMoimCategoriesByUsers(List<User> users, CategoryKind kind) { | ||
return queryFactory | ||
.selectFrom(category) | ||
.join(category.user).fetchJoin() | ||
.where(category.user.in(users), | ||
category.kind.eq(kind)) | ||
.fetch(); | ||
} | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/main/java/com/example/namo2/domain/category/domain/CategoryKind.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,20 @@ | ||
package com.example.namo2.domain.category.domain; | ||
|
||
public enum CategoryKind { | ||
/* | ||
SCHEDULE: 기본 | ||
MOIM: MOIM 기본 | ||
CUSTOM: 유저가 생성한 카테고리 | ||
*/ | ||
SCHEDULE("일정"), MOIM("모임"), CUSTOM("커스텀"); | ||
|
||
private String categoryName; | ||
|
||
CategoryKind(String categoryName) { | ||
this.categoryName = categoryName; | ||
} | ||
|
||
public String getCategoryName() { | ||
return categoryName; | ||
} | ||
} |
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
22 changes: 0 additions & 22 deletions
22
src/main/java/com/example/namo2/domain/category/validation/annotation/CategoryName.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/main/java/com/example/namo2/domain/category/validation/validator/CategoryValidator.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.