-
Notifications
You must be signed in to change notification settings - Fork 0
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
도서 신청 조회 api #45
Merged
Merged
도서 신청 조회 api #45
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...ain/java/com/mindway/server/v2/domain/order/presentation/dto/response/OrdersResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.mindway.server.v2.domain.order.presentation.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class OrdersResponse { | ||
private String title; | ||
private String author; | ||
private String book_url; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/mindway/server/v2/domain/order/service/GetBookOrdersService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.mindway.server.v2.domain.order.service; | ||
|
||
import com.mindway.server.v2.domain.order.presentation.dto.response.OrdersResponse; | ||
|
||
import java.util.List; | ||
|
||
public interface GetBookOrdersService { | ||
List<OrdersResponse> execute(); | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/mindway/server/v2/domain/order/service/impl/GetBookOrdersServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.mindway.server.v2.domain.order.service.impl; | ||
|
||
import com.mindway.server.v2.domain.order.exception.NotAccessStudentException; | ||
import com.mindway.server.v2.domain.order.presentation.dto.response.OrdersResponse; | ||
import com.mindway.server.v2.domain.order.repository.OrdersRepository; | ||
import com.mindway.server.v2.domain.order.service.GetBookOrdersService; | ||
import com.mindway.server.v2.domain.order.util.OrdersConverter; | ||
import com.mindway.server.v2.domain.user.entity.Authority; | ||
import com.mindway.server.v2.domain.user.entity.User; | ||
import com.mindway.server.v2.domain.user.util.UserUtil; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true, rollbackFor = {Exception.class}) | ||
public class GetBookOrdersServiceImpl implements GetBookOrdersService { | ||
private final UserUtil userUtil; | ||
private final OrdersRepository ordersRepository; | ||
private final OrdersConverter ordersConverter; | ||
|
||
@Override | ||
public List<OrdersResponse> execute() { | ||
User user = userUtil.getCurrentUser(); | ||
|
||
if (user.getAuthority() != Authority.ROLE_TEACHER | ||
&& user.getAuthority() != Authority.ROLE_HELPER) { | ||
throw new NotAccessStudentException(); | ||
} | ||
|
||
return ordersRepository.findAll().stream() | ||
.map(ordersConverter::toDto) | ||
.collect(Collectors.toList()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bookOrders라는 메서드만 봐서는 무슨 역할을 하는 메서드인지 모르겠어요..
이름 다시 생각해보시는게 좋을거같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0837399
신청도서 불러오는거라 getBookOrders로 바꿨는데 이건 어떤거 같나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
직관적이고 좋은 거 같아용