@@ -0,0 +1,52 @@
+package com.doubleowner.revibe.domain.point;
+
+import com.doubleowner.revibe.domain.user.entity.User;
+import com.doubleowner.revibe.domain.user.repository.UserRepository;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+@Service
+@RequiredArgsConstructor
+public class PointService {
+    private final UserRepository userRepository;
+
+    @Transactional
+    public void addReviewPoint(User user, String image) {
+        int point = PointPolicy.TEXT_ONLY_POINT.getPoint();
+        if (image != null) {
+            point = PointPolicy.TEXT_IMAGE_POINT.getPoint();
+        }
+        User findUser = userRepository.findByEmailOrElseThrow(user.getEmail());
+        findUser.addPoint(point);
+
+
+    }
+
+    @Transactional
+    public void handlePoint(User user, String preImage, MultipartFile afterImage) {
+
+        int pointChange = 0;
+        if (preImage != null && afterImage == null) {
+            pointChange = PointPolicy.TEXT_ONLY_POINT.getPoint() - PointPolicy.TEXT_IMAGE_POINT.getPoint();
+        } else if (preImage == null && afterImage != null) {
+            pointChange = PointPolicy.TEXT_IMAGE_POINT.getPoint() - PointPolicy.TEXT_ONLY_POINT.getPoint();
+        }
+        if (pointChange != 0) {
+            User findUser = userRepository.findByEmailOrElseThrow(user.getEmail());
+            findUser.addPoint(pointChange);
+        }
+    }
+
+    @Transactional
+    public void deletePoint(User user, String image) {
+        int point = (image != null)
+                ? PointPolicy.TEXT_IMAGE_POINT.getPoint()
+                : PointPolicy.TEXT_ONLY_POINT.getPoint();
+
+        User findUser = userRepository.findByEmailOrElseThrow(user.getEmail());
+        findUser.addPoint(-point);  // 포인트 차감
+    }
+}
+

리뷰: _:hammer_and_wrench: Refactor suggestion_

**포인트 차감 로직 개선 필요**

포인트 차감 로직에 대한 개선사항입니다:

1. 삭제 시 포인트가 음수가 되는 경우에 대한 처리가 필요합니다.
2. 코드 가독성 개선이 필요합니다.

다음과 같이 개선해보시는 것은 어떨까요:

```diff
 @Transactional
 public void deletePoint(User user, String image) {
+    if (user == null) {
+        throw new IllegalArgumentException("사용자 정보가 없습니다.");
+    }
-    int point = (image != null)
-            ? PointPolicy.TEXT_IMAGE_POINT.getPoint()
-            : PointPolicy.TEXT_ONLY_POINT.getPoint();
+    int pointToDeduct = calculatePointToDeduct(image);
     User findUser = userRepository.findByEmailOrElseThrow(user.getEmail());
-    findUser.addPoint(-point);  // 포인트 차감
+    if (findUser.getPoint() < pointToDeduct) {
+        throw new IllegalStateException("차감할 포인트가 보유 포인트보다 많습니다.");
+    }
+    findUser.addPoint(-pointToDeduct);
 }

+private int calculatePointToDeduct(String image) {
+    return image != null 
+        ? PointPolicy.TEXT_IMAGE_POINT.getPoint()
+        : PointPolicy.TEXT_ONLY_POINT.getPoint();
+}
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **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.

`````suggestion
    @Transactional
    public void deletePoint(User user, String image) {
        if (user == null) {
            throw new IllegalArgumentException("사용자 정보가 없습니다.");
        }
        int pointToDeduct = calculatePointToDeduct(image);
        User findUser = userRepository.findByEmailOrElseThrow(user.getEmail());
        if (findUser.getPoint() < pointToDeduct) {
            throw new IllegalStateException("차감할 포인트가 보유 포인트보다 많습니다.");
        }
        findUser.addPoint(-pointToDeduct);
    }

    private int calculatePointToDeduct(String image) {
        return image != null 
            ? PointPolicy.TEXT_IMAGE_POINT.getPoint()
            : PointPolicy.TEXT_ONLY_POINT.getPoint();
    }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->