diff --git a/.gitignore b/.gitignore index 178c6b7..5381f0a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +Week1/ + +Week3/ diff --git a/Week2/.idea/.gitignore b/Week2/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Week2/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Week2/.idea/Week2.iml b/Week2/.idea/Week2.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/Week2/.idea/Week2.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/compiler.xml b/Week2/.idea/compiler.xml new file mode 100644 index 0000000..a2fd5a9 --- /dev/null +++ b/Week2/.idea/compiler.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/gradle.xml b/Week2/.idea/gradle.xml new file mode 100644 index 0000000..5d323cb --- /dev/null +++ b/Week2/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/jarRepositories.xml b/Week2/.idea/jarRepositories.xml new file mode 100644 index 0000000..fdc392f --- /dev/null +++ b/Week2/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/misc.xml b/Week2/.idea/misc.xml new file mode 100644 index 0000000..efc8677 --- /dev/null +++ b/Week2/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Week2/.idea/modules.xml b/Week2/.idea/modules.xml new file mode 100644 index 0000000..d6745f6 --- /dev/null +++ b/Week2/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/modules/SecondSeminar.main.iml b/Week2/.idea/modules/SecondSeminar.main.iml new file mode 100644 index 0000000..05c9b9d --- /dev/null +++ b/Week2/.idea/modules/SecondSeminar.main.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/uiDesigner.xml b/Week2/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/Week2/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/.idea/vcs.xml b/Week2/.idea/vcs.xml new file mode 100644 index 0000000..b84ec5a --- /dev/null +++ b/Week2/.idea/vcs.xml @@ -0,0 +1,10 @@ + + + +<<<<<<< Updated upstream:Week2/.idea/vcs.xml + +======= + +>>>>>>> Stashed changes:.idea/vcs.xml + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/.gitignore b/Week2/Seminar/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Week2/Seminar/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Week2/Seminar/.idea/Seminar.iml b/Week2/Seminar/.idea/Seminar.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/Week2/Seminar/.idea/Seminar.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/compiler.xml b/Week2/Seminar/.idea/compiler.xml new file mode 100644 index 0000000..a2fd5a9 --- /dev/null +++ b/Week2/Seminar/.idea/compiler.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/gradle.xml b/Week2/Seminar/.idea/gradle.xml new file mode 100644 index 0000000..e3794f6 --- /dev/null +++ b/Week2/Seminar/.idea/gradle.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/jarRepositories.xml b/Week2/Seminar/.idea/jarRepositories.xml new file mode 100644 index 0000000..fdc392f --- /dev/null +++ b/Week2/Seminar/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/misc.xml b/Week2/Seminar/.idea/misc.xml new file mode 100644 index 0000000..efc8677 --- /dev/null +++ b/Week2/Seminar/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/modules.xml b/Week2/Seminar/.idea/modules.xml new file mode 100644 index 0000000..0371cf9 --- /dev/null +++ b/Week2/Seminar/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/modules/SecondSeminar.main.iml b/Week2/Seminar/.idea/modules/SecondSeminar.main.iml new file mode 100644 index 0000000..da4385c --- /dev/null +++ b/Week2/Seminar/.idea/modules/SecondSeminar.main.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/.idea/vcs.xml b/Week2/Seminar/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/Week2/Seminar/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.gitignore b/Week2/Seminar/SecondSeminar/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/checksums/checksums.lock b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/checksums/checksums.lock new file mode 100644 index 0000000..8c142d2 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/checksums/checksums.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..eeb1735 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/dependencies-accessors/gc.properties b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/executionHistory/executionHistory.bin b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..75e275b Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/executionHistory/executionHistory.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/executionHistory/executionHistory.lock b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..237720b Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/executionHistory/executionHistory.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileChanges/last-build.bin b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileChanges/last-build.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/fileHashes.bin b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..58f5f0c Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/fileHashes.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/fileHashes.lock b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..a7ec75a Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/fileHashes.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/resourceHashesCache.bin b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..993c6e3 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/fileHashes/resourceHashesCache.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.5.1/gc.properties b/Week2/Seminar/SecondSeminar/.gradle/7.5.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/checksums.lock b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/checksums.lock new file mode 100644 index 0000000..f2db217 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/checksums.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/md5-checksums.bin b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/md5-checksums.bin new file mode 100644 index 0000000..459f8e3 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/md5-checksums.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/sha1-checksums.bin b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/sha1-checksums.bin new file mode 100644 index 0000000..697fa91 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/checksums/sha1-checksums.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/dependencies-accessors/dependencies-accessors.lock b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/dependencies-accessors/dependencies-accessors.lock new file mode 100644 index 0000000..d231f11 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/dependencies-accessors/dependencies-accessors.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/dependencies-accessors/gc.properties b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/executionHistory/executionHistory.bin b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..2c1f939 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/executionHistory/executionHistory.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/executionHistory/executionHistory.lock b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/executionHistory/executionHistory.lock new file mode 100644 index 0000000..74c5928 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/executionHistory/executionHistory.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileChanges/last-build.bin b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileChanges/last-build.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/fileHashes.bin b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/fileHashes.bin new file mode 100644 index 0000000..e13fa83 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/fileHashes.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/fileHashes.lock b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..3a43f6a Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/fileHashes.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/resourceHashesCache.bin b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/resourceHashesCache.bin new file mode 100644 index 0000000..8a30a6c Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/fileHashes/resourceHashesCache.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/7.6.1/gc.properties b/Week2/Seminar/SecondSeminar/.gradle/7.6.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..e5ac89f Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/cache.properties b/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..6af4340 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Sat Apr 22 01:19:25 KST 2023 +gradle.version=7.5.1 diff --git a/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/outputFiles.bin b/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..b4592a4 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/file-system.probe b/Week2/Seminar/SecondSeminar/.gradle/file-system.probe new file mode 100644 index 0000000..ceacb60 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/.gradle/file-system.probe differ diff --git a/Week2/Seminar/SecondSeminar/.gradle/vcs-1/gc.properties b/Week2/Seminar/SecondSeminar/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/.idea/.gitignore b/Week2/Seminar/SecondSeminar/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Week2/Seminar/SecondSeminar/.idea/compiler.xml b/Week2/Seminar/SecondSeminar/.idea/compiler.xml new file mode 100644 index 0000000..d98acc5 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.idea/gradle.xml b/Week2/Seminar/SecondSeminar/.idea/gradle.xml new file mode 100644 index 0000000..d405dbe --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.idea/jarRepositories.xml b/Week2/Seminar/SecondSeminar/.idea/jarRepositories.xml new file mode 100644 index 0000000..fdc392f --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.idea/misc.xml b/Week2/Seminar/SecondSeminar/.idea/misc.xml new file mode 100644 index 0000000..4bc4fc6 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.idea/modules.xml b/Week2/Seminar/SecondSeminar/.idea/modules.xml new file mode 100644 index 0000000..9c91eed --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.idea/modules/SecondSeminar.main.iml b/Week2/Seminar/SecondSeminar/.idea/modules/SecondSeminar.main.iml new file mode 100644 index 0000000..ec81b53 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/modules/SecondSeminar.main.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/.idea/vcs.xml b/Week2/Seminar/SecondSeminar/.idea/vcs.xml new file mode 100644 index 0000000..c2365ab --- /dev/null +++ b/Week2/Seminar/SecondSeminar/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/HELP.md b/Week2/Seminar/SecondSeminar/HELP.md new file mode 100644 index 0000000..8f87d1a --- /dev/null +++ b/Week2/Seminar/SecondSeminar/HELP.md @@ -0,0 +1,22 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Gradle documentation](https://docs.gradle.org) +* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.10/gradle-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.10/gradle-plugin/reference/html/#build-image) +* [Spring Web](https://docs.spring.io/spring-boot/docs/2.7.10/reference/htmlsingle/#web) + +### Guides +The following guides illustrate how to use some features concretely: + +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/) + +### Additional Links +These additional references should also help you: + +* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) + diff --git a/Week2/Seminar/SecondSeminar/build.gradle b/Week2/Seminar/SecondSeminar/build.gradle new file mode 100644 index 0000000..ee38f50 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/build.gradle @@ -0,0 +1,25 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '2.7.10' + id 'io.spring.dependency-management' version '1.0.15.RELEASE' +} + +group = 'sopt.org' +version = '0.0.1-SNAPSHOT' +sourceCompatibility = '11' + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.projectlombok:lombok:1.18.22' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + annotationProcessor 'org.projectlombok:lombok' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +tasks.named('test') { + useJUnitPlatform() +} diff --git a/Week2/Seminar/SecondSeminar/build/resources/main/application.properties b/Week2/Seminar/SecondSeminar/build/resources/main/application.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/build/tmp/compileJava/compileTransaction/stash-dir/MemberController.class.uniqueId0 b/Week2/Seminar/SecondSeminar/build/tmp/compileJava/compileTransaction/stash-dir/MemberController.class.uniqueId0 new file mode 100644 index 0000000..0d56862 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/build/tmp/compileJava/compileTransaction/stash-dir/MemberController.class.uniqueId0 differ diff --git a/Week2/Seminar/SecondSeminar/build/tmp/compileJava/previous-compilation-data.bin b/Week2/Seminar/SecondSeminar/build/tmp/compileJava/previous-compilation-data.bin new file mode 100644 index 0000000..37492a9 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/Week2/Seminar/SecondSeminar/gradle/wrapper/gradle-wrapper.jar b/Week2/Seminar/SecondSeminar/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..249e583 Binary files /dev/null and b/Week2/Seminar/SecondSeminar/gradle/wrapper/gradle-wrapper.jar differ diff --git a/Week2/Seminar/SecondSeminar/gradlew b/Week2/Seminar/SecondSeminar/gradlew new file mode 100755 index 0000000..a69d9cb --- /dev/null +++ b/Week2/Seminar/SecondSeminar/gradlew @@ -0,0 +1,240 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# 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 +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +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. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + 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. + +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. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/Week2/Seminar/SecondSeminar/gradlew.bat b/Week2/Seminar/SecondSeminar/gradlew.bat new file mode 100644 index 0000000..53a6b23 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/gradlew.bat @@ -0,0 +1,91 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/Week2/Seminar/SecondSeminar/settings.gradle b/Week2/Seminar/SecondSeminar/settings.gradle new file mode 100644 index 0000000..b15c549 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'SecondSeminar' diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/.gitignore b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/misc.xml b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/misc.xml new file mode 100644 index 0000000..0319d5d --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/modules.xml b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/modules.xml new file mode 100644 index 0000000..dc12695 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/vcs.xml b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/vcs.xml new file mode 100644 index 0000000..e4f3eb6 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/SecondSeminar.iml b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/SecondSeminar.iml new file mode 100644 index 0000000..3fbf8bd --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/SecondSeminar.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/SecondSeminarApplication.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/SecondSeminarApplication.java new file mode 100644 index 0000000..045704d --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/SecondSeminarApplication.java @@ -0,0 +1,25 @@ +package sopt.org.SecondSeminar; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import sopt.org.SecondSeminar.domain.Member; +import sopt.org.SecondSeminar.domain.Posting; +import sopt.org.SecondSeminar.domain.User; + +import java.util.ArrayList; + +@SpringBootApplication +public class SecondSeminarApplication { + + public static ArrayList userList; + public static ArrayList postingList; + public static ArrayList memberList; + + public static void main(String[] args) { + SpringApplication.run(SecondSeminarApplication.class, args); + + userList = new ArrayList<>(); + postingList = new ArrayList<>(); + memberList = new ArrayList<>(); + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/MemberController.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/MemberController.java new file mode 100644 index 0000000..babf77b --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/MemberController.java @@ -0,0 +1,56 @@ +package sopt.org.SecondSeminar.controller.user; + +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; +import sopt.org.SecondSeminar.controller.user.dto.request.MemberRegisterRequestDto; +import sopt.org.SecondSeminar.controller.user.dto.request.MemberUpdateRequestDto; +import sopt.org.SecondSeminar.controller.user.dto.response.ResponseDto; +import sopt.org.SecondSeminar.service.MemberService; + +import static sopt.org.SecondSeminar.SecondSeminarApplication.memberList; + +@RestController +@RequiredArgsConstructor +public class MemberController { + private final MemberService memberService; + + @PostMapping("/member") + public String register(@RequestBody final MemberRegisterRequestDto request){ + Long memberId = memberService.register(request); + System.out.println(memberList.get(memberId.intValue() - 1).toString()); + + return memberId + "번 회원이 등록되었습니다!"; + } + + @GetMapping("/member/{memberId}") + public ResponseDto getOneMember(@PathVariable final Long memberId) { + if (memberService.findOne(memberId) == null) { // 예외 처리 404 + System.out.println("존재하지 않는 회원입니다."); + return new ResponseDto(HttpStatus.NOT_FOUND.value(), "404 NOT_FOUND"); + } + + System.out.println("회원 조회에 성공했습니다."); + System.out.println(memberService.findOne(memberId).toString()); + + return new ResponseDto(HttpStatus.OK.value(), "200 OK!"); + } + + @PutMapping("/member") + public String editMember(@RequestBody MemberUpdateRequestDto request) { + String memberName = memberService.edit(request); + System.out.println(memberService.findByName(memberName).toString()); + return memberName + "님 회원 정보 수정이 완료되었습니다."; + } + + @DeleteMapping("/member/delete") + public ResponseDto delete(@RequestParam final String name) { + Boolean isDeleted = memberService.delete(name); + if (isDeleted == false) { // 예외처리 404 + System.out.println("존재하지 않는 회원입니다!"); + return new ResponseDto(HttpStatus.NOT_FOUND.value(), "404 NOT_FOUND"); + } + System.out.println(name + "회원 정보 삭제가 완료되었습니다."); + return new ResponseDto(HttpStatus.OK.value(), "200 OK!"); + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/PostingController.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/PostingController.java new file mode 100644 index 0000000..4b03a29 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/PostingController.java @@ -0,0 +1,44 @@ +package sopt.org.SecondSeminar.controller.user; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import sopt.org.SecondSeminar.controller.user.dto.request.PostingRegisterRequestDto; +import sopt.org.SecondSeminar.service.PostingService; +import sopt.org.SecondSeminar.service.UserService; + +import static sopt.org.SecondSeminar.SecondSeminarApplication.postingList; +import static sopt.org.SecondSeminar.SecondSeminarApplication.userList; + +@RestController +@RequiredArgsConstructor +public class PostingController { + private final PostingService postingService; + + @PostMapping("/posting") + public String register(@RequestBody final PostingRegisterRequestDto request) { + // 서비스 계층에 게시물을 등록하는 메서드를 호출 + Long postingId = postingService.register(request); //1 + System.out.println(postingId); + System.out.println(postingList.get(postingId.intValue() - 1).toString()); + + return postingId + "번 게시물이 등록되었습니다!"; + } + + @GetMapping("/posting/{postingId}") + public String getOne(@PathVariable final Long postingId) { + System.out.println("요청 게시물 아이디: " + postingId); + + // 서비스 계층에서 게시물 아이디로 게시물을 찾는 메서드 호출 + return "게시물 조회 성공"; + } + + @GetMapping("/posting/searchPost") + public String searchPost(@RequestParam final String title) { + System.out.println("게시물 이름 검색 인자: " + title); + + // 서비스 계층에서 게시물 이름으로 게시물을 찾는 메서드 호출 + return "게시물 검색 성공"; + } + + +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/UserController.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/UserController.java new file mode 100644 index 0000000..466a471 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/UserController.java @@ -0,0 +1,43 @@ +package sopt.org.SecondSeminar.controller.user; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import sopt.org.SecondSeminar.controller.user.dto.request.RegisterRequestDto; +import sopt.org.SecondSeminar.service.UserService; + +import static sopt.org.SecondSeminar.SecondSeminarApplication.userList; + +@RestController +@RequiredArgsConstructor +public class UserController { + private final UserService userService; + + @PostMapping("/user") + public String register(@RequestBody final RegisterRequestDto request) { + // 서비스 계층에 유저를 등록하는 메서드를 호출 + Long userId = userService.register(request); + System.out.println(userList.get(userId.intValue() - 1).toString()); + + return userId + "번 유저가 등록되었습니다!"; + } + + // PathVariable + @GetMapping("/user/{userId}") + public String getOne(@PathVariable final Long userId) { + System.out.println("요청 유저 아이디: " + userId); + + // 서비스 계층에서 유저 아이디로 유저를 찾는 메서드 호출 + + return "유저 조회 성공"; + } + + //Query Param + @GetMapping("/user/search") + public String search(@RequestParam final String name) { + System.out.println("유저 이름 검색 인자: " + name); + + // 서비스 계층에서 유저 닉네임으로 유저를 찾는 메서드 호출 + + return "유저 검색 성공"; + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/MemberRegisterRequestDto.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/MemberRegisterRequestDto.java new file mode 100644 index 0000000..75cc11b --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/MemberRegisterRequestDto.java @@ -0,0 +1,16 @@ +package sopt.org.SecondSeminar.controller.user.dto.request; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class MemberRegisterRequestDto { + // 회원 등록 시 필요한 정보 + private String name; + private int age; + private String gender; + private String contact; + private boolean marriage; +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/MemberUpdateRequestDto.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/MemberUpdateRequestDto.java new file mode 100644 index 0000000..46e9ab5 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/MemberUpdateRequestDto.java @@ -0,0 +1,14 @@ +package sopt.org.SecondSeminar.controller.user.dto.request; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class MemberUpdateRequestDto { + private String name; + private int age; + private String gender; + private String contact; + private boolean marriage; +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/PostingRegisterRequestDto.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/PostingRegisterRequestDto.java new file mode 100644 index 0000000..30fc429 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/PostingRegisterRequestDto.java @@ -0,0 +1,14 @@ +package sopt.org.SecondSeminar.controller.user.dto.request; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public class PostingRegisterRequestDto { + private String title; + private String context; + private String writer; + private String time; +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/RegisterRequestDto.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/RegisterRequestDto.java new file mode 100644 index 0000000..cf999f7 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/request/RegisterRequestDto.java @@ -0,0 +1,15 @@ +package sopt.org.SecondSeminar.controller.user.dto.request; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor(access = AccessLevel.PRIVATE) // lombok에서 모든 멤버 변수를 인자로 받아서 자동으로 생성자 생성해 줌 + +public class RegisterRequestDto { + private String gender; + private String name; + private String contact; + private int age; +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/response/ResponseDto.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/response/ResponseDto.java new file mode 100644 index 0000000..fe3625b --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/controller/user/dto/response/ResponseDto.java @@ -0,0 +1,11 @@ +package sopt.org.SecondSeminar.controller.user.dto.response; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public class ResponseDto { // 데이터 타입이 달라질 수 있기 때문에 제네릭으로 선언 + int status; + T data; +} \ No newline at end of file diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/Member.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/Member.java new file mode 100644 index 0000000..10fd604 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/Member.java @@ -0,0 +1,29 @@ +package sopt.org.SecondSeminar.domain; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.springframework.stereotype.Service; + +@Getter +@Setter +@ToString(exclude = "id") +public class Member { + private Long id; + private String name; + private int age; + private String gender; + private String contact; + private boolean marriage; + + // 생성자 정의 + public Member(String name, int age, String gender, String contact, boolean marriage) { + this.name = name; + this.age = age; + this.gender = gender; + this.contact = contact; + this.marriage = marriage; + } +} + + diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/Posting.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/Posting.java new file mode 100644 index 0000000..fb21bcd --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/Posting.java @@ -0,0 +1,32 @@ +package sopt.org.SecondSeminar.domain; + +import lombok.Getter; + +@Getter +public class Posting { + private Long id; + private String title; + private String context; + private String writer; + private String time; + + public Posting(String title, String context, String writer, String time) { + this.title = title; + this.context = context; + this.writer = writer; + this.time = time; + } + + public void setId(Long id){ + this.id = id; + } + + @Override + public String toString() { + return "id: " + this.id + "\n" + + "title: " + this.title + "\n" + + "context: " + this.context + "\n" + + "writer: " + this.writer + "\n" + + "time: " + this.time; + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/User.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/User.java new file mode 100644 index 0000000..22f84d0 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/domain/User.java @@ -0,0 +1,35 @@ +package sopt.org.SecondSeminar.domain; + +// Option+Enter하면 import 가능 +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import lombok.Getter; + +@Getter +public class User { + private Long id; + private String gender; + private String name; + private String contact; + private int age; + + // Ctrl+Enter로 Contructor 해서 전체 선택하면 만들어짐 + public User(String gender, String name, String contact, int age) { + this.gender = gender; + this.name = name; + this.contact = contact; + this.age = age; + } + + public void setId(Long id) { + this.id = id; + } + + @Override + public String toString() { + return "id: " + this.id + "\n" + + "gender: " + this.gender + "\n" + + "name: " + this.name + "\n" + + "contact: " + this.contact + "\n" + + "age: " + this.age; + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/MemberService.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/MemberService.java new file mode 100644 index 0000000..2e8c404 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/MemberService.java @@ -0,0 +1,81 @@ +package sopt.org.SecondSeminar.service; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; +import org.springframework.web.bind.annotation.ExceptionHandler; +import sopt.org.SecondSeminar.controller.user.MemberController; +import sopt.org.SecondSeminar.controller.user.dto.request.MemberRegisterRequestDto; +import sopt.org.SecondSeminar.controller.user.dto.request.MemberUpdateRequestDto; +import sopt.org.SecondSeminar.controller.user.dto.response.ResponseDto; +import sopt.org.SecondSeminar.domain.Member; + +import java.util.ArrayList; + +import static sopt.org.SecondSeminar.SecondSeminarApplication.memberList; + +@Service +public class MemberService { + public Long register(MemberRegisterRequestDto request) { + Member newMember = new Member( + request.getName(), + request.getAge(), + request.getGender(), + request.getContact(), + request.isMarriage() + ); + + memberList.add(newMember); + newMember.setId((long)memberList.size()); + System.out.println(newMember.getId()); + + return newMember.getId(); + } + + public Member findOne(Long memberId) { + // Id로 회원 검색 + Member member = null; + + // memberList에서 입력 받은 memberId를 가진 객체 찾아서 반환 + for (Member targetMember : memberList) { + if (targetMember.getId().equals(memberId)){ + member = targetMember; + } + } + return member; + } + + public Member findByName(String name) { + // 이름으로 회원 검색 + Member member = null; + + for (Member targetMember : memberList) { + if (targetMember.getName().equals(name)){ + member = targetMember; + } + } + return member; + } + + public String edit(MemberUpdateRequestDto request) { + // 받아온 request 데이터를 토대로 수정할 Member 객체 찾아서 저장 + Member targetMember = findByName(request.getName()); + + // 회원 정보 수정 + targetMember.setName(request.getName()); + targetMember.setAge(request.getAge()); + targetMember.setGender(request.getGender()); + targetMember.setContact(request.getContact()); + targetMember.setMarriage(request.isMarriage()); + + return targetMember.getName(); + } + + public Boolean delete(String name) { + Member targetMember = findByName(name); + + if (targetMember == null) { + return false; + } + return memberList.remove(targetMember); + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/PostingService.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/PostingService.java new file mode 100644 index 0000000..57f31d8 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/PostingService.java @@ -0,0 +1,29 @@ +package sopt.org.SecondSeminar.service; + +import org.springframework.stereotype.Service; +import sopt.org.SecondSeminar.controller.user.dto.request.PostingRegisterRequestDto; +import sopt.org.SecondSeminar.domain.Posting; + +import static sopt.org.SecondSeminar.SecondSeminarApplication.postingList; + +@Service +public class PostingService { + public Long register(PostingRegisterRequestDto request) { + + // 받아온 request 데이터를 토대로 실제 Posting 객체 생성 + Posting newPosting = new Posting( + request.getTitle(), + request.getContext(), + request.getWriter(), + request.getTime() + ); + + postingList.add(newPosting); //1 + newPosting.setId((long) postingList.size()); //1 + + System.out.println(newPosting.getId()); + + // 저장한 게시물 아이디 값 반환 + return newPosting.getId(); + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/UserService.java b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/UserService.java new file mode 100644 index 0000000..1501dd5 --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/main/java/sopt/org/SecondSeminar/service/UserService.java @@ -0,0 +1,28 @@ +package sopt.org.SecondSeminar.service; + +import org.springframework.stereotype.Service; +import sopt.org.SecondSeminar.controller.user.dto.request.RegisterRequestDto; +import sopt.org.SecondSeminar.domain.User; + +import static sopt.org.SecondSeminar.SecondSeminarApplication.userList; + +@Service +public class UserService { + public Long register(RegisterRequestDto request) { + + // 받아온 request 데이터를 토대로 실제 User 객체 생성 + User newUser = new User( + request.getGender(), + request.getName(), + request.getContact(), + request.getAge() + ); + + // 데이터베이스에 저장 + userList.add(newUser); + newUser.setId((long) userList.size()); + + // 저장한 유저 아이디 값 반환 + return newUser.getId(); + } +} diff --git a/Week2/Seminar/SecondSeminar/src/main/resources/application.properties b/Week2/Seminar/SecondSeminar/src/main/resources/application.properties new file mode 100644 index 0000000..e69de29 diff --git a/Week2/Seminar/SecondSeminar/src/test/java/sopt/org/SecondSeminar/SecondSeminarApplicationTests.java b/Week2/Seminar/SecondSeminar/src/test/java/sopt/org/SecondSeminar/SecondSeminarApplicationTests.java new file mode 100644 index 0000000..f63a04c --- /dev/null +++ b/Week2/Seminar/SecondSeminar/src/test/java/sopt/org/SecondSeminar/SecondSeminarApplicationTests.java @@ -0,0 +1,13 @@ +package sopt.org.SecondSeminar; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class SecondSeminarApplicationTests { + + @Test + void contextLoads() { + } + +}