Skip to content

Commit

Permalink
v2.5.1
Browse files Browse the repository at this point in the history
v2.5.1
  • Loading branch information
hoonyworld authored Jan 27, 2025
2 parents 4246ea7 + a228f63 commit 7d12be6
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 50 deletions.
31 changes: 17 additions & 14 deletions main/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@ COPY --from=build /app/build/libs/*.jar app.jar

ARG SPRING_PROFILES_ACTIVE

# Default values
ENV AGENT_ID="agent-in-docker"
ENV APPLICATION_NAME="spring"
# 핀포인트 설정을 위한 세팅 (현재는 사용하지 않기 때문에 주석처리)
#ENV AGENT_ID="agent-in-docker"
#ENV APPLICATION_NAME="spring"

# Set environment variables based on the active profile
RUN if [ "$SPRING_PROFILES_ACTIVE" = "dev" ]; then \
AGENT_ID="dev-agent"; \
APPLICATION_NAME="spring-dev"; \
elif [ "$SPRING_PROFILES_ACTIVE" = "prod" ]; then \
AGENT_ID="prod-agent"; \
APPLICATION_NAME="spring-prod"; \
fi && \
echo "Using AGENT_ID=$AGENT_ID and APPLICATION_NAME=$APPLICATION_NAME"
# 핀포인트 설정을 위한 세팅 (현재는 사용하지 않기 때문에 주석처리)
#RUN if [ "$SPRING_PROFILES_ACTIVE" = "dev" ]; then \
# AGENT_ID="dev-agent"; \
# APPLICATION_NAME="spring-dev"; \
# elif [ "$SPRING_PROFILES_ACTIVE" = "prod" ]; then \
# AGENT_ID="prod-agent"; \
# APPLICATION_NAME="spring-prod"; \
# fi && \
# echo "Using AGENT_ID=$AGENT_ID and APPLICATION_NAME=$APPLICATION_NAME"

ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.3.jar -Dpinpoint.agentId=$AGENT_ID -Dpinpoint.applicationName=$APPLICATION_NAME -Dpinpoint.profiler.profiles.active=release"

ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]
# 핀포인트 설정을 위한 세팅 (현재는 사용하지 않기 때문에 주석처리)
# ENV JAVA_OPTS="-javaagent:/pinpoint-agent/pinpoint-bootstrap-2.5.3.jar -Dpinpoint.agentId=$AGENT_ID -Dpinpoint.applicationName=$APPLICATION_NAME -Dpinpoint.profiler.profiles.active=release"
# ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar /app/app.jar"]

ENTRYPOINT ["java","-jar","/app/app.jar"]
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

public interface TagRepository extends JpaRepository<Tag, Integer> {
Optional<WelcomeMessageTypeProjection> findByFlashId(Integer flashId);

void deleteByFlashId(Integer flashId);
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.sopt.makers.crew.main.internal;

import java.util.Map;

import org.sopt.makers.crew.main.internal.dto.ApprovedStudyCountResponseDto;
import org.springframework.http.ResponseEntity;

import io.swagger.v3.oas.annotations.Operation;
Expand All @@ -12,14 +11,13 @@
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;

@Tag(name = "internal API - 개수(스터디, 행사 등등)")
@Tag(name = "[Internal] 모임 통계(수치)")
public interface InternalMeetingStatsApi {

@Operation(summary = "유저의 승인된 스터디 수 조회", description = "특정 유저의 승인된 스터디 수를 조회하는 API입니다.", tags = {
"Internal Meeting Stats"})
@Operation(summary = "[Internal] 모임 유저의 승인된 스터디 수 조회", description = "특정 유저의 승인된 스터디 수를 조회하는 API입니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "APPROVE된 스터디 수 조회 성공", content = @Content(mediaType = "application/json", schema = @Schema(example = "{\"orgId\": 1, \"approvedStudyCount\": 5}"))),
@ApiResponse(responseCode = "404", description = "존재하지 않는 유저입니다.", content = @Content(mediaType = "application/json"))})
ResponseEntity<Map<String, Object>> getApprovedStudyCountByOrgId(
ResponseEntity<ApprovedStudyCountResponseDto> getApprovedStudyCountByOrgId(
@Parameter(description = "플레이그라운드 유저 ID(orgId)", example = "1") Integer orgId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@RestController
@RequestMapping("/internal/meeting/stats")
@RequiredArgsConstructor
public class InternalMeetingStatsController {
public class InternalMeetingStatsController implements InternalMeetingStatsApi {
private final InternalMeetingStatsService internalMeetingStatsService;

@GetMapping("/approved-studies/{orgId}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.sopt.makers.crew.main.meeting.v2.service;

import static org.sopt.makers.crew.main.entity.apply.enums.EnApplyStatus.*;
import static org.sopt.makers.crew.main.global.constant.CrewConst.*;
import static org.sopt.makers.crew.main.global.exception.ErrorStatus.*;
import static org.sopt.makers.crew.main.entity.apply.enums.EnApplyStatus.*;

import java.io.FileOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -30,6 +30,8 @@
import org.sopt.makers.crew.main.entity.apply.enums.EnApplyType;
import org.sopt.makers.crew.main.entity.comment.Comment;
import org.sopt.makers.crew.main.entity.comment.CommentRepository;
import org.sopt.makers.crew.main.entity.flash.Flash;
import org.sopt.makers.crew.main.entity.flash.FlashRepository;
import org.sopt.makers.crew.main.entity.like.LikeRepository;
import org.sopt.makers.crew.main.entity.meeting.CoLeader;
import org.sopt.makers.crew.main.entity.meeting.CoLeaderReader;
Expand All @@ -43,6 +45,7 @@
import org.sopt.makers.crew.main.entity.meeting.vo.ImageUrlVO;
import org.sopt.makers.crew.main.entity.post.Post;
import org.sopt.makers.crew.main.entity.post.PostRepository;
import org.sopt.makers.crew.main.entity.tag.TagRepository;
import org.sopt.makers.crew.main.entity.user.User;
import org.sopt.makers.crew.main.entity.user.UserReader;
import org.sopt.makers.crew.main.entity.user.UserRepository;
Expand All @@ -54,6 +57,7 @@
import org.sopt.makers.crew.main.global.dto.MeetingCreatorDto;
import org.sopt.makers.crew.main.global.dto.MeetingResponseDto;
import org.sopt.makers.crew.main.global.exception.BadRequestException;
import org.sopt.makers.crew.main.global.exception.NotFoundException;
import org.sopt.makers.crew.main.global.exception.ServerException;
import org.sopt.makers.crew.main.global.pagination.dto.PageMetaDto;
import org.sopt.makers.crew.main.global.pagination.dto.PageOptionsDto;
Expand Down Expand Up @@ -109,6 +113,8 @@ public class MeetingV2ServiceImpl implements MeetingV2Service {
private final CommentRepository commentRepository;
private final LikeRepository likeRepository;
private final CoLeaderRepository coLeaderRepository;
private final FlashRepository flashRepository;
private final TagRepository tagRepository;
private final MeetingReader meetingReader;
private final CoLeaderReader coLeaderReader;
private final UserReader userReader;
Expand Down Expand Up @@ -342,10 +348,14 @@ public void deleteMeeting(Integer meetingId, Integer userId) {
meeting.validateMeetingCreator(userId);

List<Post> posts = postRepository.findAllByMeetingId(meetingId);
List<Integer> postIds = posts.stream().map(Post::getId).toList();
List<Integer> postIds = posts.stream()
.map(Post::getId)
.toList();

List<Comment> comments = commentRepository.findAllByPostIdIsIn(postIds);
List<Integer> commentIds = comments.stream().map(Comment::getId).toList();
List<Integer> commentIds = comments.stream()
.map(Comment::getId)
.toList();

likeRepository.deleteAllByPostIdsInQuery(postIds);
likeRepository.deleteAllByCommentIdsInQuery(commentIds);
Expand All @@ -355,6 +365,14 @@ public void deleteMeeting(Integer meetingId, Integer userId) {
applyRepository.deleteAllByMeetingIdQuery(meetingId);
coLeaderRepository.deleteAllByMeetingId(meetingId);

if (meeting.getCategory() == MeetingCategory.FLASH) {
Flash flash = flashRepository.findByMeetingId(meetingId)
.orElseThrow(() -> new NotFoundException(NOT_FOUND_FLASH.getErrorCode()));

tagRepository.deleteByFlashId(flash.getId());
flashRepository.delete(flash);
}

meetingRepository.delete(meeting);
}

Expand Down

0 comments on commit 7d12be6

Please sign in to comment.