Skip to content

[백재우] sprint3 #149

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
feaa934
feat: project migration spring boot
jaewoo9797 Feb 4, 2025
f74a943
feat: 기본 요구사항 구현
jaewoo9797 Feb 4, 2025
425357b
refactor : user 객체의 필드 리팩토링
jaewoo9797 Feb 5, 2025
ff98cb0
feat: 프로젝트 밀고 다시 설계, 유저의 이름, 닉네임, 이메일 도메인 생성
jaewoo9797 Feb 6, 2025
004294a
docs: change branch for push remote my all branch
jaewoo9797 Feb 6, 2025
1b1848b
feat: 생년월일 기능 구현
jaewoo9797 Feb 7, 2025
e5df11c
Merge branch 'part1-백재우-sprint3' of https://github.com/jaewoo9797/1-s…
jaewoo9797 Feb 7, 2025
59261ad
refactor : 불필요한 개행문자 삭제
jaewoo9797 Feb 7, 2025
cb2ba91
feat: user join feature 구현
jaewoo9797 Feb 7, 2025
4c077b0
test: user service, repository 로그인 기능 테스트 구현
jaewoo9797 Feb 7, 2025
904b252
feat: 유저 비밀번호 암호화 기능 구현
jaewoo9797 Feb 7, 2025
8994b9c
refactor: In memory user repository 필드 자료구조 변경
jaewoo9797 Feb 7, 2025
1abd1ab
feat: 로그인 기능 구현
jaewoo9797 Feb 7, 2025
195cf78
fix: test build fail 문제 해결
jaewoo9797 Feb 7, 2025
297bbd7
refactor: method name 변경
jaewoo9797 Feb 8, 2025
0db550c
refactor: validate 기능을 도메인 모델 안으로 리팩터링
jaewoo9797 Feb 8, 2025
9c38ed3
feat: 채널 도메인 구현, 채널 저장, 수정 로직구현
jaewoo9797 Feb 8, 2025
07a68cd
feat: message 생성 로직 구현
jaewoo9797 Feb 10, 2025
94f27cb
feat: message 수정 삭제 기능 구현
jaewoo9797 Feb 10, 2025
2533076
refactor: service 레이어 인터페이스 만들기
jaewoo9797 Feb 10, 2025
485c7fb
feat: 팩토리 패턴을 이용하여 의존성을 관리
jaewoo9797 Feb 10, 2025
74be0d4
refactor: yaml -> properties
jaewoo9797 Feb 10, 2025
5a68077
refactor: validator 삭제
jaewoo9797 Feb 10, 2025
08dd9f0
feat: readStatus 기능 구현
jaewoo9797 Feb 10, 2025
eb5079a
feat: userstatus 기능 구현
jaewoo9797 Feb 10, 2025
c6ad93e
feat: user profile 이미지 관리
jaewoo9797 Feb 10, 2025
d08f484
feat: user, channel service 고도화 기능요구 사항 추가
jaewoo9797 Feb 11, 2025
f27e819
feat: channel 조회 기능 구현
jaewoo9797 Feb 11, 2025
f809a24
feat: channel 기능 고도화 구현
jaewoo9797 Feb 11, 2025
6a46839
feat: 추가 요구사항 기능 구현
jaewoo9797 Feb 11, 2025
4cf1ba5
refactor: application 파일 확장자 변경
jaewoo9797 Feb 11, 2025
7cbfa3d
refactor: 일관된 코딩 스타일 수정
jaewoo9797 Feb 11, 2025
cc1d576
fix: 테스트 실패 오류 수정
jaewoo9797 Feb 11, 2025
ad5b767
refactor: 중복 함수 묶기 = createChannel 관련 메서드(public, private)
jaewoo9797 Feb 11, 2025
8fd1599
refactor: 분기 처리 삼항연산자, if 문 질문
jaewoo9797 Feb 11, 2025
d023120
docs: 요구사항 삭제 (코드에 집중할 수 잇도록)
jaewoo9797 Feb 11, 2025
fef5055
refactor: lombok 어노테이션 삭제
jaewoo9797 Feb 11, 2025
dfd4968
refactor: 필요없는 데이터베이스 접근 로직 삭제 (ReadStatus)
jaewoo9797 Feb 11, 2025
bf4d325
refactor: 줄바꿈, 잘못된 클래스 이름 수정
jaewoo9797 Feb 11, 2025
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/sprint-mission1-pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: sprint mission 1 PR Test
on:
push:
branches:
- 'part1-백재우-sprint1'
- '*'
pull_request:
branches:
- 'part1-백재우'
Expand Down
3 changes: 3 additions & 0 deletions codeit-bootcamp-spring/1-sprint-mission/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
32 changes: 11 additions & 21 deletions codeit-bootcamp-spring/1-sprint-mission/.gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
### STS ###
.apt_generated
.classpath
.factorypath
Expand All @@ -28,6 +17,15 @@ bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
Expand All @@ -37,11 +35,3 @@ bin/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store


/build
/build/test-results/
/build/reports/
93 changes: 0 additions & 93 deletions codeit-bootcamp-spring/1-sprint-mission/README.md
Original file line number Diff line number Diff line change
@@ -1,93 +0,0 @@
간단하게 얼른 하고 끝내버리자.
1. 서비스 구현체를 구현하라. -> 기존 유저 서비스의 구현

## 로직 생각해보기
객체 직렬화를 사용해서 할 경우, 바이너리로 저장된다. 수정을 하고 싶은 경우 특정 부분만 삭제하거나, 수정하는 것이 어렵다
=> 모든 저장 내용을 읽어들이고 파일을 새롭게 쓰는 방법이 쉬운 방법이다.

