Skip to content

Commit

Permalink
Merge pull request #77 from Team-KeepGoing/feature/book
Browse files Browse the repository at this point in the history
Edit :: error message
  • Loading branch information
priverg authored Aug 29, 2024
2 parents d33a9ff + 15d6062 commit 62ea58b
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@
import com.keepgoing.keepserver.domain.book.payload.request.BookRequestDto;
import com.keepgoing.keepserver.global.common.BaseResponse;
import org.springframework.security.core.Authentication;
import org.springframework.transaction.annotation.Transactional;

import java.io.IOException;

public interface BookService {
BaseResponse bookRegister(BookDto bookDto);
@Transactional(readOnly = true)
BaseResponse selectAllBook();
@Transactional(rollbackFor = Exception.class)
BaseResponse deleteBook(String nfcCode, Authentication auth);
BaseResponse selectMyBook(Authentication auth);
String createNfcCode();
@Transactional(rollbackFor = Exception.class)
BaseResponse editBook(String nfcCode, BookRequestDto bookRequest) throws IOException;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public BaseResponse rentDevice(String deviceName, String email) {
Device device = findDeviceByName(deviceName);
validateDeviceAvailability(device);
rentDeviceToUser(device, user);
return new BaseResponse(HttpStatus.OK, "기기 대여 성공", deviceMapper.entityToDto(device));
return new BaseResponse(HttpStatus.OK, "대여가 완료 되었습니다.", deviceMapper.entityToDto(device));
}

@Override
Expand All @@ -45,7 +45,7 @@ public BaseResponse rentBook(String nfcCode, String email) {
Book book = findBookByNfcCodeContaining(nfcCode);
validateBookAvailability(book);
rentBookToUser(book, user);
return new BaseResponse(HttpStatus.OK, "도서 대여 성공", bookMapper.entityToDto(book));
return new BaseResponse(HttpStatus.OK, "대여가 완료 되었습니다.", bookMapper.entityToDto(book));
}

private Device findDeviceByName(String deviceName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public BaseResponse returnDevice(String deviceName, String email) {
Device device = findDeviceByName(deviceName);
validateDeviceBorrower(device, user);
returnDeviceFromUser(device);
return new BaseResponse(HttpStatus.OK, "기기 반납 성공", deviceMapper.entityToDto(device));
return new BaseResponse(HttpStatus.OK, "반납이 완료 되었습니다.", deviceMapper.entityToDto(device));
}

@Override
Expand All @@ -43,7 +43,7 @@ public BaseResponse returnBook(String nfcCode, String email) {
Book book = findBookByNfcCodeContaining(nfcCode);
validateBookBorrower(book, user);
returnBookFromUser(book);
return new BaseResponse(HttpStatus.OK, "도서 반납 성공", bookMapper.entityToDto(book));
return new BaseResponse(HttpStatus.OK, "반납이 완료 되었습니다.", bookMapper.entityToDto(book));
}

private Device findDeviceByName(String deviceName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ public class Student {
@Column
private String imgUrl;
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public interface StudentRepository extends JpaRepository<Student, Long> {
Student findStudentById(Long id);
Student findStudentByStudentId(String studentId);
List<Student> findStudentsByStudentName(String name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
public class StudentFindDto {
String studentName;
String studentId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ public class StudentIdDto {
int grade;
int group;
int groupNum;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public class StudentRequestDto {
private String imgUrl;
private String address;
private String mail;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ public class StudentResponseDto {
String studentId;
String phoneNum;
String mail;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ public StudentResponseDto studentFormat(Student student) {
.imgUrl(student.getImgUrl())
.build();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.keepgoing.keepserver.domain.user.payload.request.SignupRequest;
import com.keepgoing.keepserver.domain.user.payload.request.UserInfoRequest;
import com.keepgoing.keepserver.domain.user.payload.request.UserProfileDto;
import com.keepgoing.keepserver.domain.user.payload.response.ApiResponse;
import com.keepgoing.keepserver.domain.user.payload.response.JwtResponse;
import com.keepgoing.keepserver.domain.user.service.user.UserService;
import com.keepgoing.keepserver.domain.user.service.user.UserServiceImpl;
import com.keepgoing.keepserver.global.exception.BusinessException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
Expand Down Expand Up @@ -48,4 +45,4 @@ public UserProfileDto provideUserInfo(Authentication authentication) {
public ResponseEntity<String> updateUserData(@RequestBody UserInfoRequest request, Authentication authentication) {
return userService.updateUserData(request, authentication);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
@RequiredArgsConstructor
public enum BookError implements ErrorProperty {
USER_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 유저를 찾을 수 없습니다."),
BOOK_NOT_FOUND_EXCEPTION(HttpStatus.NOT_FOUND, "해당 도서 찾을 수 없습니다."),
BOOK_NOT_FOUND_EXCEPTION(HttpStatus.NOT_FOUND, "유효하지 않은 NFC 입니다."),
IMAGE_UPLOAD_FAILED(HttpStatus.INTERNAL_SERVER_ERROR, "사진 업로드 중 오류가 발생하였습니다."),
BOOK_NOT_AVAILABLE(HttpStatus.BAD_REQUEST, "도서를 대여할 수 없습니다."),
BOOK_NOT_AVAILABLE(HttpStatus.BAD_REQUEST, "이미 대여 중인 도서입니다."),
INVALID_BORROWER(HttpStatus.BAD_REQUEST, "반납 요청자가 기기의 대여자가 아닙니다.");
private final HttpStatus status;
private final String message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@RequiredArgsConstructor
public enum DeviceError implements ErrorProperty {
USER_NOT_FOUND(HttpStatus.NOT_FOUND, "해당 유저를 찾을 수 없습니다."),
DEVICE_NOT_FOUND_EXCEPTION(HttpStatus.NOT_FOUND, "해당 기기를 찾을 수 없습니다."),
DEVICE_NOT_AVAILABLE(HttpStatus.BAD_REQUEST, "기기를 대여할 수 없습니다."),
DEVICE_NOT_FOUND_EXCEPTION(HttpStatus.NOT_FOUND, "유효하지 않은 NFC 입니다."),
DEVICE_NOT_AVAILABLE(HttpStatus.BAD_REQUEST, "이미 대여 중인 기기입니다."),
INVALID_BORROWER(HttpStatus.BAD_REQUEST, "반납 요청자가 기기의 대여자가 아닙니다.");
private final HttpStatus status;
private final String message;
Expand Down

0 comments on commit 62ea58b

Please sign in to comment.