Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 약관 정보 삭제 및 테스트 추가, dagger version up #63

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
SSH_DEST: ${{ secrets.DEV_SSH_DEST }}
SSH_KEY: ${{ secrets.DEV_SSH_KEY }}
with:
version: 0.11.4
version: 0.11.6
verb: call
module: ./cicd
args: >-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-stag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
SSH_DEST: ${{ secrets.STAG_SSH_DEST }}
SSH_KEY: ${{ secrets.STAG_SSH_KEY }}
with:
version: 0.11.4
version: 0.11.6
verb: call
module: ./cicd
args: >-
Expand Down
31 changes: 0 additions & 31 deletions api/src/main/java/vook/server/api/app/terms/TermsService.java

This file was deleted.

This file was deleted.

15 changes: 5 additions & 10 deletions api/src/main/java/vook/server/api/app/user/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
import vook.server.api.app.user.repo.SocialUserRepository;
import vook.server.api.app.user.repo.UserInfoRepository;
import vook.server.api.app.user.repo.UserRepository;
import vook.server.api.app.user.repo.UserTermsAgreeRepository;
import vook.server.api.model.user.SocialUser;
import vook.server.api.model.user.User;
import vook.server.api.model.user.UserInfo;
import vook.server.api.model.user.UserTermsAgree;

import java.util.Optional;