성능적으로 보면, 매우 안좋다고 볼 수 있다. 만약 파일에 저장된 데이터가 매우 많을 경우를 생각하면 읽고 새롭게 쓰고 하면 성능저하가 당연하다.

데이터가 많을 경우 데이터베이스를 이용하는 것이 좋다.

요구사항
기본 요구사항
File IO를 통한 데이터 영속화
- [ ] 다음의 조건을 만족하는 서비스 인터페이스의 구현체를 작성하세요.

- [ ] 클래스 패키지명: com.sprint.mission.discodeit.service.file

- [ ] 클래스 네이밍 규칙: File[인터페이스 이름]

- [ ] JCF 대신 FileIO와 객체 직렬화를 활용해 메소드를 구현하세요.

객체 직렬화/역직렬화 가이드

- [ ] Application에서 서비스 구현체를 File*Service로 바꾸어 테스트해보세요.

서비스 구현체 분석
- [ ] JCF*Service 구현체와 File*Service 구현체를 비교하여 공통점과 차이점을 발견해보세요.
- [ ] "비즈니스 로직"과 관련된 코드를 식별해보세요.
- [ ] "저장 로직"과 관련된 코드를 식별해보세요.
레포지토리 설계 및 구현
- [ ] "저장 로직"과 관련된 기능을 도메인 모델 별 인터페이스로 선언하세요.
- [ ] 인터페이스 패키지명: com.sprint.mission.discodeit.repository
- [ ] 인터페이스 네이밍 규칙: [도메인 모델 이름]Repository
- [ ] 다음의 조건을 만족하는 레포지토리 인터페이스의 구현체를 작성하세요.
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.repository.jcf
- [ ] 클래스 네이밍 규칙: JCF[인터페이스 이름]
- [ ] 기존에 구현한 JCF*Service 구현체의 "저장 로직"과 관련된 코드를 참고하여 구현하세요.
- [ ] 다음의 조건을 만족하는 레포지토리 인터페이스의 구현체를 작성하세요.
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.repository.file
- [ ] 클래스 네이밍 규칙: File[인터페이스 이름]
- [ ] 기존에 구현한 File*Service 구현체의 "저장 로직"과 관련된 코드를 참고하여 구현하세요.
심화 요구 사항
관심사 분리를 통한 레이어 간 의존성 주입
- [ ] 다음의 조건을 만족하는 서비스 인터페이스의 구현체를 작성하세요.
- [ ] 클래스 패키지명: com.sprint.mission.discodeit.service.basic
- [ ] 클래스 네이밍 규칙: Basic[인터페이스 이름]
- [ ] 기존에 구현한 서비스 구현체의 "비즈니스 로직"과 관련된 코드를 참고하여 구현하세요.
- [ ] 필요한 Repository 인터페이스를 필드로 선언하고 생성자를 통해 초기화하세요.
- [ ] "저장 로직"은 Repository 인터페이스 필드를 활용하세요. (직접 구현하지 마세요.)
- [ ] Basic*Service 구현체를 활용하여 테스트해보세요.
코드 템플릿

```java


public class JavaApplication {
static User setupUser(UserService userService) {
User user = userService.create("woody", "[email protected]", "woody1234");
return user;
}

static Channel setupChannel(ChannelService channelService) {
Channel channel = channelService.create(ChannelType.PUBLIC, "공지", "공지 채널입니다.");
return channel;
}

static void messageCreateTest(MessageService messageService, Channel channel, User author) {
Message message = messageService.create("안녕하세요.", channel.getId(), author.getId());
System.out.println("메시지 생성: " + message.getId());
}

public static void main(String[] args) {
// 서비스 초기화
// TODO Basic*Service 구현체를 초기화하세요.
UserService userService;
ChannelService channelService;
MessageService messageService;

// 셋업
User user = setupUser(userService);
Channel channel = setupChannel(channelService);
// 테스트
messageCreateTest(messageService, channel, user);
}
}
```

- [ ] JCF*Repository 구현체를 활용하여 테스트해보세요.

- [ ] File*Repository 구현체를 활용하여 테스트해보세요.

- [ ] 이전에 작성했던 코드(JCF*Service 또는 File*Service)와 비교해 어떤 차이가 있는지 정리해보세요.
39 changes: 25 additions & 14 deletions codeit-bootcamp-spring/1-sprint-mission/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.0'
id 'io.spring.dependency-management' version '1.1.7'
}

group = 'com.sprint.mission'
version = '1.0-SNAPSHOT'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'

// https://mvnrepository.com/artifact/org.mockito/mockito-core
testImplementation 'org.mockito:mockito-core:4.11.0'
// https://mvnrepository.com/artifact/org.assertj/assertj-core
testImplementation 'org.assertj:assertj-core:3.24.2'
implementation 'org.springframework.boot:spring-boot-starter-web'
// compileOnly 'org.projectlombok:lombok'
// annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

// https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator
implementation 'org.hibernate.validator:hibernate-validator:8.0.2.Final'
// https://mvnrepository.com/artifact/org.glassfish.expressly/expressly
implementation 'org.glassfish.expressly:expressly:5.0.0'
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation 'com.google.guava:guava:33.2.1-jre'

// https://mvnrepository.com/artifact/org.mindrot/jbcrypt
implementation 'org.mindrot:jbcrypt:0.4'

}

test {
tasks.named('test') {
useJUnitPlatform()
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Tue Jan 07 00:58:32 KST 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
44 changes: 31 additions & 13 deletions codeit-bootcamp-spring/1-sprint-mission/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +82,12 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +134,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,18 +201,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading