Skip to content

Commit

Permalink
#273 [fix] conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
parkheeddong committed Apr 3, 2024
2 parents 57f4f6c + 2ef5934 commit 44e797f
Show file tree
Hide file tree
Showing 22 changed files with 538 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@
import com.mile.moim.service.dto.MoimCreateRequest;
import com.mile.moim.service.dto.MoimCreateResponse;
import com.mile.moim.service.dto.MoimCuriousPostListResponse;
import com.mile.moim.service.dto.MoimInfoOwnerResponse;
import com.mile.moim.service.dto.MoimInfoResponse;
import com.mile.moim.service.dto.MoimTopicInfoListResponse;
import com.mile.moim.service.dto.MoimNameConflictCheckResponse;
import com.mile.moim.service.dto.MoimInvitationInfoResponse;
import com.mile.moim.service.dto.MoimInfoModifyRequest;
import com.mile.moim.service.dto.MoimTopicResponse;
import com.mile.moim.service.dto.MoimWriterNameListGetResponse;
import com.mile.moim.service.dto.PopularWriterListResponse;
import com.mile.moim.service.dto.TemporaryPostExistResponse;
import com.mile.moim.service.dto.TopicCreateRequest;
import com.mile.moim.service.dto.TopicListResponse;
import com.mile.moim.service.dto.WriterNameConflictCheckResponse;
import com.mile.moim.service.dto.WriterMemberJoinRequest;
import com.mile.resolver.moim.MoimIdPathVariable;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand Down Expand Up @@ -148,6 +155,24 @@ public SuccessResponse<MoimCuriousPostListResponse> getMostCuriousPostByMoim(
moimService.getMostCuriousPostFromMoim(moimId));
}

@Override
@GetMapping("/{moimId}/info/owner")
public ResponseEntity<SuccessResponse<MoimInfoOwnerResponse>> getMoimInfoForOwner(
@MoimIdPathVariable final Long moimId,
@PathVariable("moimId") final String moimUrl
) {
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.MOIM_INFO_FOR_OWNER_GET_SUCCESS, moimService.getMoimInfoForOwner(moimId, principalHandler.getUserIdFromPrincipal())));
}
@Override
@PostMapping("/{moimId}/topic")
public ResponseEntity<SuccessResponse> createTopicOfMoim(
@MoimIdPathVariable final Long moimId,
@RequestBody final TopicCreateRequest createRequest,
@PathVariable("moimId") final String moimUrl
) {
return ResponseEntity.created(URI.create(moimService.createTopic(moimId,principalHandler.getUserIdFromPrincipal(), createRequest))).body(SuccessResponse.of(SuccessMessage.TOPIC_CREATE_SUCCESS));
}

@GetMapping("/best")
public ResponseEntity<SuccessResponse<BestMoimListResponse>> getBestMoimAndPostList() {
return ResponseEntity.status(HttpStatus.OK).body(SuccessResponse.of(SuccessMessage.BEST_MOIM_POSTS_GET_SUCCESS,
Expand All @@ -164,6 +189,17 @@ public SuccessResponse<TemporaryPostExistResponse> getTemporaryPost(
moimService.getTemporaryPost(moimId, principalHandler.getUserIdFromPrincipal()));
}


@Override
@GetMapping("/{moimId}/admin/topicList")
public ResponseEntity<SuccessResponse<MoimTopicInfoListResponse>> getMoimTopicList(
@MoimIdPathVariable final Long moimId,
@RequestParam final int page,
@PathVariable("moimId") final String moimUrl
) {
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.MOIM_TOPIC_LIST_GET_SUCCESS, moimService.getMoimTopicList(moimId, principalHandler.getUserIdFromPrincipal(), page)));
}

@Override
@PutMapping("/{moimId}/info")
public ResponseEntity<SuccessResponse> modifyMoimInformation(
Expand Down Expand Up @@ -191,4 +227,14 @@ public ResponseEntity<SuccessResponse<MoimCreateResponse>> createMoim(
) {
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.MOIM_CREATE_SUCCESS, moimService.createMoim(principalHandler.getUserIdFromPrincipal(), creatRequest)));
}

