Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,31 @@ jobs:
if [[ "$ENV_COLOR" == "blue" || "$ENV_COLOR" == "none" ]]; then
# 블루 서버가 실행 중이거나 아무 서버도 돌아가고 있지 않다면 그린 서버를 실행
sudo docker-compose -f docker-compose.yml up -d --no-deps web-green
sleep 45
sleep 75
# 그린 서버가 정상적으로 작동하는지 확인 (예: HTTP 상태 코드 200 확인)
if curl --silent --fail http://localhost:8081; then
echo "Green server is working correctly."
# 기존 서버 종료
sudo docker-compose -f docker-compose.yml stop web-blue
# Nginx를 Green 서버로 전환
sudo sed -i 's/8080/8081/' /etc/nginx/sites-available/teamspot.site
sudo systemctl restart nginx
# 기존 서버 종료
sudo docker-compose -f docker-compose.yml stop web-blue
else
echo "Green server is not responding correctly. Exiting."
exit 1
fi
elif [[ "$ENV_COLOR" == "green" ]]; then
# 그린 서버가 실행 중이면 블루 서버를 실행
sudo docker-compose -f docker-compose.yml up -d --no-deps web-blue
sleep 45
sleep 75
# 블루 서버가 정상적으로 작동하는지 확인
if curl --silent --fail http://localhost:8080; then
echo "Blue server is working correctly."
# 기존 서버 종료
sudo docker-compose -f docker-compose.yml stop web-green
# Nginx를 Blue 서버로 전환
sudo sed -i 's/8081/8080/' /etc/nginx/sites-available/teamspot.site
sudo systemctl restart nginx
# 기존 서버 종료
sudo docker-compose -f docker-compose.yml stop web-green
else
echo "Blue server is not responding correctly. Exiting."
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.example.spot.domain.Quiz;
import com.example.spot.domain.common.BaseEntity;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.*;

