diff --git a/README.md b/README.md
index c9b06551..45100dd8 100644
--- a/README.md
+++ b/README.md
@@ -1,44 +1,58 @@
-## 모각코하기 좋은 카페 지도 애플리케이션, 모카콩(MOCACONG)
+# 모각코하기 좋은 카페 지도 애플리케이션, 모카콩
-코딩하기 좋은 카페만 모아놓은 지도는 없을까? 고민했다면 모카콩!
+[![App Store](https://img.shields.io/badge/App_Store-0D96F6?style=flat-square&logo=app-store&logoColor=white)](https://apps.apple.com/kr/app/mocacong/id6446925939)
+[![Google Play](https://img.shields.io/badge/Google_Play-414141?style=flat-square&logo=google-play&logoColor=white)](https://play.google.com/store/apps/details?id=com.konkuk.mocacong&hl=en-KR)
+[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fmocacong%2FMocacong-Backend&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
+[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=mocacong_Mocacong-Backend&metric=coverage)](https://sonarcloud.io/summary/new_code?id=mocacong_Mocacong-Backend)
+
-
-
-
-
-
+![Artboard](https://github.com/mocacong/Mocacong-Backend/assets/69844138/3c0c2962-a4e0-4136-8120-516c123c51c4)
+
+
+## 🔎 Introduction
+
+
+
+
+
+
+## 💻 Server Architecture
+### 📦 Dependency
+- Java 11, Junit 5
+- Spring Boot 2.7.9
+- MySQL
-- - -
+
-### MVP 기능
+### 🤲 AWS Architechture Diagram
-
+
-- - -
+
-### 사용 기술스택
-- `Language`: Java 11, JUnit 5
-- `Framework`: Spring Boot 2.7.9
-- `Database`: H2, Amazon RDS for MySQL, Amazon Elasticache for Redis
-- `ORM`: JPA (Spring Data JPA)
-- `Deploy`: Github Actions, Docker CI/CD
-- `Logging`: Logback, AWS Cloudwatch, AWS Lambda, Slack API
-- `API Docs`: SpringDoc Swagger 3
-- `Performance Test`: nGrinder
+### 🛠️ Tech Stack
+#### Framework -
+#### Database -
+#### ORM -
+#### Deploy -
+#### Logging -
+#### API Docs -
+#### Performance Test -
+#### Test -
-- - -
+
-### ERD
+## 🖇️ DataBase Schema
-
+
-- - -
+
-### 서비스 아키텍처
-
-
-
+## 🙋🏻♂️ Server Engineers
+| Taehyeon | Jisoo | Jungwoo |
+|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
+|
|
|
|
diff --git a/build.gradle b/build.gradle
index 0b06568b..2c48f224 100644
--- a/build.gradle
+++ b/build.gradle
@@ -38,6 +38,7 @@ dependencies {
implementation 'com.slack.api:slack-api-client:1.29.0'
implementation platform("org.springframework.cloud:spring-cloud-dependencies:2021.0.5")
implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
+ implementation 'com.google.guava:guava:32.1.3-jre'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
diff --git a/src/main/java/mocacong/server/support/AwsS3Uploader.java b/src/main/java/mocacong/server/support/AwsS3Uploader.java
index bc5db32b..4b486a8f 100644
--- a/src/main/java/mocacong/server/support/AwsS3Uploader.java
+++ b/src/main/java/mocacong/server/support/AwsS3Uploader.java
@@ -1,7 +1,13 @@
package mocacong.server.support;
import com.amazonaws.services.s3.AmazonS3Client;
-import com.amazonaws.services.s3.model.*;
+import com.amazonaws.services.s3.model.CannedAccessControlList;
+import com.amazonaws.services.s3.model.DeleteObjectsRequest;
+import com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion;
+import com.amazonaws.services.s3.model.DeleteObjectsResult;
+import com.amazonaws.services.s3.model.ObjectMetadata;
+import com.amazonaws.services.s3.model.PutObjectRequest;
+import com.google.common.collect.Lists;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
@@ -23,6 +29,8 @@
public class AwsS3Uploader {
private static final String S3_BUCKET_DIRECTORY_NAME = "static";
+ private static final int IMAGE_CHUNK_SIZE = 1000;
+
private final AmazonS3Client amazonS3Client;
@@ -36,7 +44,8 @@ public String uploadImage(MultipartFile multipartFile) {
objectMetadata.setContentType(multipartFile.getContentType());
objectMetadata.setContentLength(multipartFile.getSize());
- String fileName = S3_BUCKET_DIRECTORY_NAME + "/" + UUID.randomUUID() + "." + multipartFile.getOriginalFilename();
+ String fileName =
+ S3_BUCKET_DIRECTORY_NAME + "/" + UUID.randomUUID() + "." + multipartFile.getOriginalFilename();
try (InputStream inputStream = multipartFile.getInputStream()) {
amazonS3Client.putObject(new PutObjectRequest(bucket, fileName, inputStream, objectMetadata)
@@ -58,10 +67,15 @@ private void checkInvalidUploadFile(MultipartFile multipartFile) {
@EventListener
public void deleteImages(DeleteNotUsedImagesEvent event) {
List imgUrls = event.getImgUrls();
+ Lists.partition(imgUrls, IMAGE_CHUNK_SIZE)
+ .forEach(this::deleteImagesByChunk);
+ }
+
+ private void deleteImagesByChunk(List imgUrls) {
List keys = new ArrayList<>();
for (String imgUrl : imgUrls) {
String fileName = S3_BUCKET_DIRECTORY_NAME + imgUrl.substring(imgUrl.lastIndexOf("/"));
- keys.add(new DeleteObjectsRequest.KeyVersion(fileName));
+ keys.add(new KeyVersion(fileName));
}
DeleteObjectsRequest deleteObjectsRequest = new DeleteObjectsRequest(bucket).withKeys(keys);
DeleteObjectsResult result = amazonS3Client.deleteObjects(deleteObjectsRequest);