Skip to content

Commit

Permalink
πŸ”€ :: (#253) μ˜΅μ…˜ μ—”ν‹°ν‹° noarg μƒμ„±μž 문제 ν•΄κ²°
Browse files Browse the repository at this point in the history
πŸ”€ :: (#253)  μ˜΅μ…˜ μ—”ν‹°ν‹° noarg μƒμ„±μž 문제 ν•΄κ²°
  • Loading branch information
ImNM authored Dec 28, 2022
2 parents f7521f9 + 52b7e35 commit d5ba4ef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public AfterOauthResponse oauthCodeToUser(OauthProvider oauthProvider, String co
.email(email)
.build();
userRepository.save(newUser);
userOptionService.initializeOption(newUser);

return newUser;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import javax.persistence.MapsId;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@Builder
@Table(name = "tbl_option")
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@Entity
public class Option {

Expand All @@ -30,6 +32,11 @@ public class Option {

private boolean nightOption;

@Builder
public Option(User user) {
this.user = user;
}

public void setNewOption(boolean newOption) {
this.newOption = newOption;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@


import io.github.depromeet.knockknockbackend.domain.option.domain.Option;
import java.util.Optional;
import org.springframework.data.repository.CrudRepository;

public interface OptionRepository extends CrudRepository<Option, Long> {}
public interface OptionRepository extends CrudRepository<Option, Long> {

Optional<Option> findByUserId(Long currentUserId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void initializeOption(User user) {

private Option queryOption() {
return optionRepository
.findById(SecurityUtils.getCurrentUserId())
.findByUserId(SecurityUtils.getCurrentUserId())
.orElseThrow(() -> OptionNotFoundException.EXCEPTION);
}
}

0 comments on commit d5ba4ef

Please sign in to comment.