-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] DTO 추가, 엔티티 변경 #7
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
Changes from all commits
9b8883a
5295e0c
9ae087c
66161b7
7022b15
4d3c080
a0f1a4f
c8b5eb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package ssurent.ssurentbe.domain.assists.dto.request; | ||
|
|
||
| public record AdminAssistCreateRequest( | ||
| String assistName | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package ssurent.ssurentbe.domain.assists.dto.response; | ||
|
|
||
| public record AdminAssistResponse( | ||
| Long assistId, | ||
| String assistName | ||
| ) { | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.request; | ||
|
|
||
| public record AdminCategoryCreateRequest( | ||
| String categoryName | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.request; | ||
|
|
||
| public record AdminItemCreateRequest( | ||
| String categoryName, | ||
| String itemNum | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.request; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record AdminItemUpdateRequest( | ||
| List<ItemUpdate> itemUpdates | ||
| ) { | ||
| public record ItemUpdate( | ||
| Long itemId, | ||
| String status | ||
| ){ | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.response; | ||
|
|
||
| public record AdminItemNameSearchResponse( | ||
| Long itemId, | ||
| String itemName | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.response; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record AdminItemResponse( | ||
| Long categoryId, | ||
| String categoryName, | ||
| List<ItemResponse> items | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.response; | ||
|
|
||
| import ssurent.ssurentbe.domain.item.enums.Condition; | ||
|
|
||
| public record AdminItemSearchResponse( | ||
| Long itemId, | ||
| String itemName, | ||
| Condition condition | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.response; | ||
|
|
||
| import ssurent.ssurentbe.domain.item.entity.Category; | ||
|
|
||
| public record CategoryResponse( | ||
| Long categoryId, | ||
| String categoryName | ||
| ) { | ||
| public static CategoryResponse from(Category category) { | ||
| return new CategoryResponse( | ||
| category.getId(), | ||
| category.getName() | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package ssurent.ssurentbe.domain.item.dto.response; | ||
|
|
||
| import ssurent.ssurentbe.domain.item.entity.Items; | ||
| import ssurent.ssurentbe.domain.item.enums.Condition; | ||
| import ssurent.ssurentbe.domain.item.enums.Status; | ||
|
|
||
| public record ItemResponse( | ||
| Long itemId, | ||
| String itemName, | ||
| String itemDescription, | ||
| Status status, | ||
| Condition condition | ||
| ) { | ||
| public static ItemResponse from(Items item) { | ||
| String ItemName = item.getName() + "(" + item.getItemNum() + ")"; | ||
| return new ItemResponse( | ||
| item.getId(), | ||
| item.getName(), | ||
| ItemName, | ||
| item.getStatus(), | ||
| item.getCondition() | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package ssurent.ssurentbe.domain.item.enums; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
|
|
||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum Condition { | ||
| RENT("대여 중"), | ||
| KEEP("보관 중"), | ||
| OVERDUE("연체 중"); | ||
|
|
||
| private String description; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| package ssurent.ssurentbe.domain.item.enums; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @AllArgsConstructor | ||
| public enum Status { | ||
| ACTIVE, | ||
| FIXING, | ||
| INACTIVE | ||
| ACTIVE("대여 가능"), | ||
| INACTIVE("대여 불가"); | ||
|
|
||
| private String description; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.request; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record AdminRentalUpdateRequest( | ||
| List<RentalUpdate> rentalUpdates | ||
| ) { | ||
| public record RentalUpdate( | ||
| Long rentalId, | ||
| boolean returned | ||
| ){ | ||
|
|
||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.request; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| public record RentalExtendRequest( | ||
| Long rentalId, | ||
| LocalDateTime dueDate | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.request; | ||
|
|
||
| public record RentalReportRequest( | ||
| Long rentalId, | ||
| String problem | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.request; | ||
|
|
||
| public record RentalRequest( | ||
| Long itemId, | ||
| String assistName | ||
| ){ | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.request; | ||
|
|
||
| public record RentalReturnRequest( | ||
| Long itemId, | ||
| Long rentalId, | ||
| String assistName | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.response; | ||
|
|
||
| import ssurent.ssurentbe.domain.rental.entity.RentalHistory; | ||
| import ssurent.ssurentbe.domain.rental.enums.Status; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| // 서비스 로직 단에서 Status = 에 따라서 List 내부에 구성. | ||
| // Status = 대여 -> timeStamp = created_At 인 데이터 1개 제공 | ||
| // Status = 반납 -> timeStamp = created_At(대여) , timeStamp = updated_At(반납)인 데이터 2개 제공 | ||
| public record AdminRentalHistoryResponse( | ||
| Long rentalId, | ||
| LocalDateTime timeStamp, | ||
| String name, | ||
| String studentNum, | ||
| String phNum, | ||
| Status status, | ||
| String itemName, | ||
| String itemNum, | ||
| boolean isOverdue | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| package ssurent.ssurentbe.domain.rental.dto.response; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| import ssurent.ssurentbe.domain.item.entity.Items; | ||||||||||||||||||||||||||||||||||||||||||||||||
| import ssurent.ssurentbe.domain.rental.entity.RentalHistory; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| public record AdminUserRentalItemResponse( | ||||||||||||||||||||||||||||||||||||||||||||||||
| Long rentalId, | ||||||||||||||||||||||||||||||||||||||||||||||||
| LocalDateTime rentalDate, | ||||||||||||||||||||||||||||||||||||||||||||||||
| LocalDateTime returnDate, | ||||||||||||||||||||||||||||||||||||||||||||||||
| String itemName | ||||||||||||||||||||||||||||||||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| public static AdminUserRentalItemResponse from(RentalHistory rentalHistory) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| Items items = rentalHistory.getItemId(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| String itemName = items.getName() + "(" + items.getItemNum() + ")"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| return new AdminUserRentalItemResponse( | ||||||||||||||||||||||||||||||||||||||||||||||||
| rentalHistory.getId(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| rentalHistory.getRentalDate(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| rentalHistory.getReturnDate(), | ||||||||||||||||||||||||||||||||||||||||||||||||
| itemName | ||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: fd -e java "RentalHistory\.java" --exec cat -n {} \;Repository: SSURENT/SSURENT-BE Length of output: 1704 🏁 Script executed: fd -e sql -e yml -e yaml | xargs grep -l "rental_history\|item_id" | head -10Repository: SSURENT/SSURENT-BE Length of output: 44 🏁 Script executed: rg "RentalHistory\." --type java -A 2 | head -50Repository: SSURENT/SSURENT-BE Length of output: 44 🏁 Script executed: rg "getItemId" --type java -B 2 -A 2Repository: SSURENT/SSURENT-BE Length of output: 1930 🏁 Script executed: rg "from\(RentalHistory" --type java -A 5 | grep -E "(from|getItemId|getName|getItem)"Repository: SSURENT/SSURENT-BE Length of output: 1125 null 체크 추가 필수 - NPE 위험 확인됨
유사한 패턴이 🛡️ 방어적 null 체크 추가 public static AdminUserRentalItemResponse from(RentalHistory rentalHistory) {
Items items = rentalHistory.getItemId();
+ if (items == null) {
+ throw new IllegalArgumentException("RentalHistory must have an associated Item");
+ }
String itemName = items.getName() + "(" + items.getItemNum() + ")";
return new AdminUserRentalItemResponse(
rentalHistory.getId(),
rentalHistory.getRentalDate(),
rentalHistory.getReturnDate(),
itemName
);
}부가 사항: getItemId()가 실제로 Items 엔티티를 반환하므로 메서드명이 명확하지 않습니다. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package ssurent.ssurentbe.domain.rental.dto.response; | ||
|
|
||
| import ssurent.ssurentbe.domain.item.entity.Items; | ||
| import ssurent.ssurentbe.domain.rental.entity.RentalHistory; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| public record RentalItemResponse( | ||
| Long rentalId, | ||
| Long itemId, | ||
| String itemName, | ||
| LocalDateTime dueDate | ||
| ) { | ||
| public static RentalItemResponse from(RentalHistory rentalHistory) { | ||
| Items items = rentalHistory.getItemId(); | ||
| String itemName = items.getName() + "(" + items.getItemNum() + ")"; | ||
| return new RentalItemResponse( | ||
| rentalHistory.getId(), | ||
| rentalHistory.getItemId().getId(), | ||
| itemName, | ||
| rentalHistory.getDueDate() | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| package ssurent.ssurentbe.domain.rental.enums; | ||
|
|
||
| public enum Status { | ||
| ACTIVE, | ||
| OVERDUE, | ||
| INACTIVE | ||
| RENT, | ||
| RETURN | ||
| } | ||
|
Comment on lines
3
to
6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify Status enum constant updates
echo "=== Checking for references to old enum constants ==="
rg -n "Status\.(ACTIVE|OVERDUE|INACTIVE)" --type java
echo ""
echo "=== Checking for references to new enum constants ==="
rg -n "Status\.(RENT|RETURN)" --type java
echo ""
echo "=== Checking for Status enum import statements ==="
rg -n "import.*Status" --type java | head -20Repository: SSURENT/SSURENT-BE Length of output: 2816 🏁 Script executed: #!/bin/bash
# Check the users Status enum definition
echo "=== Users Status enum definition ==="
cat -n src/main/java/ssurent/ssurentbe/domain/users/enums/Status.java
echo ""
echo "=== RentalHistory entity to see Status usage ==="
cat -n src/main/java/ssurent/ssurentbe/domain/rental/entity/RentalHistory.java
echo ""
echo "=== AuthService.java around line 39 ==="
sed -n '35,45p' src/main/java/ssurent/ssurentbe/domain/users/service/AuthService.javaRepository: SSURENT/SSURENT-BE Length of output: 2377 🏁 Script executed: #!/bin/bash
# Check where rental Status is being used
echo "=== AdminRentalHistoryResponse (imports rental Status) ==="
cat -n src/main/java/ssurent/ssurentbe/domain/rental/dto/response/AdminRentalHistoryResponse.java
echo ""
echo "=== Search for RentalHistory instantiation with status field ==="
rg -n "RentalHistory.*builder\|\.status\(" --type java -A 2 -B 2 | head -50Repository: SSURENT/SSURENT-BE Length of output: 696 🏁 Script executed: #!/bin/bash
# Search for status field usage in rental domain
echo "=== Search for status assignments in rental domain ==="
rg -n "\.status\|status\s*=" src/main/java/ssurent/ssurentbe/domain/rental/ --type java
echo ""
echo "=== List rental domain files ==="
find src/main/java/ssurent/ssurentbe/domain/rental -name "*.java" -type fRepository: SSURENT/SSURENT-BE Length of output: 966 🏁 Script executed: #!/bin/bash
# Check if there are service classes in rental domain
echo "=== Find service/repository classes ==="
find src/main/java/ssurent/ssurentbe/domain/rental -name "*Service.java" -o -name "*Repository.java"
echo ""
echo "=== Search all files for Status.RENT or Status.RETURN ==="
rg -n "Status\.(RENT|RETURN)" --type javaRepository: SSURENT/SSURENT-BE Length of output: 160 🏁 Script executed: #!/bin/bash
# Check if rental service/repository might be in a different location
echo "=== Search entire codebase for Rental service/repository ==="
find src -name "*Rental*Service.java" -o -name "*Rental*Repository.java" 2>/dev/null
echo ""
echo "=== Verify the new Status enum constants are defined ==="
cat -n src/main/java/ssurent/ssurentbe/domain/rental/enums/Status.javaRepository: SSURENT/SSURENT-BE Length of output: 314 기존 enum 상수 참조는 없으나, 새 상수의 사용처도 없어 구현 완성도 검토 필요 RENT/RETURN 상수는 정의되었으나, 코드베이스 전체에서 이들을 사용하는 부분이 없습니다. RentalHistory 엔티티의 status 필드와 AdminRentalHistoryResponse의 status 필드가 정의되어 있지만, 실제로 상태를 설정하고 관리하는 서비스 계층이 보이지 않습니다. enum 정의 후 이를 활용한 비즈니스 로직(대여 시 RENT 설정, 반납 시 RETURN 설정 등)의 구현이 필요합니다. 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||||||||||||
| package ssurent.ssurentbe.domain.users.dto.request; | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 사용하지 않는 import 제거 필요
🧹 수정 제안 package ssurent.ssurentbe.domain.users.dto.request;
-
-import java.time.LocalDateTime;
public record AdminUserPenaltyCreateRequest (
String itemName,
String penaltyType
){
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| public record AdminUserPenaltyCreateRequest ( | ||||||||||||||||||
| String itemName, | ||||||||||||||||||
| String penaltyType | ||||||||||||||||||
| ){ | ||||||||||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
| } | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| package ssurent.ssurentbe.domain.users.dto.request; | ||
|
|
||
| import ssurent.ssurentbe.domain.users.enums.Role; | ||
|
|
||
| public record AdminUserRoleUpdateRequest( | ||
| Long userId, | ||
| Role role | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package ssurent.ssurentbe.domain.users.dto.request; | ||
|
|
||
| import ssurent.ssurentbe.domain.users.enums.Status; | ||
|
|
||
| public record AdminUserStatusUpdateRequest( | ||
| Status status | ||
| ) { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| package ssurent.ssurentbe.domain.users.dto.request; | ||
|
|
||
| public record UserPhoneNumberRequest( | ||
| String phoneNum | ||
| ) { | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.