Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
HELP.md
.gradle
build/
gradle
.idea
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
Expand Down
Binary file added .gradle/9.2.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file added .gradle/9.2.1/fileHashes/fileHashes.lock
Binary file not shown.
9 changes: 8 additions & 1 deletion .idea/compiler.xml

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()
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class Category extends BaseEntity {
@Column(name = "is_deleted")
private boolean isDelelted;

@Column(name = "description")
private String description;

@Column(name = "deleted_at")
private LocalDateTime deletedAt;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import jakarta.persistence.*;
import lombok.*;
import ssurent.ssurentbe.common.base.BaseEntity;
import ssurent.ssurentbe.domain.item.enums.Condition;
import ssurent.ssurentbe.domain.item.enums.Status;

import java.time.LocalDateTime;
Expand Down Expand Up @@ -32,6 +33,10 @@ public class Items extends BaseEntity {
@Column(name = "status")
private Status status;

@Enumerated(EnumType.STRING)
@Column(name = "condition")
private Condition condition;

@Column(name = "is_deleted")
private boolean deleted;

Expand Down
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;
}
12 changes: 9 additions & 3 deletions src/main/java/ssurent/ssurentbe/domain/item/enums/Status.java
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
) {
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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 -10

Repository: SSURENT/SSURENT-BE

Length of output: 44


🏁 Script executed:

rg "RentalHistory\." --type java -A 2 | head -50

Repository: SSURENT/SSURENT-BE

Length of output: 44


🏁 Script executed:

rg "getItemId" --type java -B 2 -A 2

Repository: 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 위험 확인됨

rentalHistory.getItemId()가 null을 반환할 경우 Line 17에서 NullPointerException이 발생합니다. RentalHistory 엔티티의 itemId 필드는 @ManyToOne 관계이며 nullable=false 제약이 없어 null 값이 가능합니다.

유사한 패턴이 RentalItemResponse에도 존재하므로 일괄 수정이 필요합니다:

🛡️ 방어적 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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
);
}
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
);
}
🤖 Prompt for AI Agents
In
`@src/main/java/ssurent/ssurentbe/domain/rental/dto/response/AdminUserRentalItemResponse.java`
around lines 14 - 23, AdminUserRentalItemResponse.from currently calls
RentalHistory.getItemId() and immediately dereferences it
(Items.getName()/getItemNum()), which risks NPE; update
AdminUserRentalItemResponse.from to null-check rentalHistory.getItemId() and
produce a safe itemName (e.g., "Unknown Item" or empty values) when null,
ensuring the constructor still receives valid values; apply the same defensive
check/pattern to the similar factory in RentalItemResponse so both handle
nullable item relations safely; reference the methods/classes:
AdminUserRentalItemResponse.from, RentalHistory.getItemId, Items.getName,
Items.getItemNum, and RentalItemResponse when making the changes.

}
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
Expand Up @@ -44,4 +44,7 @@ public class RentalHistory extends BaseEntity {

@Column(name = "status")
private Status status;

@Column(name = "is_overdue")
private boolean overdue;
}
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 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 -20

Repository: 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.java

Repository: 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 -50

Repository: 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 f

Repository: 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 java

Repository: 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.java

Repository: SSURENT/SSURENT-BE

Length of output: 314


기존 enum 상수 참조는 없으나, 새 상수의 사용처도 없어 구현 완성도 검토 필요

RENT/RETURN 상수는 정의되었으나, 코드베이스 전체에서 이들을 사용하는 부분이 없습니다. RentalHistory 엔티티의 status 필드와 AdminRentalHistoryResponse의 status 필드가 정의되어 있지만, 실제로 상태를 설정하고 관리하는 서비스 계층이 보이지 않습니다.

enum 정의 후 이를 활용한 비즈니스 로직(대여 시 RENT 설정, 반납 시 RETURN 설정 등)의 구현이 필요합니다.

🤖 Prompt for AI Agents
In `@src/main/java/ssurent/ssurentbe/domain/rental/enums/Status.java` around lines
3 - 6, Status enum (Status.RENT/RETURN) is declared but never used; update the
service and mapping logic to set and persist these values: in the rental flow
implement or update methods like RentalService.rentItem(...) and
RentalService.returnItem(...) to assign RentalHistory.setStatus(Status.RENT) on
checkout and RentalHistory.setStatus(Status.RETURN) on checkin, save via
RentalHistoryRepository, and ensure AdminRentalHistoryResponse mapping (e.g., a
mapper or constructor that reads RentalHistory.getStatus()) returns the new enum
value; also add tests exercising both transitions and adjust any
DTOs/serializers to handle the Status enum.

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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

사용하지 않는 import 제거 필요

LocalDateTime이 import되어 있지만 레코드 내에서 사용되지 않습니다. 이전 리뷰에서 createdAt 필드가 제거되면서 남은 것으로 보입니다.

🧹 수정 제안
 package ssurent.ssurentbe.domain.users.dto.request;
 
-
-import java.time.LocalDateTime;
 
 public record AdminUserPenaltyCreateRequest (
         String itemName,
         String penaltyType
 ){
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import java.time.LocalDateTime;
package ssurent.ssurentbe.domain.users.dto.request;
public record AdminUserPenaltyCreateRequest (
String itemName,
String penaltyType
){
}
🤖 Prompt for AI Agents
In
`@src/main/java/ssurent/ssurentbe/domain/users/dto/request/AdminUserPenaltyCreateRequest.java`
at line 4, The import of LocalDateTime in AdminUserPenaltyCreateRequest is
unused after removal of the createdAt field; remove the unused import statement
(the "import java.time.LocalDateTime;" line) from the
AdminUserPenaltyCreateRequest record to clean up the code and eliminate the
unused-import warning.


public record AdminUserPenaltyCreateRequest (
String itemName,
String penaltyType
){
}
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
) {
}
Loading