Expand All @@ -23,7 +21,6 @@ public class UserService {
private final UserRepository repository;
private final SocialUserRepository socialUserRepository;
private final UserInfoRepository userInfoRepository;
private final UserTermsAgreeRepository userTermsAgreeRepository;

public Optional<SocialUser> findByProvider(String provider, String providerUserId) {
return socialUserRepository.findByProviderAndProviderUserId(provider, providerUserId);
Expand All @@ -47,16 +44,14 @@ public Optional<User> findByUid(String uid) {
public void register(RegisterCommand command) {
User user = repository.findByUid(command.getUserUid()).orElseThrow();

UserInfo userInfo = UserInfo.forRegisterOf(command.getNickname(), user);
UserInfo userInfo = UserInfo.forRegisterOf(
command.getNickname(),
user,
command.isMarketingEmailOptIn()
);
UserInfo savedUserInfo = userInfoRepository.save(userInfo);
user.addUserInfo(savedUserInfo);

for (RegisterCommand.TermsAgree termsAgree : command.getTermsAgrees()) {
UserTermsAgree userTermsAgree = UserTermsAgree.of(user, termsAgree.getTerms(), termsAgree.getAgree());
UserTermsAgree savedUserTermsAgree = userTermsAgreeRepository.save(userTermsAgree);
user.addUserTermsAgree(savedUserTermsAgree);
}

user.registered();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
package vook.server.api.app.user.data;

import lombok.Getter;
import vook.server.api.model.terms.Terms;

import java.util.List;

@Getter
public class RegisterCommand {

private String userUid;
private String nickname;
private List<TermsAgree> termsAgrees;
private boolean marketingEmailOptIn;

public static RegisterCommand of(
String userUid,
String nickname,
List<TermsAgree> termsAgrees
boolean marketingEmailOptIn
) {
RegisterCommand command = new RegisterCommand();
command.userUid = userUid;
command.nickname = nickname;
command.termsAgrees = termsAgrees;
command.marketingEmailOptIn = marketingEmailOptIn;
return command;
}

@Getter
public static class TermsAgree {
private Terms terms;
private Boolean agree;

public static TermsAgree of(
Terms terms,
Boolean agree
) {
TermsAgree result = new TermsAgree();
result.terms = terms;
result.agree = agree;
return result;
}
}
}

This file was deleted.

24 changes: 0 additions & 24 deletions api/src/main/java/vook/server/api/devhelper/InitService.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@
import org.springframework.transaction.annotation.Transactional;
import vook.server.api.app.demo.repo.DemoTermRepository;
import vook.server.api.app.demo.repo.DemoTermSynonymRepository;
import vook.server.api.app.terms.repo.TermsRepository;
import vook.server.api.app.user.repo.SocialUserRepository;
import vook.server.api.app.user.repo.UserInfoRepository;
import vook.server.api.app.user.repo.UserRepository;
import vook.server.api.app.user.repo.UserTermsAgreeRepository;
import vook.server.api.model.demo.DemoTerm;
import vook.server.api.model.terms.Terms;
import vook.server.api.outbound.search.DemoTermSearchService;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

@Service
Expand All @@ -28,21 +23,15 @@ public class InitService {

private final DemoTermRepository demoTermRepository;
private final DemoTermSynonymRepository demoTermSynonymRepository;
private final UserTermsAgreeRepository userTermsAgreeRepository;
private final UserInfoRepository userInfoRepository;
private final SocialUserRepository socialUserRepository;
private final UserRepository userRepository;
private final TermsRepository termsRepository;
private final DemoTermSearchService searchService;
private final TestTermsLoader testTermsLoader;

public void init() {
deleteAll();

termsRepository.save(Terms.of("이용약관", loadContents("classpath:init/이용약관.txt"), true));
termsRepository.save(Terms.of("개인정보 수집 이용 약관", loadContents("classpath:init/개인정보_수집_이용_약관.txt"), true));
termsRepository.save(Terms.of("마케팅 메일 수신 약관", loadContents("classpath:init/마케팅_메일_수신_약관.txt"), false));

List<DemoTerm> devTerms = testTermsLoader.getTerms("classpath:init/개발.tsv");
demoTermRepository.saveAll(devTerms);

Expand All @@ -56,24 +45,11 @@ private void deleteAll() {
demoTermRepository.deleteAllInBatch();

// 사용자
userTermsAgreeRepository.deleteAllInBatch();
userInfoRepository.deleteAllInBatch();
socialUserRepository.deleteAllInBatch();
userRepository.deleteAllInBatch();

// 약관
termsRepository.deleteAllInBatch();

// 검색 엔진
searchService.clearAll();
}

private String loadContents(String location) {
try {
InputStream inputStream = resourceLoader.getResource(location).getInputStream();
return new String(inputStream.readAllBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
33 changes: 0 additions & 33 deletions api/src/main/java/vook/server/api/model/terms/Terms.java

This file was deleted.

8 changes: 1 addition & 7 deletions api/src/main/java/vook/server/api/model/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class User {

private String uid;

@Column(unique = true)
private String email;

@Enumerated(EnumType.STRING)
Expand All @@ -32,9 +33,6 @@ public class User {
@OneToOne(mappedBy = "user")
private UserInfo userInfo;

@OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
private List<UserTermsAgree> userTermsAgrees = new ArrayList<>();

public static User forSignUpFromSocialOf(
String email
) {
Expand All @@ -53,10 +51,6 @@ public void addUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}

public void addUserTermsAgree(UserTermsAgree userTermsAgree) {
userTermsAgrees.add(userTermsAgree);
}

public void registered() {
this.status = UserStatus.REGISTERED;
}
Expand Down
6 changes: 5 additions & 1 deletion api/src/main/java/vook/server/api/model/user/UserInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class UserInfo {

private String nickname;

private Boolean marketingEmailOptIn;

private String funnel;

private String job;
Expand All @@ -24,11 +26,13 @@ public class UserInfo {

public static UserInfo forRegisterOf(
String nickname,
User user
User user,
boolean marketingEmailOptIn
) {
UserInfo result = new UserInfo();
result.nickname = nickname;
result.user = user;
result.marketingEmailOptIn = marketingEmailOptIn;
return result;
}

Expand Down
37 changes: 0 additions & 37 deletions api/src/main/java/vook/server/api/model/user/UserTermsAgree.java

This file was deleted.

23 changes: 0 additions & 23 deletions api/src/main/java/vook/server/api/web/routes/user/UserApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
import vook.server.api.web.routes.user.reqres.UserInfoResponse;
import vook.server.api.web.routes.user.reqres.UserOnboardingCompleteRequest;
import vook.server.api.web.routes.user.reqres.UserRegisterRequest;
import vook.server.api.web.routes.user.reqres.UserTermsResponse;

import java.util.List;

@Tag(name = "user", description = "사용자 관련 API")
public interface UserApi {
Expand All @@ -39,26 +36,6 @@ public interface UserApi {
class UserApiUerInfoResponse extends CommonApiResponse<UserInfoResponse> {
}

@Operation(
summary = "약관 목록",
security = {
@SecurityRequirement(name = "AccessToken")
}
)
@ApiResponses(value = {
@ApiResponse(
responseCode = "200",
description = "성공",
content = @Content(
schema = @Schema(implementation = UserApiTermsResponse.class)
)
),
})
CommonApiResponse<List<UserTermsResponse>> terms();

class UserApiTermsResponse extends CommonApiResponse<List<UserTermsResponse>> {
}

@Operation(
summary = "회원가입",
security = {
Expand Down
Loading
Loading