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

[PR] API 날리기 합치기 #11

Closed
wants to merge 14 commits into from
Closed
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
Binary file added .DS_Store
Binary file not shown.
Binary file modified App/.gradle/7.4.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified App/.gradle/7.4.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified App/.gradle/7.4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified App/.gradle/7.4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified App/.gradle/7.4.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file added App/.gradle/7.4.2/checksums/checksums.lock
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file added App/.gradle/7.4.2/fileChanges/last-build.bin
Binary file not shown.
Binary file added App/.gradle/7.4.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added App/.gradle/7.4.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file not shown.
Empty file added App/.gradle/7.4.2/gc.properties
Empty file.
Binary file modified App/.gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
4 changes: 2 additions & 2 deletions App/.gradle/buildOutputCleanup/cache.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#Thu Jun 09 14:34:49 KST 2022
gradle.version=7.4.1
#Sun Jun 12 20:04:52 KST 2022
gradle.version=7.4.2
Binary file modified App/.gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified App/.gradle/file-system.probe
Binary file not shown.
1 change: 1 addition & 0 deletions App/build/bootRunMainClassName
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.mylittlelib.app.AppApplication
Binary file modified App/build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion App/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file modified App/gradlew
100644 → 100755
Empty file.
178 changes: 89 additions & 89 deletions App/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
@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%" == "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%"=="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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@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%" == "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%"=="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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
33 changes: 33 additions & 0 deletions App/src/main/java/com/mylittlelib/app/DTO/BookmarkDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.mylittlelib.app.DTO;


import com.mylittlelib.app.model.Bookmark;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BookmarkDTO {

private Long bookmarkIndex;
private String bookmarkTitle;
private String description;
private String categorytitle;
private String bookmarkUrl;
//new
private String newbookmarkTitle;
private String newdescription;

public BookmarkDTO(Bookmark bookmark){
this.bookmarkIndex = bookmark.getBookmarkIndex();
this.bookmarkTitle = bookmark.getBookmarkTitle();
this.description = bookmark.getDescription();
this.categorytitle = bookmark.getCategory().getCategoryTitle();
this.bookmarkUrl = bookmark.getBookmarkurl();
}
}
22 changes: 22 additions & 0 deletions App/src/main/java/com/mylittlelib/app/DTO/CategoryDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mylittlelib.app.DTO;

import com.mylittlelib.app.model.Category;
import lombok.*;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CategoryDTO {
private Long categoryIndex;
private String categoryTitle;
private String userId;
private String newCategoryTitle;

public CategoryDTO(Category category) {
this.categoryIndex = category.getCategoryIndex();
this.categoryTitle = category.getCategoryTitle();
this.userId = category.getUser().getUserId();
}

}
15 changes: 15 additions & 0 deletions App/src/main/java/com/mylittlelib/app/DTO/ResponseDTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.mylittlelib.app.DTO;

import lombok.*;

import java.util.List;

@Builder
@NoArgsConstructor
@AllArgsConstructor
@Getter @Setter
@ToString
public class ResponseDTO<T> {
private String error;

}
18 changes: 13 additions & 5 deletions App/src/main/java/com/mylittlelib/app/DTO/UserDTO.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package com.mylittlelib.app.DTO;

import com.mylittlelib.app.model.Category;
import com.mylittlelib.app.model.Friend;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import java.util.List;
import java.util.Set;

@Getter
@Setter
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserDTO {
Expand All @@ -17,4 +20,9 @@ public class UserDTO {
private String userId;
private String password;
private String newPassword;
private boolean isSignin;

private String categoryList;
private Set<Friend> friendList;

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,77 @@
package com.mylittlelib.app.controller;

import com.mylittlelib.app.DTO.BookmarkDTO;
import com.mylittlelib.app.DTO.CategoryDTO;
import com.mylittlelib.app.DTO.ResponseDTO;
import com.mylittlelib.app.model.Bookmark;
import com.mylittlelib.app.model.Category;
import com.mylittlelib.app.service.BookmarkService;
import com.mylittlelib.app.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("bookmark")
public class BookmarkController {
@Autowired
BookmarkService bookmarkService;
@Autowired
CategoryService categoryService;
//like 생성자는 일단 보류
@GetMapping
public ResponseEntity<?> saveBookmark(@RequestBody BookmarkDTO bookmarkDTO){
try {
Category getCategory = categoryService.findByTitle(bookmarkDTO.getCategorytitle());
Bookmark bookmark = Bookmark.builder()
.bookmarkTitle(bookmarkDTO.getBookmarkTitle())
.description(bookmarkDTO.getDescription())
.category(getCategory)
.bookmarkurl(bookmarkDTO.getBookmarkUrl())
.build();
Bookmark registerBookmark = bookmarkService.save(bookmark);
BookmarkDTO responseBookmarkDTO = BookmarkDTO.builder()
.bookmarkIndex(registerBookmark.getBookmarkIndex())
.categorytitle(registerBookmark.getCategory().getCategoryTitle())
.bookmarkTitle(registerBookmark.getBookmarkTitle())
.description(registerBookmark.getDescription())
.bookmarkUrl(registerBookmark.getBookmarkurl())
.build();
return ResponseEntity.ok(responseBookmarkDTO);
} catch (Exception e) {
ResponseDTO responseDTO = ResponseDTO.builder().error(e.getMessage()).build();
return ResponseEntity.badRequest().body(responseDTO);
}
}
@PutMapping()
public ResponseEntity<?> updateBookmark(@RequestBody BookmarkDTO bookmarkDTO){
try {
Bookmark bookmark = bookmarkService.updateBookmark(bookmarkDTO);
BookmarkDTO responseBookmarkDTO = BookmarkDTO.builder()
.bookmarkIndex(bookmark.getBookmarkIndex())
.bookmarkTitle(bookmark.getBookmarkTitle())
.description(bookmark.getDescription())
.categorytitle(bookmark.getCategory().getCategoryTitle())
.bookmarkUrl(bookmark.getBookmarkurl())
.build();
return ResponseEntity.ok(responseBookmarkDTO);
}catch (Exception e){
ResponseDTO responseDTO = ResponseDTO.builder().error(e.getMessage()).build();
return ResponseEntity.badRequest().body(responseDTO);
}
}
@DeleteMapping()
public ResponseEntity<?> deleteBookmark(@RequestBody BookmarkDTO bookmarkDTO){
try{
List<Bookmark> bookmarks = bookmarkService.deleteBookmark(bookmarkDTO);
List<BookmarkDTO> dtos = bookmarks.stream().map(BookmarkDTO::new).collect(Collectors.toList());
return ResponseEntity.ok(dtos);
}catch (Exception e){
ResponseDTO responseDTO = ResponseDTO.builder().error(e.getMessage()).build();
return ResponseEntity.badRequest().body(responseDTO);
}
}
}
Loading