-
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.
Merge pull request #13 from Kusitms-29th-Meetup-TeamE/feat/11/onboarding
Feat: 온보딩 API 구현
- Loading branch information
Showing
16 changed files
with
167 additions
and
32 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
5 changes: 1 addition & 4 deletions
5
src/main/java/com/meetup/teame/backend/domain/activity/entity/Activity.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
13 changes: 0 additions & 13 deletions
13
src/main/java/com/meetup/teame/backend/domain/activity/entity/Personality.java
This file was deleted.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
src/main/java/com/meetup/teame/backend/domain/activity/repository/ActivityRepository.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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
package com.meetup.teame.backend.domain.activity.repository; | ||
|
||
import com.meetup.teame.backend.domain.activity.entity.Activity; | ||
import com.meetup.teame.backend.domain.activity.repository.custom.ActivityRepositoryCustom; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface ActivityRepository extends JpaRepository<Activity, Long> { | ||
public interface ActivityRepository extends JpaRepository<Activity, Long>, ActivityRepositoryCustom { | ||
} |
10 changes: 10 additions & 0 deletions
10
.../com/meetup/teame/backend/domain/activity/repository/custom/ActivityRepositoryCustom.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.meetup.teame.backend.domain.activity.repository.custom; | ||
|
||
import com.meetup.teame.backend.domain.activity.entity.Activity; | ||
import com.meetup.teame.backend.domain.user.entity.User; | ||
|
||
import java.util.List; | ||
|
||
public interface ActivityRepositoryCustom { | ||
List<Activity> findActivitiesForUser(User user); | ||
} |
25 changes: 25 additions & 0 deletions
25
...va/com/meetup/teame/backend/domain/activity/repository/custom/ActivityRepositoryImpl.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,25 @@ | ||
package com.meetup.teame.backend.domain.activity.repository.custom; | ||
|
||
import com.meetup.teame.backend.domain.activity.entity.Activity; | ||
import com.meetup.teame.backend.domain.activity.entity.QActivity; | ||
import com.meetup.teame.backend.domain.user.entity.User; | ||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
|
||
import static com.meetup.teame.backend.domain.activity.entity.QActivity.activity; | ||
|
||
@RequiredArgsConstructor | ||
public class ActivityRepositoryImpl implements ActivityRepositoryCustom { | ||
private final JPAQueryFactory jpaQueryFactory; | ||
|
||
@Override | ||
public List<Activity> findActivitiesForUser(User user) { | ||
return jpaQueryFactory | ||
.select(activity) | ||
.from(activity) | ||
.where(activity.personalities.any().in(user.getPersonalities())) | ||
.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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/meetup/teame/backend/domain/personality/Personality.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,30 @@ | ||
package com.meetup.teame.backend.domain.personality; | ||
|
||
import com.meetup.teame.backend.global.exception.CustomException; | ||
import com.meetup.teame.backend.global.exception.ExceptionContent; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.Arrays; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum Personality { | ||
WINDLESS("잔잔한"), | ||
ACTIVE("활발한"), | ||
PEACEFUL("평화로운"), | ||
NATURE_FRIENDLY("자연친화적인"), | ||
CREATIVE("창의적인"), | ||
ACADEMIC("학문적인"), | ||
ARTISTIC("예술적인"), | ||
LEARNABLE("배울 수 있는"); | ||
|
||
private final String description; | ||
|
||
public static Personality des2enum(String description) { | ||
return Arrays.stream(Personality.values()) | ||
.filter(personality -> personality.getDescription().equals(description)) | ||
.findFirst() | ||
.orElseThrow(() -> new CustomException(ExceptionContent.NOT_FOUND_PERSONALITY)); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/main/java/com/meetup/teame/backend/domain/user/dto/request/OnboardingReq.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,13 @@ | ||
package com.meetup.teame.backend.domain.user.dto.request; | ||
|
||
import jakarta.validation.constraints.Size; | ||
import lombok.*; | ||
|
||
import java.util.List; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Getter | ||
public class OnboardingReq { | ||
@Size(min = 1, message = "at least one personality must be selected") | ||
private List<String> personalities; | ||
} |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/com/meetup/teame/backend/global/config/QueryDslConfig.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,18 @@ | ||
package com.meetup.teame.backend.global.config; | ||
|
||
import com.querydsl.jpa.impl.JPAQueryFactory; | ||
import jakarta.persistence.EntityManager; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class QueryDslConfig { | ||
@Autowired | ||
private EntityManager entityManager; | ||
|
||
@Bean | ||
public JPAQueryFactory jpaQueryFactory() { | ||
return new JPAQueryFactory(entityManager); | ||
} | ||
} |
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