Skip to content

Commit 9474f4b

Browse files
Refactor: 이미지 정합성 개선
Refactor: 이미지 정합성 개선
2 parents 81daaa7 + 091c795 commit 9474f4b

42 files changed

Lines changed: 1365 additions & 670 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/project/flipnote/auth/model/UserRegisterRequest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ public record UserRegisterRequest(
2525
Boolean smsAgree,
2626

2727
@ValidPhone
28-
String phone,
29-
30-
String profileImageUrl
28+
String phone
3129
) {
3230

3331
public String getNormalizedPhone() {
3432
return PhoneUtil.normalize(phone);
3533
}
3634

3735
public UserCreateCommand toCommand() {
38-
return new UserCreateCommand(email, name, nickname, smsAgree, getNormalizedPhone(), profileImageUrl);
36+
return new UserCreateCommand(email, name, nickname, smsAgree, getNormalizedPhone());
3937
}
4038
}

src/main/java/project/flipnote/cardset/entity/CardSet.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ public class CardSet extends BaseEntity {
4545

4646
private String hashtag;
4747

48-
@Column(nullable = false)
4948
private String imageUrl;
5049

5150
@Builder

src/main/java/project/flipnote/common/config/SchedulerConfig.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,34 @@
22

33
import org.springframework.context.annotation.Configuration;
44
import org.springframework.scheduling.annotation.EnableScheduling;
5+
import org.springframework.scheduling.annotation.Scheduled;
56

7+
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
8+
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
9+
10+
import lombok.RequiredArgsConstructor;
11+
import project.flipnote.image.service.ImageCleanService;
12+
13+
@RequiredArgsConstructor
614
@EnableScheduling
715
@Configuration
816
public class SchedulerConfig {
17+
18+
private final ImageCleanService imageCleanService;
19+
20+
//이미지 참조 제거
21+
@Scheduled(cron = "0 0 23 * * *", zone = "Asia/Seoul")
22+
// @Scheduled(cron = "0 * * * * *", zone = "Asia/Seoul")
23+
@SchedulerLock(name = "image.cleanImageRef", lockAtMostFor = "PT2M")
24+
public void cleanImageRef() {
25+
imageCleanService.cleanImageRef();
26+
}
27+
28+
//이미지 제거
29+
@Scheduled(cron = "0 30 23 * * 0", zone = "Asia/Seoul")
30+
@SchedulerLock(name = "image.cleanImage", lockAtMostFor = "PT2M")
31+
// @Scheduled(cron = "30 */2 * * * *", zone = "Asia/Seoul")
32+
public void cleanImage() {
33+
imageCleanService.cleanImage();
34+
}
935
}

src/main/java/project/flipnote/common/model/request/UserCreateCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ public record UserCreateCommand(
55
String name,
66
String nickname,
77
Boolean smsAgree,
8-
String phone,
9-
String profileImageUrl
8+
String phone
109
) {
1110

1211
}

src/main/java/project/flipnote/group/controller/docs/GroupControllerDocs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ResponseEntity<GroupCreateResponse> create(
5959
"applicationRequired": true,
6060
"publicVisible": true,
6161
"maxMember": 20,
62-
"image": "https://cdn.example.com/group/cover.jpg"
62+
"imageRefId": 1
6363
}
6464
""")
6565
)
@@ -111,7 +111,7 @@ ResponseEntity<GroupPutResponse> changeGroup(
111111
"applicationRequired": false,
112112
"publicVisible": true,
113113
"maxMember": 30,
114-
"image": "https://cdn.example.com/group/cover_v2.png"
114+
"imageRefId": 1
115115
}
116116
""")
117117
)

src/main/java/project/flipnote/group/entity/Group.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ public void increaseMemberCount() {
107107
memberCount++;
108108
}
109109

110-
public void changeGroup(GroupPutRequest req) {
110+
public void changeGroup(GroupPutRequest req, String url) {
111111
this.name = req.name();
112112
this.category = req.category();
113113
this.description = req.description();
114114
this.applicationRequired = req.applicationRequired();
115115
this.publicVisible = req.publicVisible();
116116
this.maxMember = req.maxMember();
117-
this.imageUrl = req.image();
117+
this.imageUrl = url;
118118
}
119119
}

src/main/java/project/flipnote/group/model/GroupCreateRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public record GroupCreateRequest(
2828
@Max(value = 100, message = "최대 인원 수는 100명을 초과할 수 없습니다.")
2929
Integer maxMember,
3030

31-
@URL(message = "이미지 URL 형식이 올바르지 않습니다.")
32-
String image
31+
// @NotNull(message = "이미지 참조 id를 입력해주세요.")
32+
Long imageRefId
3333
) {
3434
}

src/main/java/project/flipnote/group/model/GroupDetailResponse.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,23 @@ public record GroupDetailResponse(
1919

2020
Integer maxMember,
2121

22+
Long imageRefId,
23+
2224
String imageUrl,
2325

2426
LocalDateTime createdAt,
2527

2628
LocalDateTime modifiedAt
2729
) {
28-
public static GroupDetailResponse from(Group group) {
30+
public static GroupDetailResponse from(Group group, Long imageRefId) {
2931
return new GroupDetailResponse(
3032
group.getName(),
3133
group.getCategory(),
3234
group.getDescription(),
3335
group.getApplicationRequired(),
3436
group.getPublicVisible(),
3537
group.getMaxMember(),
38+
imageRefId,
3639
group.getImageUrl(),
3740
group.getCreatedAt(),
3841
group.getModifiedAt()

src/main/java/project/flipnote/group/model/GroupInfo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ public record GroupInfo(
77
String name,
88
String description,
99
Category category,
10-
String imageUrl) {
11-
public static GroupInfo from(Long groupId, String name, String description, Category category, String imageUrl) {
12-
return new GroupInfo(groupId, name, description, category, imageUrl);
10+
String imageUrl,
11+
Long imageRefId) {
12+
public static GroupInfo from(Long groupId, String name, String description, Category category, String imageUrl, Long imageRefId) {
13+
return new GroupInfo(groupId, name, description, category, imageUrl, imageRefId);
1314
}
1415
}

src/main/java/project/flipnote/group/model/GroupPutRequest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public record GroupPutRequest(
3232
@Max(value = 100, message = "최대 인원 수는 100명을 초과할 수 없습니다.")
3333
Integer maxMember,
3434

35-
@URL(message = "이미지 URL 형식이 올바르지 않습니다.")
36-
String image
35+
Long imageRefId
3736
) {
3837
}

0 commit comments

Comments
 (0)