@Override
@GetMapping("/{moimId}/writerNameList")
public ResponseEntity<SuccessResponse<MoimWriterNameListGetResponse>> getWriterNameListOfMoim(
@MoimIdPathVariable final Long moimId,
@RequestParam final int page,
@PathVariable("moimId") final String moimUrl
) {
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.MOIM_WRITERNAME_LIST_GET_SUCCESS, moimService.getWriterNameListOfMoim(moimId, principalHandler.getUserIdFromPrincipal(), page)));
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@
import com.mile.moim.service.dto.MoimCreateRequest;
import com.mile.moim.service.dto.MoimCreateResponse;
import com.mile.moim.service.dto.MoimCuriousPostListResponse;
import com.mile.moim.service.dto.MoimInfoOwnerResponse;
import com.mile.moim.service.dto.MoimInfoResponse;
import com.mile.moim.service.dto.MoimTopicInfoListResponse;
import com.mile.moim.service.dto.MoimNameConflictCheckResponse;
import com.mile.moim.service.dto.MoimInvitationInfoResponse;
import com.mile.moim.service.dto.MoimNameConflictCheckResponse;
import com.mile.moim.service.dto.MoimInfoModifyRequest;
import com.mile.moim.service.dto.MoimTopicResponse;
import com.mile.moim.service.dto.MoimWriterNameListGetResponse;
import com.mile.moim.service.dto.TemporaryPostExistResponse;
import com.mile.moim.service.dto.TopicCreateRequest;
import com.mile.moim.service.dto.TopicListResponse;
import com.mile.moim.service.dto.PopularWriterListResponse;
import com.mile.moim.service.dto.WriterNameConflictCheckResponse;
Expand Down Expand Up @@ -213,6 +218,23 @@ ResponseEntity<SuccessResponse> joinMoim(
@PathVariable("moimId") final String moimUrl
);

@Operation(summary = "관리자 페이지 글감 조회")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "글감 리스트 조회가 완료되었습니다."),
@ApiResponse(responseCode = "404", description = "해당 모임은 존재하지 않습니다."),
@ApiResponse(responseCode = "403", description = "사용자는 해당 모임의 모임장이 아닙니다."),
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
)
ResponseEntity<SuccessResponse<MoimTopicInfoListResponse>> getMoimTopicList(
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long moimId,
final int page,
@PathVariable("moimId") final String moimUrl
);


@Operation(summary = "관리자 페이지 모임 정보 수정")
@ApiResponses(
value = {
Expand All @@ -230,10 +252,12 @@ ResponseEntity<SuccessResponse> modifyMoimInformation(
@PathVariable("moimId") final String moimUrl
);


@Operation(summary = "글모임 이름 중복확인")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "글모임 이름 중복 확인이 완료되었습니다."),

@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
Expand All @@ -257,4 +281,70 @@ ResponseEntity<SuccessResponse<MoimNameConflictCheckResponse>> validateMoimName(
ResponseEntity<SuccessResponse<MoimCreateResponse>> createMoim(
@RequestBody final MoimCreateRequest creatRequest
);


@Operation(summary = "관리자 페이지 글모임 글감 생성")
@ApiResponses(
value = {
@ApiResponse(responseCode = "201", description = "글감 생성이 완료되었습니다."),
@ApiResponse(responseCode = "400",description = "1. 글감은 최대 15자 이내로 작성해주세요.\n"
+ "2. 글감 제목이 비어있습니다.\n" + "3. 글감 태그는 최대 5자 이내로 작성해주세요.\n"
+ "4. 글감 태그가 비어있습니다.\n" + "5. 글감 설명은 최대 90자 이내로 작성해주세요."
),
@ApiResponse(responseCode = "401", description = "로그인 후 이용해주세요.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "해당 모임은 존재하지 않습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "403", description = "사용자는 해당 모임의 모임장이 아닙니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
)
ResponseEntity<SuccessResponse> createTopicOfMoim(
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long moimId,
@RequestBody final TopicCreateRequest createRequest,
@PathVariable("moimId") final String moimUrl
);

@Operation(summary = "관리자 페이지 모임 정보 조회")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "관리자 페이지의 모임 정보가 조회되었습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "401", description = "로그인 후 이용해주세요.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "403", description = "사용자는 해당 모임의 모임장이 아닙니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "해당 모임은 존재하지 않습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
)
ResponseEntity<SuccessResponse<MoimInfoOwnerResponse>> getMoimInfoForOwner(
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long moimId,
@PathVariable("moimId") final String moimUrl
);

@Operation(summary = "관리자 페이지 멤버 리스트 조회")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "멤버 리스트 조회가 조회되었습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "401", description = "로그인 후 이용해주세요.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "403", description = "사용자는 해당 모임의 모임장이 아닙니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "해당 모임은 존재하지 않습니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
)
ResponseEntity<SuccessResponse<MoimWriterNameListGetResponse>> getWriterNameListOfMoim(
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long moimId,
@RequestParam final int page,
@PathVariable("moimId") final String moimUrl
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import com.mile.topic.service.TopicService;
import com.mile.topic.service.dto.PostListInTopicResponse;
import com.mile.topic.service.dto.TopicDetailResponse;
import com.mile.topic.service.dto.TopicPutRequest;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

Expand Down Expand Up @@ -42,4 +45,15 @@ public ResponseEntity<SuccessResponse<TopicDetailResponse>> getTopicDetail(
) {
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.TOPIC_DETAIL_GET_SUCCESS ,topicService.getTopicDetail(principalHandler.getUserIdFromPrincipal(), topicId)));
}

@Override
@PutMapping("/{topicId}")
public ResponseEntity<SuccessResponse> putTopic(
@RequestBody final TopicPutRequest topicPutRequest,
@TopicIdPathVariable final Long topicId,
@PathVariable("topicId") final String topicUrl
) {
topicService.putTopic(principalHandler.getUserIdFromPrincipal(), topicId, topicPutRequest);
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.TOPIC_PUT_SUCCESS));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.mile.dto.SuccessResponse;
import com.mile.topic.service.dto.PostListInTopicResponse;
import com.mile.topic.service.dto.TopicDetailResponse;
import com.mile.topic.service.dto.TopicPutRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
Expand All @@ -15,6 +16,7 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

