Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
64454fa
Feat: 이미지 엔티티 추가
stoneTiger0912 Sep 1, 2025
a137cab
Feat: 이미지 엔티티 추가
stoneTiger0912 Sep 5, 2025
36749bb
Feat: 이미지 업로드시 image 참조 테이블 추가
stoneTiger0912 Sep 7, 2025
5b2990a
Refactor: 그룹 생성시 이미지 저장하는 과정 리팩토링
stoneTiger0912 Sep 8, 2025
1aa8eab
Refactor: 그룹 생성시 이미지 저장하는 과정 리팩토링
stoneTiger0912 Sep 8, 2025
9c41419
Refactor: 이미지 조회시 image 엔티티에서 조회하도록 변경
stoneTiger0912 Sep 8, 2025
fb5b6d3
Refactor: 그룹 생성 및 수정시 이미지 상태 변경 추가
stoneTiger0912 Sep 9, 2025
d448dba
Refactor: 소프트 삭제 제거
stoneTiger0912 Sep 11, 2025
c0f5839
Feat: 이미지 및 이미지 참조 스케줄러 추가
stoneTiger0912 Sep 11, 2025
4e4aff3
Feat: 스케쥴링 시간 변경
stoneTiger0912 Sep 11, 2025
0018262
Feat: 그룹 삭제 시 이미지 참조 삭제
stoneTiger0912 Sep 11, 2025
903494a
Feat: 이미지 삭제 설정 추가
stoneTiger0912 Sep 11, 2025
42aa9f8
Feat: 조회시 이미지 참조 아이디와 함께 반환
stoneTiger0912 Sep 15, 2025
fc6a7a9
Fix: 락 설정 수정
stoneTiger0912 Sep 15, 2025
5e6345f
Fix: S3키 크기 수정
stoneTiger0912 Sep 15, 2025
87b677c
Fix: transactional 추가
stoneTiger0912 Sep 15, 2025
bb9c290
Fix: default 이미지 생성할 때 서비스에서 넣는 것으로 수정
stoneTiger0912 Sep 15, 2025
b4f8d99
Fix: 요청값 응답값으로 에코 요청 수정
stoneTiger0912 Sep 15, 2025
b83dd13
Fix: 이미지 참조 유니크 값 추가
stoneTiger0912 Sep 15, 2025
091c795
Feat: nullable허용
stoneTiger0912 Sep 18, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ public record UserRegisterRequest(
Boolean smsAgree,

@ValidPhone
String phone,

String profileImageUrl
String phone
) {

public String getNormalizedPhone() {
return PhoneUtil.normalize(phone);
}

public UserCreateCommand toCommand() {
return new UserCreateCommand(email, name, nickname, smsAgree, getNormalizedPhone(), profileImageUrl);
return new UserCreateCommand(email, name, nickname, smsAgree, getNormalizedPhone());
}
}
1 change: 0 additions & 1 deletion src/main/java/project/flipnote/cardset/entity/CardSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class CardSet extends BaseEntity {

private String hashtag;

@Column(nullable = false)
private String imageUrl;

@Builder
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/project/flipnote/common/config/SchedulerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,34 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;

import lombok.RequiredArgsConstructor;
import project.flipnote.image.service.ImageCleanService;

@RequiredArgsConstructor
@EnableScheduling
@Configuration
public class SchedulerConfig {

private final ImageCleanService imageCleanService;

//이미지 참조 제거
@Scheduled(cron = "0 0 23 * * *", zone = "Asia/Seoul")
// @Scheduled(cron = "0 * * * * *", zone = "Asia/Seoul")
@SchedulerLock(name = "image.cleanImageRef", lockAtMostFor = "PT2M")
public void cleanImageRef() {
imageCleanService.cleanImageRef();
}

//이미지 제거
@Scheduled(cron = "0 30 23 * * 0", zone = "Asia/Seoul")
@SchedulerLock(name = "image.cleanImage", lockAtMostFor = "PT2M")
// @Scheduled(cron = "30 */2 * * * *", zone = "Asia/Seoul")
public void cleanImage() {
imageCleanService.cleanImage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ public record UserCreateCommand(
String name,
String nickname,
Boolean smsAgree,
String phone,
String profileImageUrl
String phone
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ResponseEntity<GroupCreateResponse> create(
"applicationRequired": true,
"publicVisible": true,
"maxMember": 20,
"image": "https://cdn.example.com/group/cover.jpg"
"imageRefId": 1
}
""")
)
Expand Down Expand Up @@ -111,7 +111,7 @@ ResponseEntity<GroupPutResponse> changeGroup(
"applicationRequired": false,
"publicVisible": true,
"maxMember": 30,
"image": "https://cdn.example.com/group/cover_v2.png"
"imageRefId": 1
}
""")
)
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/project/flipnote/group/entity/Group.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ public void increaseMemberCount() {
memberCount++;
}

public void changeGroup(GroupPutRequest req) {
public void changeGroup(GroupPutRequest req, String url) {
this.name = req.name();
this.category = req.category();
this.description = req.description();
this.applicationRequired = req.applicationRequired();
this.publicVisible = req.publicVisible();
this.maxMember = req.maxMember();
this.imageUrl = req.image();
this.imageUrl = url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public record GroupCreateRequest(
@Max(value = 100, message = "최대 인원 수는 100명을 초과할 수 없습니다.")
Integer maxMember,

@URL(message = "이미지 URL 형식이 올바르지 않습니다.")
String image
// @NotNull(message = "이미지 참조 id를 입력해주세요.")
Long imageRefId
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,23 @@ public record GroupDetailResponse(

Integer maxMember,

Long imageRefId,

String imageUrl,

LocalDateTime createdAt,

LocalDateTime modifiedAt
) {
public static GroupDetailResponse from(Group group) {
public static GroupDetailResponse from(Group group, Long imageRefId) {
return new GroupDetailResponse(
group.getName(),
group.getCategory(),
group.getDescription(),
group.getApplicationRequired(),
group.getPublicVisible(),
group.getMaxMember(),
imageRefId,
group.getImageUrl(),
group.getCreatedAt(),
group.getModifiedAt()
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/project/flipnote/group/model/GroupInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ public record GroupInfo(
String name,
String description,
Category category,
String imageUrl) {
public static GroupInfo from(Long groupId, String name, String description, Category category, String imageUrl) {
return new GroupInfo(groupId, name, description, category, imageUrl);
String imageUrl,
Long imageRefId) {
public static GroupInfo from(Long groupId, String name, String description, Category category, String imageUrl, Long imageRefId) {
return new GroupInfo(groupId, name, description, category, imageUrl, imageRefId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public record GroupPutRequest(
@Max(value = 100, message = "최대 인원 수는 100명을 초과할 수 없습니다.")
Integer maxMember,

@URL(message = "이미지 URL 형식이 올바르지 않습니다.")
String image
Long imageRefId
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import project.flipnote.group.entity.QGroup;
import project.flipnote.group.entity.QGroupMember;
import project.flipnote.group.model.GroupInfo;
import project.flipnote.image.entity.QImageRef;
import project.flipnote.image.entity.ReferenceType;

@RequiredArgsConstructor
public class GroupRepositoryImpl implements GroupRepositoryCustom {
Expand All @@ -20,6 +22,7 @@ public class GroupRepositoryImpl implements GroupRepositoryCustom {

QGroup group = QGroup.group;
QGroupMember groupMember = QGroupMember.groupMember;
QImageRef imageRef = QImageRef.imageRef;

@Override
public List<GroupInfo> findAllByCursor(Long lastId, Category category, int pageSize) {
Expand All @@ -40,10 +43,14 @@ public List<GroupInfo> findAllByCursor(Long lastId, Category category, int pageS
group.name,
group.description,
group.category,
group.imageUrl
group.imageUrl,
imageRef.id
))
.from(group)
.where(where)
.leftJoin(imageRef)
.on(imageRef.referenceType.eq(ReferenceType.GROUP)
.and(imageRef.referenceId.eq(group.id)))
.orderBy(group.id.desc())
.limit(pageSize+1)
.fetch();
Expand All @@ -68,12 +75,16 @@ public List<GroupInfo> findAllByCursorAndUserId(Long lastId, Category category,
group.name,
group.description,
group.category,
group.imageUrl
group.imageUrl,
imageRef.id
))
.from(groupMember)
.join(groupMember.group, group)
.on(groupMember.user.id.eq(userId))
.where(where)
.leftJoin(imageRef)
.on(imageRef.referenceType.eq(ReferenceType.GROUP)
.and(imageRef.referenceId.eq(group.id)))
.orderBy(group.id.desc())
.limit(pageSize+1)
.fetch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class GroupPolicyService {
private final RedissonClient redissonClient;

@Transactional
public Group changeGroup(Long groupId, GroupPutRequest req) {
public Group changeGroup(Long groupId, GroupPutRequest req, String url) {
String lockKey = "group_lock:" + groupId;
RLock lock = redissonClient.getLock(lockKey);

Expand All @@ -38,7 +38,7 @@ public Group changeGroup(Long groupId, GroupPutRequest req) {

lockedGroup.validateMaxMemberUpdatable(req.maxMember());

lockedGroup.changeGroup(req);
lockedGroup.changeGroup(req, url);

return lockedGroup;

Expand Down
Loading
Loading