-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 회원 가입시 최초 북마크 생성 로직 * fix: 픽 쿼리 빈 배열 예외 추가
- Loading branch information
1 parent
50621f2
commit 22c3350
Showing
10 changed files
with
160 additions
and
61 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
8 changes: 0 additions & 8 deletions
8
...nd/techpick-api/src/main/java/techpick/api/domain/user/service/InitialFolderStrategy.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
8 changes: 8 additions & 0 deletions
8
...pick-api/src/main/java/techpick/api/domain/user/service/strategy/ContentInitStrategy.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,8 @@ | ||
package techpick.api.domain.user.service.strategy; | ||
|
||
import techpick.core.model.folder.Folder; | ||
import techpick.core.model.user.User; | ||
|
||
public interface ContentInitStrategy { | ||
void initContent(User user, Folder parentFolder); | ||
} |
19 changes: 19 additions & 0 deletions
19
...pi/src/main/java/techpick/api/domain/user/service/strategy/InitStrategyConfiguration.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,19 @@ | ||
package techpick.api.domain.user.service.strategy; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class InitStrategyConfiguration { | ||
|
||
@Bean | ||
public List<ContentInitStrategy> contentInitStrategies( | ||
@Qualifier("app-manual") ContentInitStrategy strategy1, | ||
@Qualifier("hot-contents") ContentInitStrategy strategy2 | ||
) { | ||
return List.of(strategy1, strategy2); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...hpick-api/src/main/java/techpick/api/domain/user/service/strategy/ManualInitStrategy.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,43 @@ | ||
package techpick.api.domain.user.service.strategy; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import techpick.api.domain.link.service.LinkService; | ||
import techpick.api.domain.pick.dto.PickCommand; | ||
import techpick.api.domain.pick.service.PickService; | ||
import techpick.core.model.folder.Folder; | ||
import techpick.core.model.user.User; | ||
|
||
@Slf4j | ||
@Component | ||
@Qualifier("app-manual") | ||
@RequiredArgsConstructor | ||
public class ManualInitStrategy implements ContentInitStrategy { | ||
|
||
private final PickService pickService; | ||
private final LinkService linkService; | ||
|
||
private final List<String> MANUAL_URLS = List.of( | ||
"https://positive-airboat-4de.notion.site/15841a7fba6580c59591e2d5d1c2414b?pvs=4", | ||
"https://positive-airboat-4de.notion.site/15841a7fba65808b8636e15e6c6d9679?pvs=4", | ||
"https://positive-airboat-4de.notion.site/15841a7fba65809d89a6dceb89060f70?pvs=4", | ||
"https://positive-airboat-4de.notion.site/15841a7fba6580f78caee50c069a1247?pvs=4" | ||
); | ||
|
||
@Override | ||
public void initContent(User user, Folder parentFolder) { | ||
for (var url : MANUAL_URLS) { | ||
var linkInfo = linkService.saveLinkAndUpdateOgTag(url); | ||
var command = new PickCommand.Create( | ||
user.getId(), linkInfo.title(), new ArrayList<>(), parentFolder.getId(), linkInfo | ||
); | ||
pickService.saveNewPick(command); | ||
} | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
...ck-api/src/main/java/techpick/api/domain/user/service/strategy/StarterFolderStrategy.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 techpick.api.domain.user.service.strategy; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import techpick.api.domain.folder.dto.FolderCommand; | ||
import techpick.api.infrastructure.folder.FolderDataHandler; | ||
import techpick.core.model.folder.Folder; | ||
import techpick.core.model.user.User; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class StarterFolderStrategy { | ||
|
||
private static final String FOLDER_NAME = "시작하기"; | ||
|
||
private final FolderDataHandler folderDataHandler; | ||
|
||
private final List<ContentInitStrategy> contentStrategies; | ||
|
||
public void initFolder(User user, Folder parentFolder) { | ||
var command = new FolderCommand.Create(user.getId(), FOLDER_NAME, parentFolder.getId()); | ||
var folder = folderDataHandler.saveFolder(command); | ||
for (var strategy : contentStrategies) { | ||
strategy.initContent(user, folder); | ||
} | ||
} | ||
} |
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