@Tag(name = "Topic")
public interface TopicControllerSwagger {
Expand Down Expand Up @@ -54,4 +56,24 @@ ResponseEntity<SuccessResponse<TopicDetailResponse>> getTopicDetail(
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long topicId,
@PathVariable("topicId") final String topicUrl
);

@Operation(summary = "글감 수정")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "글감 수정이 완료되었습니다."),
@ApiResponse(responseCode = "400" ,description = "1. 글감은 최대 15자 이내로 작성해주세요.\n" +
"2. 글감 태그는 최대 5자 이내로 작성해주세요.\n" +
"3. 글감 소개글은 최대 90자 이내로 작성해주세요."),
@ApiResponse(responseCode = "400", description = "입력 값이 유효하지 않습니다."),
@ApiResponse(responseCode = "403", description = "사용자는 해당 모임의 모임장이 아닙니다."),
@ApiResponse(responseCode = "404", description = "해당 글감은 존재하지 않습니다."),
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
)
ResponseEntity<SuccessResponse> putTopic(
@RequestBody final TopicPutRequest topicPutRequest,
@Parameter(schema = @Schema(implementation = String.class), in = ParameterIn.PATH) final Long topicId,
@PathVariable("topicId") final String topicUrl
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.mile.controller.writername;

import com.mile.authentication.PrincipalHandler;
import com.mile.dto.SuccessResponse;
import com.mile.exception.message.SuccessMessage;
import com.mile.writername.service.WriterNameDeleteService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequiredArgsConstructor
@RestController
@RequestMapping("/api/writerName")
public class WriterNameController implements WriterNameControllerSwagger{

private final WriterNameDeleteService writerNameDeleteService;
private final PrincipalHandler principalHandler;

@Override
@DeleteMapping("/{writerNameId}")
public ResponseEntity<SuccessResponse> deleteMember(
@PathVariable("writerNameId") final Long writerNameId
) {
writerNameDeleteService.deleteWriterNameById(writerNameId, principalHandler.getUserIdFromPrincipal());
return ResponseEntity.ok(SuccessResponse.of(SuccessMessage.MOIM_MEMBER_DELETE_SUCCESS));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.mile.controller.writername;

import com.mile.dto.ErrorResponse;
import com.mile.dto.SuccessResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;

@Tag(name = "WriterName")
public interface WriterNameControllerSwagger {

@Operation(summary = "관리자 페이지 멤버 삭제")
@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "멤버 삭제가 완료되었습니다."),
@ApiResponse(responseCode = "404", description = "해당 사용자는 존재하지 않습니다."),
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.",
content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
}
)
ResponseEntity<SuccessResponse> deleteMember(
@PathVariable("writerNameId") final Long writerNameId
);
}

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public enum ErrorMessage {
Forbidden
*/
COMMENT_ACCESS_ERROR(HttpStatus.FORBIDDEN.value(), "해당 사용자는 댓글에 접근 권한이 없습니다."),
OWNER_AUTHENTICATE_ERROR(HttpStatus.FORBIDDEN.value(), "사용자는 해당 모임의 모임장이 아닙니다."),
/*
Method Not Supported
*/
Expand Down
Loading

0 comments on commit 44e797f

Please sign in to comment.