@Getter
@Entity
Expand Down Expand Up @@ -36,6 +33,7 @@ public class MemberAttendance extends BaseEntity {

/* ----------------------------- 생성자 ------------------------------------- */

@Builder
public MemberAttendance(Boolean isCorrect) {
this.isCorrect = isCorrect;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,6 @@ private static void checkStartAndFinishDate(ScheduleRequestDTO.ScheduleDTO sched

/**
* 출석 퀴즈를 생성하는 메서드입니다.
*
* @param studyId 타겟 스터디의 아이디를 입력 받습니다.
* @param scheduleId 타겟 일정의 아이디를 입력 받습니다.
* @param quizRequestDTO 출석 퀴즈에 담길 질문과 정답을 입력 받습니다.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ public StudyApplicantDTO isApplied(Long studyId) {

/**
* 금일 모든 스터디 회원의 출석 정보를 불러옵니다.
*
* @param studyId 출석 정보를 불러올 스터디의 아이디를 입력 받습니다.
* @param scheduleId 스터디 일정의 아이디를 입력 받습니다.
* @param date
Expand Down
85 changes: 41 additions & 44 deletions src/main/java/com/example/spot/web/controller/PostController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.example.spot.api.ApiResponse;
import com.example.spot.api.code.status.SuccessStatus;
import com.example.spot.security.utils.SecurityUtils;
import com.example.spot.service.post.PostCommandService;
import com.example.spot.service.post.PostQueryService;
import com.example.spot.validation.annotation.ExistMember;
Expand Down Expand Up @@ -42,12 +43,11 @@ public class PostController {
""",
security = @SecurityRequirement(name = "accessToken")
)
@PostMapping(value = "/{memberId}")
@PostMapping
public ApiResponse<PostCreateResponse> create(
@PathVariable @ExistMember Long memberId,
@RequestBody @Valid PostCreateRequest postCreateRequest
) {
PostCreateResponse response = postCommandService.createPost(memberId, postCreateRequest);
PostCreateResponse response = postCommandService.createPost(SecurityUtils.getCurrentUserId(), postCreateRequest);
return ApiResponse.onSuccess(SuccessStatus._CREATED, response);
}

Expand Down Expand Up @@ -139,9 +139,8 @@ public ApiResponse<PostAnnouncementResponse> getPostAnnouncement() {
description = "게시글 Id를 받아 게시글을 수정합니다.",
security = @SecurityRequirement(name = "accessToken")
)
@PatchMapping("/{memberId}/{postId}")
@PatchMapping("/{postId}")
public ApiResponse<PostCreateResponse> update(
@PathVariable @ExistMember Long memberId,
@Parameter(
description = "수정할 게시글의 ID입니다.",
schema = @Schema(type = "integer", format = "int64")
Expand All @@ -152,44 +151,43 @@ public ApiResponse<PostCreateResponse> update(
)
@RequestBody PostUpdateRequest postUpdateRequest
) {
PostCreateResponse response = postCommandService.updatePost(memberId, postId, postUpdateRequest);
PostCreateResponse response = postCommandService.updatePost(SecurityUtils.getCurrentUserId(), postId, postUpdateRequest);
return ApiResponse.onSuccess(SuccessStatus._OK, response);
}

@Tag(name = "게시판", description = "게시판 관련 API")
@Operation(summary = "[게시판] 게시글 삭제 API", description = "게시글 Id를 받아 게시글을 삭제합니다.")
@DeleteMapping("/{memberId}/{postId}")
@DeleteMapping("/{postId}")
public ApiResponse<Void> delete(
@PathVariable @ExistMember Long memberId,
@Parameter(
description = "삭제할 게시글의 ID입니다.",
schema = @Schema(type = "integer", format = "int64")
)
@PathVariable Long postId
) {
postCommandService.deletePost(memberId, postId);
postCommandService.deletePost(SecurityUtils.getCurrentUserId(), postId);
return ApiResponse.onSuccess(SuccessStatus._NO_CONTENT);

}

@Tag(name = "게시글 좋아요", description = "게시글 좋아요 관련 API")
//게시글 좋아요
@Operation(summary = "[게시판] 게시글 좋아요 API", description = "게시글 Id를 받아 게시글에 좋아요를 추가합니다.")
@PostMapping("/{postId}/{memberId}/like")
@PostMapping("/{postId}/like")
public ApiResponse<PostLikeResponse> likePost(
@PathVariable @ExistPost Long postId,
@PathVariable @ExistMember Long memberId) {
PostLikeResponse response = postCommandService.likePost(postId, memberId);
@PathVariable @ExistPost Long postId
) {
PostLikeResponse response = postCommandService.likePost(postId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._OK, response);
}

@Tag(name = "게시글 좋아요", description = "게시글 좋아요 관련 API")
@Operation(summary = "[게시판] 게시글 좋아요 취소 API", description = "게시글 Id를 받아 게시글에 좋아요를 취소합니다.")
@DeleteMapping("/{postId}/{memberId}/like")
@DeleteMapping("/{postId}/like")
public ApiResponse<PostLikeResponse> cancelPostLike(
@PathVariable @ExistPost Long postId,
@PathVariable @ExistMember Long memberId) {
PostLikeResponse response = postCommandService.cancelPostLike(postId, memberId);
@PathVariable @ExistPost Long postId
) {
PostLikeResponse response = postCommandService.cancelPostLike(postId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._NO_CONTENT, response);
}

Expand All @@ -206,12 +204,11 @@ public ApiResponse<PostLikeResponse> cancelPostLike(

생성된 댓글의 고유 ID와 부모댓글 ID(parentCommentId가 0일 경우 null로 반환), 댓글 내용, 작성자를 반환합니다.
""")
@PostMapping("/{postId}/{memberId}/comments")
@PostMapping("/{postId}/comments")
public ApiResponse<CommentCreateResponse> createComment(
@PathVariable @ExistPost Long postId,
@PathVariable @ExistMember Long memberId,
@RequestBody CommentCreateRequest request) {
CommentCreateResponse response = postCommandService.createComment(postId, memberId, request);
CommentCreateResponse response = postCommandService.createComment(postId, SecurityUtils.getCurrentUserId(), request);
return ApiResponse.onSuccess(SuccessStatus._CREATED, response);
}

Expand All @@ -233,64 +230,64 @@ public ApiResponse<CommentResponse> getComment(
//게시글 댓글 좋아요
@Tag(name = "게시판 - 댓글", description = "댓글 관련 API")
@Operation(summary = "[게시판] 댓글 좋아요 API", description = "댓글 ID와 회원 ID를 받아 댓글에 좋아요를 추가합니다.")
@PostMapping("/comments/{commentId}/{memberId}/like")
@PostMapping("/comments/{commentId}/like")
public ApiResponse<CommentLikeResponse> likeComment(
@PathVariable Long commentId,
@PathVariable @ExistMember Long memberId) {
CommentLikeResponse response = postCommandService.likeComment(commentId, memberId);
@PathVariable Long commentId
) {
CommentLikeResponse response = postCommandService.likeComment(commentId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._OK, response);
}

@Tag(name = "게시판 - 댓글", description = "댓글 관련 API")
@Operation(summary = "[게시판] 댓글 좋아요 취소 API", description = "댓글 ID와 회원 ID를 받아 댓글에 좋아요를 취소합니다.")
@DeleteMapping("/comments/{commentId}/{memberId}/like")
@DeleteMapping("/comments/{commentId}/like")
public ApiResponse<CommentLikeResponse> cancelCommentLike(
@PathVariable Long commentId,
@PathVariable @ExistMember Long memberId) {
CommentLikeResponse response = postCommandService.cancelCommentLike(commentId, memberId);
@PathVariable Long commentId
) {
CommentLikeResponse response = postCommandService.cancelCommentLike(commentId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._NO_CONTENT, response);
}

//게시글 댓글 싫어요
@Tag(name = "게시판 - 댓글", description = "댓글 관련 API")
@Operation(summary = "[게시판] 댓글 싫어요 API", description = "댓글 ID와 회원 ID를 받아 댓글에 싫어요를 추가합니다.")
@PostMapping("/comments/{commentId}/{memberId}/dislike")
@PostMapping("/comments/{commentId}/dislike")
public ApiResponse<CommentLikeResponse> dislikeComment(
@PathVariable Long commentId,
@PathVariable @ExistMember Long memberId) {
CommentLikeResponse response = postCommandService.dislikeComment(commentId, memberId);
@PathVariable Long commentId
) {
CommentLikeResponse response = postCommandService.dislikeComment(commentId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._OK, response);
}

@Tag(name = "게시판 - 댓글", description = "댓글 관련 API")
@Operation(summary = "[게시판] 댓글 싫어요 취소 API", description = "댓글 ID와 회원 ID를 받아 댓글에 싫어요를 취소합니다.")
@DeleteMapping("/comments/{commentId}/{memberId}/dislike")
@DeleteMapping("/comments/{commentId}/dislike")
public ApiResponse<CommentLikeResponse> cancelCommentDislike(
@PathVariable Long commentId,
@PathVariable @ExistMember Long memberId) {
CommentLikeResponse response = postCommandService.cancelCommentDislike(commentId, memberId);
@PathVariable Long commentId
) {
CommentLikeResponse response = postCommandService.cancelCommentDislike(commentId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._NO_CONTENT, response);
}

//스크랩
@Tag(name = "게시글 스크랩", description = "게시글 스크랩 관련 API")
@Operation(summary = "[게시판] 게시글 스크랩 API", description = "게시글 ID와 회원 ID를 받아 스크랩을 추가합니다.")
@PostMapping("/{postId}/{memberId}/scrap")
@PostMapping("/{postId}/scrap")
public ApiResponse<ScrapPostResponse> scrapPost(
@PathVariable @ExistPost Long postId,
@PathVariable @ExistMember Long memberId) {
ScrapPostResponse response = postCommandService.scrapPost(postId, memberId);
@PathVariable @ExistPost Long postId
) {
ScrapPostResponse response = postCommandService.scrapPost(postId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._OK, response);
}


@Tag(name = "게시글 스크랩", description = "게시글 스크랩 관련 API")
@Operation(summary = "[게시판] 게시글 스크랩 취소 API", description = "게시글 ID와 회원 ID를 받아 스크랩을 취소합니다.")
@DeleteMapping("/{postId}/{memberId}/scrap")
@DeleteMapping("/{postId}/scrap")
public ApiResponse<ScrapPostResponse> cancelPostScrap(
@PathVariable @ExistPost Long postId,
@PathVariable @ExistMember Long memberId) {
ScrapPostResponse response = postCommandService.cancelPostScrap(postId, memberId);
@PathVariable @ExistPost Long postId
) {
ScrapPostResponse response = postCommandService.cancelPostScrap(postId, SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._NO_CONTENT, response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public class SearchController {
## [메인 화면] 접속한 회원의 추천 스터디 3개를 조회 합니다.
조회된 스터디 3개의 정보가 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken"))
@Parameter(name = "memberId", description = "조회할 유저의 ID를 입력 받습니다.", required = true)
public ApiResponse<StudyPreviewDTO> recommendStudiesForMain() {
StudyPreviewDTO recommendStudies = studyQueryService.findRecommendStudies(SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, recommendStudies);
Expand All @@ -68,7 +67,6 @@ public ApiResponse<StudyPreviewDTO> interestedStudiesForMain() {
## [마이 페이지] 마이 페이지에 들어갈 나와 관련된 스터디 갯수 정보를 조회합니다.
스터디 갯수 정보와 내 이름이 반환 됩니다.""",
security = @SecurityRequirement(name = "accessToken"))
@Parameter(name = "memberId", description = "조회할 유저의 ID를 입력 받습니다.", required = true)
public ApiResponse<MyPageDTO> myPage() {
MyPageDTO myPageStudyCount = studyQueryService.getMyPageStudyCount(SecurityUtils.getCurrentUserId());
return ApiResponse.onSuccess(SuccessStatus._STUDY_FOUND, myPageStudyCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.example.spot.validation.annotation.ExistMember;
import com.example.spot.validation.annotation.TextLength;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand All @@ -12,6 +13,7 @@
public class StudyQuizRequestDTO {

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class QuizDTO {
Expand All @@ -26,6 +28,7 @@ public static class QuizDTO {
}

@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
public static class AttendanceDTO {
Expand Down
Loading
Loading